Assert.AreEqual fails while it shouldn't
I have a really weird behavior which I cannot explain. I have the following class: public class Project { public virtual int Id { get; set; } public virtual string Name { get; set; } } And a method which returns a Project object: public Project GetByName(string Name) { using (ISession session = NHibernateHelper.OpenSession()) { Project project = session.CreateCriteria(typeof(Project)) .Add(Restrictions.Eq("Name", Name)) .UniqueResult<Project>(); return project; } } I have added a Unit Test to test the GetByName method: [TestMethod] public void TestGetByName() { IProjectsRepository