public void AreEquivalentHandlesNull() { ICollection set1 = new ICollectionAdapter(null, "x", null, "z"); ICollection set2 = new ICollectionAdapter("z", null, "x", null); Ensure.AreEquivalent(set1, set2); }
public void Equivalent() { ICollection set1 = new ICollectionAdapter("x", "y", "z"); ICollection set2 = new ICollectionAdapter("z", "y", "x"); Ensure.AreEquivalent(set1, set2); }
public void CollectionEquivalenceTests() { int[] ints1to5 = new int[] { 1, 2, 3, 4, 5 }; int[] twothrees = new int[] { 1, 2, 3, 3, 4, 5 }; int[] twofours = new int[] { 1, 2, 3, 4, 4, 5 }; // Classic syntax Ensure.AreEquivalent(new int[] { 2, 1, 4, 3, 5 }, ints1to5); Ensure.AreNotEquivalent(new int[] { 2, 2, 4, 3, 5 }, ints1to5); Ensure.AreNotEquivalent(new int[] { 2, 4, 3, 5 }, ints1to5); Ensure.AreNotEquivalent(new int[] { 2, 2, 1, 1, 4, 3, 5 }, ints1to5); Ensure.AreNotEquivalent(twothrees, twofours); // Helper syntax Ensure.That(new int[] { 2, 1, 4, 3, 5 }, Is.EquivalentTo(ints1to5)); Ensure.That(new int[] { 2, 2, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5)); Ensure.That(new int[] { 2, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5)); Ensure.That(new int[] { 2, 2, 1, 1, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5)); // Inherited syntax EnsuranceHelper.Expect(new int[] { 2, 1, 4, 3, 5 }, EquivalentTo(ints1to5)); EnsuranceHelper.Expect(new int[] { 2, 2, 4, 3, 5 }, Not.EquivalentTo(ints1to5)); EnsuranceHelper.Expect(new int[] { 2, 4, 3, 5 }, Not.EquivalentTo(ints1to5)); EnsuranceHelper.Expect(new int[] { 2, 2, 1, 1, 4, 3, 5 }, Not.EquivalentTo(ints1to5)); }
public void EquivalentFailTwo() { ICollection set1 = new ICollectionAdapter("x", "y", "x"); ICollection set2 = new ICollectionAdapter("x", "y", "z"); expectedMessage = " Expected: equivalent to < \"x\", \"y\", \"x\" >" + Environment.NewLine + " But was: < \"x\", \"y\", \"z\" >" + Environment.NewLine; Ensure.AreEquivalent(set1, set2); }