예제 #1
0
 private void Initialiaze()
 {
     Test1 = new CCArray <int>();
     Test2 = new CCArray <string>();
     Test1.Add(1);
     Test1.Add(2);
     Test1.Add(3);
     Test2.Add("CodeCool");
     Test2.Add("Miskolc");
     Test2.Add("2017");
 }
예제 #2
0
 public void TestAddWithoutIndex()
 {
     Test1 = new CCArray <int>();
     Test2 = new CCArray <string>();
     Test1.Add(1);
     Assert.AreEqual(new int[] { 1 }, Test1.GetArray());
     Test1.Add(2);
     Assert.AreEqual(new int[] { 1, 2 }, Test1.GetArray());
     Test1.Add(3);
     Assert.AreEqual(new int[] { 1, 2, 3 }, Test1.GetArray());
     Test2.Add("CodeCool");
     Assert.AreEqual(new string[] { "CodeCool" }, Test2.GetArray());
     Test2.Add("Miskolc");
     Assert.AreEqual(new string[] { "CodeCool", "Miskolc" }, Test2.GetArray());
     Test2.Add("2017");
     Assert.AreEqual(new string[] { "CodeCool", "Miskolc", "2017" }, Test2.GetArray());
 }
예제 #3
0
 public void TestAddWithIndex()
 {
     Test1 = new CCArray <int>();
     Test2 = new CCArray <string>();
     Test1.Add(0, 0);
     Assert.AreEqual(new int[] { 0 }, Test1.GetArray());
     Test1.Add(1, 0);
     Assert.AreEqual(new int[] { 1, 0 }, Test1.GetArray());
     Test1.Add(2, 2);
     Assert.AreEqual(new int[] { 1, 0, 2 }, Test1.GetArray());
     Assert.Throws <IndexOutOfRangeException>(() => Test1.Add(3, 4));
     Test2.Add("CodeCool", 0);
     Assert.AreEqual(new string[] { "CodeCool" }, Test2.GetArray());
     Test2.Add("Miskolc", 0);
     Assert.AreEqual(new string[] { "Miskolc", "CodeCool" }, Test2.GetArray());
     Test2.Add("2017", 1);
     Assert.AreEqual(new string[] { "Miskolc", "2017", "CodeCool" }, Test2.GetArray());
     Assert.Throws <IndexOutOfRangeException>(() => Test2.Add("Coding", 4));
 }