public void Transient_Object_Should_Return_Consistent_HashCode()
 {
     var obj = new ObjectWithOneDomainSignature();
     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 ObjectWithOneDomainSignature {Foo = "Test1"};
     var obj2 = new ObjectWithOneDomainSignature {Foo = "Test1"};
     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 ObjectWithOneDomainSignature();
     int firstHash = obj.GetHashCode();
     obj.SetProperty(m => m.Id, 1);
     int secondHash = obj.GetHashCode();
     Assert.AreEqual(firstHash, secondHash);
 }
 public void Should_Return_True_If_Different_Instances_With_Same_Id()
 {
     var obj = new ObjectWithOneDomainSignature();
     obj.SetProperty(m => m.Id, 2);
     var obj2 = new ObjectWithOneDomainSignature();
     obj2.SetProperty(m => m.Id, 2);
     Assert.AreEqual(obj, obj2);
 }
        public void Two_Transient_Objects_With_Different_Types_And_Same_DomainSignature_Generate_Different_HashCodes()
        {
            var obj1 = new ObjectWithOneDomainSignature2 {Foo = "test1"};

            var obj2 = new ObjectWithOneDomainSignature {Foo = "test1"};

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

            var obj2 = new ObjectWithOneDomainSignature();
            obj2.SetProperty(m => m.Id, 1);
            Assert.AreEqual(obj1.GetHashCode(), obj2.GetHashCode());
        }
 public void Should_Return_True_if_Same_Instance()
 {
     var obj = new ObjectWithOneDomainSignature();
     ObjectWithOneDomainSignature obj2 = obj;
     Assert.AreEqual(obj, obj2);
 }
 public void Should_Return_True_If_Same_Domain_Signatures()
 {
     var obj = new ObjectWithOneDomainSignature {Foo = "test1"};
     var obj2 = new ObjectWithOneDomainSignature {Foo = "test1"};
     Assert.AreEqual(obj, obj2);
 }
 public void Should_Return_False_If_Different_Domain_Signatures()
 {
     var obj = new ObjectWithOneDomainSignature {Foo = "test1"};
     var obj2 = new ObjectWithOneDomainSignature {Foo = "test2"};
     Assert.AreNotEqual(obj, obj2);
 }