开发者

fluent Nhibernatetest mappings

Hi there I am using Fluent Nhibernate and I'd like to write tests for my mappings as shown below.

I have a scenario where I have a User class and a UserProfile class

The User class is an entity and 开发者_JS百科the UserProfile is a value type, there is a 1:1 relationship between the two.

How would I test the mappings based on this? Do I write separate tests for User and UserProfile? or Am I able to write a test for User that maps the profile at the same time? Thanks

[Test] 
public void can_correctly_map_customer()
{
    new PersistenceSpecification<Customer>(Session)
    .CheckProperty(c => c.Id, 1001)
    .CheckProperty(c => c.FirstName, "John")
    .CheckProperty(c => c.LastName, "Doe")
}


Persistence specification testing

See the section on testing references.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜