예제 #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));
 }