开发者

fluent Nhibernatetest mappings

开发者 https://www.devze.com 2023-01-07 05:30 出处:网络
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

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

精彩评论

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