Пример #1
0
        public void ChangeValuesToString_CheckStringDesignation_LongListAlteredToString()
        {
            CustomListClass <int> myList = new CustomListClass <int>();
            int value  = 8;
            int value2 = 16;
            int value3 = 32;
            int value4 = 64;
            int value5 = 128;

            myList.Add(value);
            myList.Add(value2);
            myList.Add(value3);
            myList.Add(value4);
            myList.Add(value5);
            myList.ToString();
            Assert.AreEqual("8163264128", myList.ToString());
        }
Пример #2
0
        public void ToString_NoItemsInList_EmptyString()
        {
            // Arrange
            string expected = " ";

            CustomListClass <int> d = new CustomListClass <int>();

            // Act
            string actual = d.ToString();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void ToString_StringAddedToList_ConvertToOneString()
        {
            // arrange
            CustomListClass <string> customList = new CustomListClass <string>();
            string expected = "One,Two,Three,Four";
            string actual;

            // act
            customList.Add("One");
            customList.Add("Two");
            customList.Add("Three");
            customList.Add("Four");
            actual = customList.ToString();


            // assert
            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void ToString_IntAddedToList_ConvertToOneString()
        {
            // arrange
            CustomListClass <int> customList = new CustomListClass <int>();
            string expected = "1,2,3,4";
            string actual;

            // act
            customList.Add(1);
            customList.Add(2);
            customList.Add(3);
            customList.Add(4);
            actual = customList.ToString();


            // assert
            Assert.AreEqual(expected, actual);
        }
Пример #5
0
        public void ToString_DisplaySpace_StringDisplaysWithSpaces()
        {
            //act
            CustomListClass <int> customList1 = new CustomListClass <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            string stringList     = "";
            string expectedString = "1 2 3 4 5 6 7 8 9 10 ";

            //act
            stringList = customList1.ToString(" ");


            // assert

            Assert.AreEqual(expectedString, stringList);
        }
Пример #6
0
        public void ToString_CheckCount_CountEqualsSumofListsCount()
        {
            //act
            CustomListClass <int> customList1 = new CustomListClass <int>()
            {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            string stringList     = "";
            string expectedString = "12345678910";

            //act
            stringList = customList1.ToString();


            // assert

            Assert.AreEqual(expectedString, stringList);
        }
Пример #7
0
        public void ToString_MultipleItemsInList_OutputCSVString()
        {
            // Arrange
            int    itemsToAdd       = 10;
            string expected         = "{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }";
            CustomListClass <int> d = new CustomListClass <int>();

            for (int i = 0; i < itemsToAdd; i++)
            {
                d.Add(i);
            }

            // Act
            string actual = d.ToString();

            // Assert
            Assert.AreEqual(expected, actual);
        }
Пример #8
0
        public void ToString_StringAddedToList_WriteLineHasListNotArray()
        {
            // arrange
            CustomListClass <string> customList = new CustomListClass <string>();
            string expected = "One,Two,Three,Four,Five";
            string actual;

            // act
            customList.Add("One");
            customList.Add("Two");
            customList.Add("Three");
            customList.Add("Four");
            customList.Add("Five");
            actual = customList.ToString();


            // assert
            Assert.AreEqual(expected, actual);
        }