public void HashCalculateTest() { var objOne = new TestObj1(); var hashBefore = objOne.CreateHash(); objOne.BoolValue = true; var hashAfter = objOne.CreateHash(); Assert.IsFalse(hashBefore.SequenceEqual(hashAfter), "The hash value before and after a change on the object should be different."); }
public void CopyDifferentTypeTest() { var objOne = new TestObj1(); var objTwo = new TestObj2(); byte[] objOneHash; byte[] objTwoHash; objOne.BoolNullableValue = false; objOne.BoolValue = true; objOne.CountEnumNullableValue = CountEnum.three; objOne.CountEnumValue = CountEnum.two; objOne.IntNullableValue = null; objOne.IntValue = 42; objOne.StringValue = "Values from objOne."; objOneHash = objOne.CreateHash(); objOne.CopyTo(objTwo); objTwoHash = objTwo.CreateHash(); var result = objOne.IsEqualTo(objTwo); Assert.IsFalse(objOneHash.SequenceEqual(objTwoHash), "Since both objects are of different types the hash values should not be equal."); Assert.IsTrue(result, "Both objects should be considered equal after the copy operation when calling 'objOne.IsEqualTo(objTwo)'."); }