Hi!
I have two problems.
1 . FNH does not test my component correcty and I dont know why.
System.ApplicationException: Expected 'DomainModel.Model.Publisher' but got 'DomainModel.Model.Publisher' for Property 'Publisher'.
[TestMethod]
public void CanCorrectlyMapBook()
{
new PersistenceSpecification<Book>(_session)
.CheckProperty(p => p.Name, "My Book")
.CheckProperty(p=> p.Id, 1)
.CheckProperty(p=>p.IncludesCDDVD, true)
.CheckProperty(p=>p.Isbn, "rder93q43949éwr")
.CheckProperty(p=>p.IsLoaned, false)
.CheckProperty(p=>p.Publisher, new Publisher(){PublisherHomepage = "www.google.de", PublisherName = "google"})
.VerifyTheMappings();
}
}
2 . FNH does not test my reference correctly.
System.ApplicationException: Expected 'DomainModel.Model.Employee' but got 'EmployeeProxyd6f94daa37c74be8b5ccccf40c5c23fa' for Property 'LoanedBy'.
[TestMethod]
public void CanCorrectlyMapBook()
{
new PersistenceSpecification<Book>(_session)
.CheckProperty(p => p.Name, "My Book")
.CheckProperty(p=> p.Id, 1)
.CheckProperty(p=>p.IncludesCDDVD, true)
.CheckProperty(p=>p.Isbn, "rder93q43949éwr")
.CheckProperty(p=>p.IsLoaned, false)
.CheckReference(p=>p.LoanedBy, new Employee(){EMail = "",FirstName = "Alex", LastName = "Mueller"})
.VerifyTheMappings();
}
But when I test this "manually" everything works fine.
ISession mysession = Helper.CreateSessionFactory(false, false).OpenSession();
Book myBook = new Book()
{
Author = "Hesse",
IncludesCDDVD = true,
DateOfIssue = DateTime.Now,
Isbn = "erwe0ri",
IsLoaned = true,
Name = "My Book new",
Publisher = new Publisher() { PublisherHomepage = "www.google.de", PublisherName = "google" },
Release = new Release() { ReleaseDate = DateTime.Now, ReleaseNumber = 1 },
LoanedBy = new Employee() { EMail = "", FirstName = "Alex", LastName = "Mueller" }
};
mysession.Save(myBook);
mysession.Close();
mysession.Dispose();
I have verify this by looking up in the datbase ...
The PersistenceSpecification Tests run against an in-memory database sqllite and my manual "test" runs against a Sql Server 2008.
Does anybody of you have used FNH and tested a reference and a component correctly?