public void Transient_Object_Should_Return_Consistent_HashCode()
 {
     var obj = new ObjectWithMultipleDomainSignature();
     int firstHash = obj.GetHashCode();
     int secondHash = obj.GetHashCode();
     Assert.AreEqual(firstHash, secondHash);
 }
 public void Two_Transient_Objects_With_Same_DomainSignatures_Should_Return_Same_HashCodes()
 {
     var obj = new ObjectWithMultipleDomainSignature {Foo = "Test1", Bar = 1};
     var obj2 = new ObjectWithMultipleDomainSignature {Foo = "Test1", Bar = 1};
     int firstHash = obj.GetHashCode();
     int secondHash = obj2.GetHashCode();
     Assert.AreEqual(firstHash, secondHash);
 }
 public void Transient_Object_Should_Return_Consistent_HashCode_When_Made_Persistant()
 {
     var obj = new ObjectWithMultipleDomainSignature {Foo = "Test1"};
     int firstHash = obj.GetHashCode();
     obj.SetProperty(m => m.Id, 1);
     int secondHash = obj.GetHashCode();
     Assert.AreEqual(firstHash, secondHash);
 }
        public void Two_Transient_Objects_With_Different_Types_And_Different_DomainSignature_And_Same_Values_Generate_Different_HashCodes()
        {
            var obj1 = new ObjectWithMultipleDomainSignature {Foo = "test1", Bar = 2};

            var obj2 = new ObjectWithOneDomainSignature {Foo = "test1", Bar = 2};

            Assert.AreNotEqual(obj1.GetHashCode(), obj2.GetHashCode());
        }
        public void Two_Persistant_Objects_With_Same_Ids_Generate_Same_HashCode()
        {
            var obj1 = new ObjectWithMultipleDomainSignature();
            obj1.SetProperty(m => m.Id, 1);

            var obj2 = new ObjectWithMultipleDomainSignature();
            obj2.SetProperty(m => m.Id, 1);

            Assert.AreEqual(obj1.GetHashCode(), obj2.GetHashCode());
        }