예제 #1
0
        public void TestMethod4()
        {
            var list = new UnidirectionalList();

            list.AddToEnd(new Organization("Организация1", "Город1", 103));
            list.AddToEnd(new Organization("Организация2", "Город2", 503));
            list.AddToStart(new Organization("Организация3", "Город3", 303));

            var expectedList = new UnidirectionalList();

            list.DeleteList();

            Assert.AreEqual(expectedList.Count, list.Count);
        }
예제 #2
0
        public void TestMethod5()
        {
            var list = new UnidirectionalList();

            list.AddToEnd(new Organization("Организация1", "Город1", 103));
            list.AddToEnd(new Organization("Организация2", "Город2", 503));
            list.AddToStart(new Organization("Организация3", "Город3", 303));

            var expectedList = new UnidirectionalList();

            expectedList.AddToEnd(new Organization("Организация1", "Город1", 103));
            expectedList.AddToEnd(new Organization("Организация2", "Город2", 503));
            expectedList.AddToStart(new Organization("Организация3", "Город3", 303));

            list.RemoveAt(1);
            list.RunTask();

            expectedList.RemoveAt(1);
            Organization actual   = null;
            Organization expected = null;
            int          i        = 0;

            foreach (Organization org1 in list)
            {
                if (i == 1)
                {
                    actual = org1;
                }
                i++;
            }


            i = 0;
            foreach (Organization org2 in expectedList)
            {
                if (i == 1)
                {
                    expected = org2;
                }
                i++;
            }


            Assert.AreEqual(expected, actual);
        }