示例#1
0
        public void QueueListLengthsAreEqual_EqualLengths_ReturnsTrue()
        {
            ArrayCompare.ClearAlgorithmQueue();

            ArrayCompare.AddAlgorithmToQueue("Selection Sort", ArraySortingAlgorithms.SelectionSort);
            ArrayCompare.AddAlgorithmToQueue("Bubble Sort", ArraySortingAlgorithms.BubbleSort);

            Assert.IsTrue(ArrayCompare.QueueListLengthsAreEqual());
        }
示例#2
0
        public void GetAlgorithmIndex_ValidIndex_ReturnsRightIndexOne()
        {
            int expectedResult = 1;

            ArrayCompare.ClearAlgorithmQueue();

            ArrayCompare.AddAlgorithmToQueue("Selection Sort", ArraySortingAlgorithms.SelectionSort);
            ArrayCompare.AddAlgorithmToQueue("Bubble Sort", ArraySortingAlgorithms.BubbleSort);
            int result = ArrayCompare.GetAlgorithmIndex("Bubble Sort");

            Assert.AreEqual(expectedResult, result);
        }
示例#3
0
        public void AddAlgorithmToQueue_NewAlgorithm_DoesAddToQueue()
        {
            int expectedResult = 1;

            ArrayCompare.ClearAlgorithmQueue();

            ArrayCompare.AddAlgorithmToQueue("Bubble Sort", ArraySortingAlgorithms.BubbleSort);

            Assert.IsTrue(ArrayCompare.algorithmNames.Contains("Bubble Sort"));
            Assert.AreEqual(expectedResult, ArrayCompare.algorithmNames.Count);
            Assert.IsTrue(ArrayCompare.QueueListLengthsAreEqual());
        }
示例#4
0
        public void ClearAlgorithmQueue_ClearsQueue()
        {
            int expectedResult = 0;

            ArrayCompare.ClearAlgorithmQueue();

            ArrayCompare.AddAlgorithmToQueue("Selection Sort", ArraySortingAlgorithms.SelectionSort);
            ArrayCompare.AddAlgorithmToQueue("Bubble Sort", ArraySortingAlgorithms.BubbleSort);
            ArrayCompare.ClearAlgorithmQueue();

            Assert.AreEqual(expectedResult, ArrayCompare.algorithmNames.Count);
            Assert.IsTrue(ArrayCompare.QueueListLengthsAreEqual());
        }