Пример #1
0
 public void TestContains()
 {
     ArrayList4Asserter.AssertContains(
         ArrayList4Asserter.CreateArrayList(10),
         -1,
         ArrayList4Asserter.ValueForIndex(10) + 1);
 }
Пример #2
0
 private static IEnumerable <int> GetEnumerable(int start, int end)
 {
     for (int i = start; i < end; i++)
     {
         yield return(ArrayList4Asserter.ValueForIndex(i));
     }
 }
Пример #3
0
 public void TestFailEnumerator()
 {
     ArrayList4Asserter.AssertFailEnumerator <int>(
         ArrayList4Asserter.CreateArrayListAndAssertValues(10),
         GetEnumerable(0, 10),
         6,
         20);
 }
Пример #4
0
 public void TestContains()
 {
     ArrayList4Asserter.AssertContains(
         RetrieveOnlyInstance <string>(),
         "there's no such thing as free lunch!",
         "0.1",
         " 10");
 }
Пример #5
0
 public void TestRemoveAt()
 {
     ArrayList4Asserter.AssertRemoveAt(
         ArrayList4Asserter.CreateArrayListAndAssertValues(10),
         new IndexOfItems <int, Type>(-1, typeof(ArgumentOutOfRangeException)),
         new IndexOfItems <int, Type>(10, typeof(ArgumentOutOfRangeException)),
         new IndexOfItems <int, Type>(50, typeof(ArgumentOutOfRangeException)),
         new IndexOfItems <int, Type>(5, typeof(int)));
 }
Пример #6
0
 public void TestIndexOf()
 {
     ArrayList4Asserter.AssertIndexOf(
         ArrayList4Asserter.CreateArrayListAndAssertValues(10),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(0), 0),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(10), -1),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(-8), -1),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(5), 5));
 }
Пример #7
0
 public void TestIndexOf()
 {
     ArrayList4Asserter.AssertIndexOf(
         RetrieveOnlyInstance <string>(),
         new IndexOfItems <string, int>("10", 10),
         new IndexOfItems <string, int>("911", -1),
         new IndexOfItems <string, int>("0", 0),
         new IndexOfItems <string, int>("49", 49),
         new IndexOfItems <string, int>("50", -1));
 }
Пример #8
0
 public void TestBinarySearch()
 {
     ArrayList4Asserter.AssertBinarySearch(
         (ArrayList4 <int>)ArrayList4Asserter.CreateArrayListAndAssertValues(100),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(0), 0),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(99), 99),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(50), 50),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(100), -1),
         new IndexOfItems <int, int>(ArrayList4Asserter.ValueForIndex(-1), -1));
 }
Пример #9
0
        public void TestRemoveAt()
        {
            IList <string> list = RetrieveOnlyInstance <string>();

            ArrayList4Asserter.AssertRemoveAt(
                list,
                new IndexOfItems <int, Type>(-1, typeof(ArgumentOutOfRangeException)),
                new IndexOfItems <int, Type>(list.Count, typeof(ArgumentOutOfRangeException)),
                new IndexOfItems <int, Type>(0, typeof(int)),
                new IndexOfItems <int, Type>(list.Count - 2, typeof(int)));
        }
Пример #10
0
        public void TestToString()
        {
            ArrayList4Asserter.AssertToString(
                ArrayList4Asserter.CreateArrayListAndAssertValues(10), "ArrayList4<Int32> (Count=10)");

            ArrayList4Asserter.AssertToString(
                new ArrayList4 <int>(0), "ArrayList4<Int32> (Count=0)");

            ArrayList4Asserter.AssertToString(
                new ArrayList4 <string>(0), "ArrayList4<String> (Count=0)");
        }
Пример #11
0
 public void TestRemove()
 {
     ArrayList4Asserter.AssertRemove(
         RetrieveOnlyInstance <string>(),
         new IndexOfItems <string, bool>("-1", false),
         new IndexOfItems <string, bool>(SIZE.ToString(), false),
         new IndexOfItems <string, bool>((SIZE - 1).ToString(), true),
         new IndexOfItems <string, bool>((SIZE - 1).ToString(), false),
         new IndexOfItems <string, bool>("20", true),
         new IndexOfItems <string, bool>("0", true),
         new IndexOfItems <string, bool>("1", true));
 }
Пример #12
0
        public void TestSort()
        {
            ArrayList4 <int> list = (ArrayList4 <int>)ArrayList4Asserter.CreateArrayListAndAssertValues(100);

            list.Sort(0, list.Count, new InverseComparer());

            Assert.IsGreaterOrEqual(1, list.Count);
            for (int i = 1; i < list.Count; i++)
            {
                if (list[i - 1] < list[i])
                {
                    Assert.Fail(String.Format("Indexes ({0}, {1}). Values ({2}, {3})", i, i - 1, list[i], list[i - 1]));
                }
            }
        }
Пример #13
0
        public void TestInsert()
        {
            ArrayList4Asserter.AssertInsert(
                new ArrayList4 <int>(0),
                new int[] { 1, 2, 3 },
                new IndexOfItems <int, int>(1, 0),
                new IndexOfItems <int, int>(2, 1),
                new IndexOfItems <int, int>(3, 2));

            ArrayList4Asserter.AssertInsert(
                new ArrayList4 <int>(new int[] { 3, 2, 1 }),
                new int[] { 3, 4, 2, 5, 1, 6 },
                new IndexOfItems <int, int>(4, 1),
                new IndexOfItems <int, int>(5, 3),
                new IndexOfItems <int, int>(6, 5));
        }
Пример #14
0
 public void TestCopyToInvalidIndex()
 {
     ArrayList4Asserter.AssertCopyToInvalidIndex(RetrieveOnlyInstance <string>());
 }
Пример #15
0
 public void TestCopyToWithInvalidSize()
 {
     ArrayList4Asserter.AssertCopyToWithInvalidSize(ArrayList4Asserter.CreateArrayList(10));
 }
Пример #16
0
 public void TestCopyTo()
 {
     ArrayList4Asserter.AssertCopyTo(ArrayList4Asserter.CreateArrayList(10));
 }
Пример #17
0
 public void TestCopyToWithNullTarget()
 {
     ArrayList4Asserter.AssertCopyToWithNullTarget(RetrieveOnlyInstance <string>());
 }
Пример #18
0
 public void TestUpperBound()
 {
     ArrayList4Asserter.AssertUpperBound();
 }
Пример #19
0
 public void TestAddDifferentTypes()
 {
     ArrayList4Asserter.TestAddDifferentTypes(RetrieveOnlyInstance <string>(), 20);
 }
Пример #20
0
 public void TestLowerBound()
 {
     ArrayList4Asserter.AssertLowerBound(ArrayList4Asserter.CreateArrayListAndAssertValues(10));
 }
Пример #21
0
 public void TestAddDifferentTypes()
 {
     ArrayList4Asserter.TestAddDifferentTypes(ArrayList4Asserter.CreateArrayListAndAssertValues(10), "No way my friend");
 }
Пример #22
0
 public void TestEnumerator()
 {
     ArrayList4Asserter.AssertEnumerable(
         RetrieveOnlyInstance <string>(),
         GetEnumerable(SIZE));
 }
Пример #23
0
 public void TestItems()
 {
     ArrayList4Asserter.AssertItems();
 }
Пример #24
0
 public void TestEnumerator()
 {
     ArrayList4Asserter.AssertEnumerable(
         ArrayList4Asserter.CreateArrayListAndAssertValues(10),
         GetEnumerable(0, 10));
 }
Пример #25
0
 public void TestLowerBound()
 {
     ArrayList4Asserter.AssertLowerBound(RetrieveOnlyInstance <string>());
 }
Пример #26
0
 public void TestAddItems()
 {
     ArrayList4Asserter.AssertAddItem();
 }
Пример #27
0
 public void TestIsReadOnly()
 {
     ArrayList4Asserter.AssertIsReadOnly();
 }
Пример #28
0
 public void TestClear()
 {
     ArrayList4Asserter.AssertClear();
 }
Пример #29
0
 public void TestCopyToMultiDimensionalArray()
 {
     ArrayList4Asserter.AssertCopyToWithMultiDimensionalArray(ArrayList4Asserter.CreateArrayList(10));
 }
Пример #30
0
 public void TestRemove()
 {
     ArrayList4Asserter.AssertRemove <int>(ArrayList4Asserter.CreateArrayListAndAssertValues(10));
 }