示例#1
0
        public void GivenAnEmptyArray_Reverse_ReturnsAnEmptyArray()
        {
            int[] array  = { };
            var   result = CollectionsExercisesClass.Reverse(array);

            Assert.AreEqual(0, array.Length);
        }
示例#2
0
        public void NextInQueue_DoesNotThrowException_IfTheQueueIsTooShort()
        {
            var result = CollectionsExercisesClass.NextInQueue(7, _queue);

            Assert.AreEqual(0, _queue.Count);
            Assert.AreEqual("Cathy, Jim, Petra, Moxie, Petunia", result);
        }
示例#3
0
        public void GivenAnArray_Reverse_ReturnsTheArrayInReverse()
        {
            int[] array  = { 10, 20, 30, 40, 50 };
            var   result = CollectionsExercisesClass.Reverse(array);

            Assert.AreEqual(5, array.Length);
            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual(array[4 - i], result[i]);
            }
        }
示例#4
0
        public void GivenANumber_NextInQueue_RemoveExpectedNumberFromTheQueue(int num, int expectedQueueCount)
        {
            var result = CollectionsExercisesClass.NextInQueue(num, _queue);

            Assert.AreEqual(expectedQueueCount, _queue.Count);
        }
示例#5
0
        public void GivenANumber_NextInQueue_ReturnsCorrectNames(int num, string expectedNames)
        {
            var result = CollectionsExercisesClass.NextInQueue(num, _queue);

            Assert.AreEqual(expectedNames, result);
        }
示例#6
0
        public void GivenAString_CountDigits_ReturnsACountOfEachDigit(string input, string expectedOutput)
        {
            var result = CollectionsExercisesClass.CountDigits(input);

            Assert.AreEqual(expectedOutput, result);
        }