public void HashSetOfWithCollisionsWhenNotEqual(ReferenceHandling referenceHandling) { var e1 = new HashCollisionType(); var x = new HashSet <HashCollisionType> { e1, new HashCollisionType { Value = 1 } }; var y = new HashSet <HashCollisionType> { e1, new HashCollisionType { Value = 2 } }; var expected = "HashSet<HashCollisionType> [Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType] x: Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType y: missing item [Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType] x: missing item y: Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType"; var result = this.DiffMethod(x, y, referenceHandling); Assert.AreEqual(false, result.IsEmpty); var actual = result.ToString(string.Empty, " "); StringAssert.AreEqualIgnoringCase(expected, actual); result = this.DiffMethod(y, x, referenceHandling); Assert.AreEqual(false, result.IsEmpty); actual = result.ToString(string.Empty, " "); StringAssert.AreEqualIgnoringCase(expected, actual); }
public void WithCollisionsWhenEqual(ReferenceHandling referenceHandling) { var e1 = new HashCollisionType(); var e2 = new HashCollisionType(); var x = new HashSet <HashCollisionType> { e1, e2 }; var y = new HashSet <HashCollisionType> { e2, e1 }; var result = this.EqualByMethod(x, y, referenceHandling); Assert.AreEqual(true, result); result = this.EqualByMethod(y, x, referenceHandling); Assert.AreEqual(true, result); }
public void HashSetOfWithCollisionsWhenEqual(ReferenceHandling referenceHandling) { var e1 = new HashCollisionType(); var e2 = new HashCollisionType(); var x = new HashSet <HashCollisionType> { e1, e2 }; var y = new HashSet <HashCollisionType> { e2, e1 }; var result = this.DiffMethod(x, y, referenceHandling); Assert.AreEqual(true, result.IsEmpty); Assert.AreEqual("Empty", result.ToString()); result = this.DiffMethod(y, x, referenceHandling); Assert.AreEqual(true, result.IsEmpty); Assert.AreEqual("Empty", result.ToString()); }
public void WithCollisionsWhenNotEqual(ReferenceHandling referenceHandling) { var e1 = new HashCollisionType(); var x = new HashSet <HashCollisionType> { e1, new HashCollisionType { Value = 1 } }; var y = new HashSet <HashCollisionType> { e1, new HashCollisionType { Value = 2 } }; var result = this.EqualByMethod(x, y, referenceHandling); Assert.AreEqual(false, result); result = this.EqualByMethod(y, x, referenceHandling); Assert.AreEqual(false, result); }
public void WithCollisionsWhenEqual() { var k1 = new HashCollisionType(); var k2 = new HashCollisionType(); var x = new Dictionary <HashCollisionType, string> { { k1, "1" }, { k2, "2" } }; var y = new Dictionary <HashCollisionType, string> { { k1, "1" }, { k2, "2" } }; Assert.AreEqual(2, x.Count); var result = this.EqualByMethod(x, y, ReferenceHandling.Structural); Assert.AreEqual(true, result); y = new Dictionary <HashCollisionType, string> { { k2, "2" }, { k1, "1" } }; result = this.EqualByMethod(x, y, ReferenceHandling.Structural); Assert.AreEqual(true, result); }
public void HashSetOfWithCollisionsWhenNotEqualReference() { var e1 = new HashCollisionType(); var x = new HashSet <HashCollisionType> { e1, new HashCollisionType() }; var y = new HashSet <HashCollisionType> { e1, new HashCollisionType() }; var expected = "HashSet<HashCollisionType> [Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType] x: Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType y: missing item [Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType] x: missing item y: Gu.State.Tests.DiffTests.DiffTypes+HashCollisionType"; var result = this.DiffMethod(x, y, ReferenceHandling.References); Assert.AreEqual(false, result.IsEmpty); var actual = result.ToString("", " "); Assert.AreEqual(expected, actual); result = this.DiffMethod(y, x, ReferenceHandling.References); Assert.AreEqual(false, result.IsEmpty); actual = result.ToString("", " "); Assert.AreEqual(expected, actual); }