public void Contains_IList() { var list = new SimpleObjectList("x", "y", "z"); CollectionAssert.Contains(list, "x"); }
public void DoesNotContain_Empty() { var list = new SimpleObjectList(); CollectionAssert.DoesNotContain(list, "x"); }
public void IsOrdered_ContainedTypesMustBeCompatible() { var list = new SimpleObjectList(1, "x"); Assert.Throws<ArgumentException>(() => CollectionAssert.IsOrdered(list)); }
public void IsOrdered_Handles_custom_comparison() { var list = new SimpleObjectList(new object(), new object()); CollectionAssert.IsOrdered(list, new AlwaysEqualComparer()); }
public void IsOrdered() { var list = new SimpleObjectList("x", "y", "z"); CollectionAssert.IsOrdered(list); }
public void IsOrdered_Allows_adjacent_equal_values() { var list = new SimpleObjectList("x", "x", "z"); CollectionAssert.IsOrdered(list); }
public void IsOrdered_Handles_custom_comparison2() { var list = new SimpleObjectList(2, 1); CollectionAssert.IsOrdered(list, new TestComparer()); }
public void IsNotSubsetOf_Fails() { var set1 = new SimpleObjectList("x", "y", "z"); var set2 = new SimpleObjectList("y", "z"); var expectedMessage = " Expected: not subset of < \"x\", \"y\", \"z\" >" + Environment.NewLine + " But was: < \"y\", \"z\" >" + Environment.NewLine; var ex = Assert.Throws<AssertionException>(() => CollectionAssert.IsNotSubsetOf(set2,set1)); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void IsOrdered_TypesMustImplementIComparable() { var list = new SimpleObjectList(new object(), new object()); Assert.Throws <ArgumentException>(() => CollectionAssert.IsOrdered(list)); }
public void IsOrdered_ContainedTypesMustBeCompatible() { var list = new SimpleObjectList(1, "x"); Assert.Throws <ArgumentException>(() => CollectionAssert.IsOrdered(list)); }
public void IsSubsetOfHandlesNull() { var set1 = new SimpleObjectList("x", null, "z"); var set2 = new SimpleObjectList(null, "z"); CollectionAssert.IsSubsetOf(set2,set1); Assert.That(set2, Is.SubsetOf(set1)); }
public void AreEqualFailCount() { var set1 = new SimpleObjectList("x", "y", "z"); var set2 = new SimpleObjectList("x", "y", "z", "a"); var expectedMessage = " Expected is <NUnit.TestUtilities.Collections.SimpleObjectList> with 3 elements, actual is <NUnit.TestUtilities.Collections.SimpleObjectList> with 4 elements" + Environment.NewLine + " Values differ at index [3]" + Environment.NewLine + " Extra: < \"a\" >"; var ex = Assert.Throws<AssertionException>(() => CollectionAssert.AreEqual(set1, set2, new TestComparer())); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void IsNotSubsetOf() { var set1 = new SimpleObjectList("x", "y", "z"); var set2 = new SimpleObjectList("y", "z", "a"); CollectionAssert.IsNotSubsetOf(set1,set2); Assert.That(set1, Is.Not.SubsetOf(set2)); }
public void AreEqualFail() { var set1 = new SimpleObjectList("x", "y", "z"); var set2 = new SimpleObjectList("x", "y", "a"); var expectedMessage = " Expected and actual are both <NUnit.TestUtilities.Collections.SimpleObjectList> with 3 elements" + Environment.NewLine + " Values differ at index [2]" + Environment.NewLine + " String lengths are both 1. Strings differ at index 0." + Environment.NewLine + " Expected: \"z\"" + Environment.NewLine + " But was: \"a\"" + Environment.NewLine + " -----------^" + Environment.NewLine; var ex = Assert.Throws<AssertionException>(() => CollectionAssert.AreEqual(set1,set2,new TestComparer())); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void IsNotSubsetOfHandlesNull() { var set1 = new SimpleObjectList("x", null, "z"); var set2 = new SimpleObjectList(null, "z", "a"); CollectionAssert.IsNotSubsetOf(set1,set2); }
public void IsOrdered_Fails() { var list = new SimpleObjectList("x", "z", "y"); var expectedMessage = " Expected: collection ordered" + Environment.NewLine + " But was: < \"x\", \"z\", \"y\" >" + Environment.NewLine; var ex = Assert.Throws<AssertionException>(() => CollectionAssert.IsOrdered(list)); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void ContainsFails_EmptyIList() { var list = new SimpleObjectList(); var expectedMessage = " Expected: collection containing \"x\"" + Environment.NewLine + " But was: <empty>" + Environment.NewLine; var ex = Assert.Throws<AssertionException>(() => CollectionAssert.Contains(list,"x")); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void IsOrdered_Handles_null() { var list = new SimpleObjectList("x", null, "z"); var ex = Assert.Throws<ArgumentNullException>(() => CollectionAssert.IsOrdered(list)); Assert.That(ex.Message, Does.Contain("index 1")); }
public void DoesNotContain_Empty() { var list = new SimpleObjectList(); CollectionAssert.DoesNotContain(list,"x"); }
public void IsOrdered_TypesMustImplementIComparable() { var list = new SimpleObjectList(new object(), new object()); Assert.Throws<ArgumentException>(() => CollectionAssert.IsOrdered(list)); }
public void DoesNotContain_Fails() { var list = new SimpleObjectList("x", "y", "z"); var expectedMessage = " Expected: not collection containing \"y\"" + Environment.NewLine + " But was: < \"x\", \"y\", \"z\" >" + Environment.NewLine; var ex = Assert.Throws<AssertionException>(() => CollectionAssert.DoesNotContain(list,"y")); Assert.That(ex.Message, Is.EqualTo(expectedMessage)); }
public void IsSubsetOf() { var set1 = new SimpleObjectList("x", "y", "z"); var set2 = new SimpleObjectList("y", "z"); CollectionAssert.IsSubsetOf(set2,set1); Assert.That(set2, Is.SubsetOf(set1)); }
private static SimpleObjectList<LibraryNode> SearchNodes(VSOBSEARCHCRITERIA2 srch, SimpleObjectList<LibraryNode> list, LibraryNode curNode) { foreach (var child in curNode.Children) { if (child.Name.IndexOf(srch.szName, StringComparison.OrdinalIgnoreCase) != -1) { list.Children.Add(child.Clone(child.Name)); } SearchNodes(srch, list, child); } return list; }
public void IsOrdered_Handles_null() { var list = new SimpleObjectList(null, "x", "z"); Assert.That(list, Is.Ordered); }