예제 #1
0
 public void AddInvalidObjectTest()
 {
     Assert.That(() =>
     {
         _list.Add(new InvalidClass());
     }, Throws.ArgumentException);
 }
예제 #2
0
        public void TestToString()
        {
            // Arrage
            ListClass <string> list = new ListClass <string>();

            // Act
            list.Add("Hello");
            list.Add("World");
            // Assert
            Assert.AreEqual("HelloWorld", list.ToString());
        }
예제 #3
0
        public void AddOnTest()
        {
            // Arrange
            ListClass <int> list = new ListClass <int>();
            int             one  = 1;

            // Act
            list.Add(one);
            int two = list.listArray[0];

            // Assert
            Assert.AreEqual(one, two);
        }
예제 #4
0
        public void Add_FiveValues_ReturnsValueAtIndex()
        {
            // Arrage
            ListClass <int> list = new ListClass <int>()
            {
                0, 1, 2, 3
            };
            int input = 7;

            // Act
            list.Add(input);
            //Assert
            Assert.AreEqual(7, list.listArray[4]);
        }
예제 #5
0
        public void AddLength()
        {
            // Arrage
            ListClass <int> list = new ListClass <int>()
            {
                0, 1, 2, 3
            };
            int input = 4;

            // Act
            list.Add(input);
            //Assert
            Assert.AreEqual(5, list.Counts);
        }
예제 #6
0
        public void AddOnTwoTest()
        {
            // Arrange
            ListClass <int> list = new ListClass <int>()
            {
                0, 2, 3
            };
            int one = 1;

            // Act
            list.Add(one);
            // Assert
            Assert.AreEqual(list.listArray[3], one);
        }