private static OtherTestEntity CreateOtherTestEntity(IDocumentSession session, Guid id, string name) { var entity = new OtherTestEntity { Id = id, Name = name }; session.Store(entity); return(entity); }
public void TwoEntitiesWithDifferingTypesAreNotEqual() { var testEntity = new TestEntity(0); var otherTestEnity = new OtherTestEntity(); Assert.AreNotEqual(testEntity, otherTestEnity); Assert.IsFalse(testEntity.Equals(otherTestEnity)); var entitySet = new HashSet <Entity>(); entitySet.Add(testEntity); entitySet.Add(otherTestEnity); Assert.AreEqual(2, entitySet.Count); }
public void EqualsWithSameIdsInDisparateClassesReturnsFalse() { var obj1 = new TestEntity() { ID = 1, Name = "Vasya", }; var obj2 = new OtherTestEntity() { ID = 1, Name = "Vasya", }; obj1.Save(); obj2.Save(); var equality = Equals(obj1, obj2); Assert.AreEqual(false, equality); }
public void TwoEntitiesWithDifferingTypesAreNotEqual() { var testEntity = new TestEntity(0); var otherTestEnity = new OtherTestEntity(); Assert.AreNotEqual(testEntity, otherTestEnity); Assert.IsFalse(testEntity.Equals(otherTestEnity)); var entitySet = new HashSet<Entity>(); entitySet.Add(testEntity); entitySet.Add(otherTestEnity); Assert.AreEqual(2, entitySet.Count); }
public void Persistent_Entities_Of_Different_Types_With_Same_ID_Should_Have_Different_HashCodes() { TestEntity.Create(1).GetHashCode().Should().NotBe(OtherTestEntity.Create(1).GetHashCode()); }