public void Transient_Object_Should_Return_Consistent_HashCode()
 {
     var obj = new ObjectWithNoDomainSignature();
     int firstHash = obj.GetHashCode();
     int secondHash = obj.GetHashCode();
     Assert.AreEqual(firstHash, secondHash);
 }
 public void Should_Return_True_If_Different_Instances_With_Same_Id()
 {
     var obj = new ObjectWithNoDomainSignature();
     obj.SetProperty(m => m.Id, 2);
     var obj2 = new ObjectWithNoDomainSignature();
     obj2.SetProperty(m => m.Id, 2);
     Assert.AreEqual(obj, obj2);
 }
 public void Two_Transient_Objects_Of_Same_Type_Should_Return_Different_Signatures()
 {
     var obj = new ObjectWithNoDomainSignature();
     var obj2 = new ObjectWithNoDomainSignature();
     int firstHash = obj.GetHashCode();
     int secondHash = obj2.GetHashCode();
     Assert.AreNotEqual(firstHash, secondHash);
 }
 public void Transient_Object_Should_Return_Consistent_HashCode_When_Made_Persistant()
 {
     var obj = new ObjectWithNoDomainSignature();
     int firstHash = obj.GetHashCode();
     obj.SetProperty(m => m.Id, 1);
     int secondHash = obj.GetHashCode();
     Assert.AreEqual(firstHash, secondHash);
 }
        public void Two_Persistant_Objects_With_Same_Ids_Generate_Same_HashCode()
        {
            var obj1 = new ObjectWithNoDomainSignature();
            obj1.SetProperty(m => m.Id, 1);

            var obj2 = new ObjectWithNoDomainSignature();
            obj2.SetProperty(m => m.Id, 1);
            Assert.AreEqual(obj1.GetHashCode(), obj2.GetHashCode());
        }
        public void Two_Persistant_Objects_With_Different_Types_And_Same_Ids_Generate_Different_HashCodes()
        {
            var obj1 = new ObjectWithNoDomainSignature();
            obj1.SetProperty(m => m.Id, 1);

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