예제 #1
0
        public void Add_OneInserted_NextIsTwo()
        {
            var numToBeInserted = 1;
            var next            = 2;

            _mostlyFullSequence.Insert(numToBeInserted);

            _mostlyFullSequence.Add().Should().Be(next);
        }
예제 #2
0
        public void Add100_RandomDelete20()
        {
            var random = new Random();

            for (var i = 0; i < 100; i++)
            {
                _mostlyFullSequence.Add();
            }

            var listOfDeletedNums = new List <int>();

            listOfDeletedNums.Add(0);
            for (var i = 0; i < 10; i++)
            {
                var randomNumberToDelete = 0;
                while (listOfDeletedNums.Contains(randomNumberToDelete))
                {
                    randomNumberToDelete = random.Next(0, 100 - i);
                }
                listOfDeletedNums.Add(randomNumberToDelete);

                _mostlyFullSequence.DeleteAt(randomNumberToDelete);
            }

            listOfDeletedNums.Sort();

            foreach (var i in listOfDeletedNums)
            {
                Console.Write($"{i} ");
            }
            Console.WriteLine();
            Console.WriteLine();
            var internalList = _mostlyFullSequence.GetInternaList();

            for (var i = 0; i < internalList.Count; i++)
            {
                if (i % 2 == 0)
                {
                    Console.Write($"{internalList[i]}-");
                }
                else
                {
                    Console.Write($"{internalList[i]} ");
                }
            }
        }