示例#1
0
        public void CanCalculateHashCode()
        {
            TestClass o1 = new TestClass {
                SomeIntProperty         = 1,
                SomeStringProperty      = "Test",
                SomeNotBusinessProperty = 2
            };
            TestClass o2 = new TestClass {
                SomeIntProperty         = 2,
                SomeStringProperty      = "Test",
                SomeNotBusinessProperty = 2
            };
            TestClass o3 = new TestClass {
                SomeIntProperty         = 1,
                SomeStringProperty      = "Test3",
                SomeNotBusinessProperty = 2
            };
            TestClass o4 = new TestClass {
                SomeIntProperty         = 1,
                SomeStringProperty      = "Test",
                SomeNotBusinessProperty = 3
            };

            int hash1 = HashCodeService.CalculateHashCode(o1, o1.SomeIntProperty, o1.SomeStringProperty);
            int hash2 = HashCodeService.CalculateHashCode(o2, o2.SomeIntProperty, o2.SomeStringProperty);
            int hash3 = HashCodeService.CalculateHashCode(o3, o3.SomeIntProperty, o3.SomeStringProperty);
            int hash4 = HashCodeService.CalculateHashCode(o4, o4.SomeIntProperty, o4.SomeStringProperty);

            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash1, hash3);
            Assert.AreNotEqual(hash2, hash3);
            Assert.AreEqual(hash1, hash4);
            Assert.AreNotEqual(hash2, hash4);
            Assert.AreNotEqual(hash3, hash4);
        }
 /// <inheritdoc />
 public override int GetHashCode()
 {
     return(HashCodeService.CalculateHashCode(
                this,
                HashCodeService.CalculateCollectionHashCode(_errors)
                ));
 }
 public int GetHashCode(ChildVM obj)
 {
     return(HashCodeService.CalculateHashCode(
                obj,
                obj.IntegerProperty,
                obj.StringProperty
                ));
 }
示例#4
0
 public int GetHashCode(ValidationError obj)
 {
     return(HashCodeService.CalculateHashCode(
                obj,
                obj.Details,
                obj.Message,
                obj.Target
                ));
 }
示例#5
0
 public override int GetHashCode()
 {
     return(HashCodeService.CalculateHashCode(
                this,
                ChangeType,
                ChangedVM,
                ChangedProperty
                ));
 }
示例#6
0
 public override int GetHashCode()
 {
     return(HashCodeService.CalculateHashCode(
                this,
                _validator,
                Target,
                Message,
                Details
                ));
 }
 public override int GetHashCode()
 {
     return(HashCodeService.CalculateHashCode(
                this,
                Step,
                VM,
                Collection,
                Property
                ));
 }
 public override int GetHashCode()
 {
     return(HashCodeService.CalculateHashCode(
                this,
                Type,
                Owner,
                TargetVM,
                TargetCollection,
                TargetProperty,
                ValidatorKey
                ));
 }
示例#9
0
 public override int GetHashCode()
 {
     return(HashCodeService.CalculateHashCode(this, VM, Property));
 }