예제 #1
0
        public void Add_Ints_IncreaseCount()
        {
            // Arrange
            ListProperties <int> list = new ListProperties <int>();

            // Act
            list.Add(1);
            list.Add(2);
            list.Add(3);
            int result = 3;

            // Assert
            Assert.AreEqual(result, list.Count);
        }
예제 #2
0
        public void Remove_SingleObject_CountGoesDown()
        {
            // Arrange
            ListProperties <object> list = new ListProperties <object>();

            list.Add(list);
            list.Add(list);
            // Act
            int expected = 1;

            list.Remove(list);
            // Assert
            Assert.AreEqual(expected, list.Count);
        }
예제 #3
0
        public void Remove_Object_ResultEqualsTrue()
        {
            // Arrange
            ListProperties <object> list = new ListProperties <object>();

            list.Add(list);
            list.Add(list);
            // Act
            bool expected = true;
            bool remove   = list.Remove(list);

            // Assert
            Assert.AreEqual(expected, remove);
        }
예제 #4
0
        public void Remove_Objects_ThrowException()
        {
            // Arrange
            ListProperties <object> list = new ListProperties <object>();
            object notExpected           = list;

            // Act
            list.Add(list);
            list.Add(list);
            list.Add(list);
            list.Remove(list);
            list.Remove(list);
            list.Remove(list);
            // Assert
            Assert.AreNotEqual(notExpected, list[0]);
        }
예제 #5
0
        public void Remove_SingleInt_CountGoesDown()
        {
            // Arrange
            ListProperties <int> list = new ListProperties <int>();

            list.Add(1);
            list.Add(1);
            list.Add(1);
            list.Add(1);
            // Act
            int notExpected = list.Count;

            list.Remove(1);
            // Assert
            Assert.AreNotEqual(notExpected, list.Count);
        }
예제 #6
0
        public void Add_MultiInts_ImprovedArray()
        {
            // Arrange
            ListProperties <int> list     = new ListProperties <int>();
            ListProperties <int> expected = new ListProperties <int>()
            {
                1, 2, 3
            };

            // Act

            list.Add(1);
            list.Add(2);
            list.Add(3);
            Assert.AreEqual(list[0], expected[0]);
        }
예제 #7
0
        public void Add_MultiStrings_ImprovedArray()
        {
            // Arrange
            ListProperties <string> list     = new ListProperties <string>();
            ListProperties <string> expected = new ListProperties <string>()
            {
                "One", "Two", "Three"
            };

            // Act
            list.Add("One");
            list.Add("Two");
            list.Add("Three");

            // Assert
            Assert.AreEqual(expected[0], list[0]);
        }
예제 #8
0
        public void Add_SingleInt_ArrayLoads()
        {
            // Arrange
            ListProperties <int> list = new ListProperties <int>();

            // Act
            list.Add(1);
            int expected = 1;

            // Assert
            Assert.AreEqual(expected, list[0]);
        }
예제 #9
0
        public void ZipListProperties_ListPropertiesobject_ListPropertiesZipped()
        {
            //Arrange
            ListProperties <Objects> objectsA     = new ListProperties <Objects>();
            ListProperties <Objects> objectsB     = new ListProperties <Objects>();
            ListProperties <Objects> actualResult = new ListProperties <Objects>();
            Objects ObjectA = new Objects();
            Objects ObjectB = new Objects();

            objectsA.Add(ObjectA);
            objectsB.Add(ObjectB);
            ListProperties <Objects> expectedResult = new ListProperties <Objects>();

            expectedResult.Add(ObjectA);
            expectedResult.Add(ObjectB);

            //Act
            actualResult = objectsA.Zip(objectsB);

            //Assert
            Assert.AreEqual(expectedResult.ToString(), actualResult.ToString());
        }
예제 #10
0
        public void ZipListProperties_ListPropertiesint_ListPropertiesZipped()
        {
            //Arrange
            ListProperties <int> expectedResult = new ListProperties <int>()
            {
                1, 2, 3, 4
            };
            ListProperties <int> numbers      = new ListProperties <int>();
            ListProperties <int> moreNumbers  = new ListProperties <int>();
            ListProperties <int> actualResult = new ListProperties <int>();

            numbers.Add(1);
            numbers.Add(3);
            moreNumbers.Add(2);
            moreNumbers.Add(4);

            //Act
            actualResult = numbers.Zip(moreNumbers);

            //Assert
            Assert.AreEqual(expectedResult.ToString(), actualResult.ToString());
        }
예제 #11
0
        public void Remove_EveryInts_ThrowException()
        {
            // Arrange
            ListProperties <int> list = new ListProperties <int>();

            list.Add(1);
            int notExpected = 1;

            // Act
            list.Remove(1);
            // Assert
            Assert.AreNotEqual(notExpected, list[0]);
        }
예제 #12
0
        public void Add_SingleInt_IncreaseCount()
        {
            // Arrange
            ListProperties <int> list     = new ListProperties <int>();
            ListProperties <int> expected = new ListProperties <int>()
            {
                1
            };

            // Act
            list.Add(1);
            // Assert
            Assert.AreEqual(expected.Count, list.Count);
        }
예제 #13
0
        public void Add_Objects_ImproveArray()
        {
            // Arrange
            ListProperties <object> list     = new ListProperties <object>();
            ListProperties <object> expected = new ListProperties <object>()
            {
                1
            };

            // Act
            list.Add(1);
            int[] result = new int[] { 1 };
            // Assert
            Assert.AreEqual(expected.Count, list.Count);
        }
예제 #14
0
        public void ZipListProperties_ListPropertiesString_ListPropertiesZipped()
        {
            //Arrange
            ListProperties <string> expectedResult = new ListProperties <string>();

            expectedResult.Add("A");
            expectedResult.Add("B");
            expectedResult.Add("C");
            expectedResult.Add("D");
            ListProperties <string> stringsA     = new ListProperties <string>();
            ListProperties <string> stringsB     = new ListProperties <string>();
            ListProperties <string> actualResult = new ListProperties <string>();

            stringsA.Add("A");
            stringsA.Add("C");
            stringsB.Add("B");
            stringsB.Add("D");

            //Act
            actualResult = stringsA.Zip(stringsB);

            //Assert
            Assert.AreEqual(expectedResult.ToString(), actualResult.ToString());
        }
예제 #15
0
        public void Minus_Objects_CountDecreases()
        {
            // Arrange
            ListProperties <object> list = new ListProperties <object>()
            {
            };

            list.Add(list);
            // Act
            int expected = 0;

            list = list - list;
            // Assert
            Assert.AreEqual(expected, list.Count);
        }
예제 #16
0
        public void Add_MultiObjects_SizeExpands()
        {
            // Arrange
            ListProperties <object> list = new ListProperties <object>();
            // Act
            object obj = new object();

            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            list.Add(obj);
            int expected = 19;

            // Assert
            Assert.AreEqual(expected, list.Count);
        }