Пример #1
0
        public void Contains_IList()
        {
            var list = new SimpleObjectList("x", "y", "z");

            CollectionAssert.Contains(list, "x");
        }
Пример #2
0
        public void DoesNotContain_Empty()
        {
            var list = new SimpleObjectList();

            CollectionAssert.DoesNotContain(list, "x");
        }
Пример #3
0
 public void IsOrdered_ContainedTypesMustBeCompatible()
 {
     var list = new SimpleObjectList(1, "x");
     Assert.Throws<ArgumentException>(() => CollectionAssert.IsOrdered(list));
 }
Пример #4
0
 public void IsOrdered_Handles_custom_comparison()
 {
     var list = new SimpleObjectList(new object(), new object());
     CollectionAssert.IsOrdered(list, new AlwaysEqualComparer());
 }
Пример #5
0
 public void IsOrdered()
 {
     var list = new SimpleObjectList("x", "y", "z");
     CollectionAssert.IsOrdered(list);
 }
Пример #6
0
 public void IsOrdered_Allows_adjacent_equal_values()
 {
     var list = new SimpleObjectList("x", "x", "z");
     CollectionAssert.IsOrdered(list);
 }
Пример #7
0
        public void IsOrdered_Handles_custom_comparison2()
        {
            var list = new SimpleObjectList(2, 1);

            CollectionAssert.IsOrdered(list, new TestComparer());
        }
Пример #8
0
        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));
        }
Пример #9
0
        public void IsOrdered_TypesMustImplementIComparable()
        {
            var list = new SimpleObjectList(new object(), new object());

            Assert.Throws <ArgumentException>(() => CollectionAssert.IsOrdered(list));
        }
Пример #10
0
        public void IsOrdered_Handles_custom_comparison()
        {
            var list = new SimpleObjectList(new object(), new object());

            CollectionAssert.IsOrdered(list, new AlwaysEqualComparer());
        }
Пример #11
0
        public void IsOrdered_ContainedTypesMustBeCompatible()
        {
            var list = new SimpleObjectList(1, "x");

            Assert.Throws <ArgumentException>(() => CollectionAssert.IsOrdered(list));
        }
Пример #12
0
        public void IsOrdered_Allows_adjacent_equal_values()
        {
            var list = new SimpleObjectList("x", "x", "z");

            CollectionAssert.IsOrdered(list);
        }
Пример #13
0
        public void IsOrdered()
        {
            var list = new SimpleObjectList("x", "y", "z");

            CollectionAssert.IsOrdered(list);
        }
Пример #14
0
        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));
        }
Пример #15
0
        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));
        }
Пример #16
0
        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));
        }
Пример #17
0
        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));
        }
Пример #18
0
        public void IsNotSubsetOfHandlesNull()
        {
            var set1 = new SimpleObjectList("x", null, "z");
            var set2 = new SimpleObjectList(null, "z", "a");

            CollectionAssert.IsNotSubsetOf(set1,set2);
        }
Пример #19
0
 public void Contains_IList()
 {
     var list = new SimpleObjectList("x", "y", "z");
     CollectionAssert.Contains(list, "x");
 }
Пример #20
0
        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));
        }
Пример #21
0
        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));
        }
Пример #22
0
        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"));
        }
Пример #23
0
 public void DoesNotContain_Empty()
 {
     var list = new SimpleObjectList();
     CollectionAssert.DoesNotContain(list,"x");
 }
Пример #24
0
 public void IsOrdered_TypesMustImplementIComparable()
 {
     var list = new SimpleObjectList(new object(), new object());
     Assert.Throws<ArgumentException>(() => CollectionAssert.IsOrdered(list));
 }
Пример #25
0
        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));
        }
Пример #26
0
 public void IsOrdered_Handles_custom_comparison2()
 {
     var list = new SimpleObjectList(2, 1);
     CollectionAssert.IsOrdered(list, new TestComparer());
 }
Пример #27
0
        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));
        }
Пример #28
0
        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;
        }
Пример #29
0
        public void IsOrdered_Handles_null()
        {
            var list = new SimpleObjectList(null, "x", "z");

            Assert.That(list, Is.Ordered);
        }