Beispiel #1
0
        public void Test1()
        {
            var sort   = new BubbleSort <int>();
            var items  = new int[] { 1, 9, 4, 5 };
            var result = sort.Sort(items);

            Assert.AreEqual(result, new int[] { 1, 4, 5, 9 });
        }
Beispiel #2
0
        public void NormalSort()
        {
            //Arrange
            List <Node> list = new List <Node>
            {
                new Node(5),
                new Node(1)
            };
            BubbleSort b = new BubbleSort(list);

            //Act
            List <Node> result = b.Sort().ToList();

            //Assert
            Assert.AreEqual(1, result.ElementAt(0).Number);
            Assert.AreEqual(5, result.ElementAt(1).Number);
        }
Beispiel #3
0
        public void DataDrivenTest(int[] array, int[] sorted)
        {
            var actualSorted = BubbleSort.Sort(array, Comparer <int> .Default);

            Assert.Equal(sorted, actualSorted);
        }
Beispiel #4
0
        public void DataDrivenTest(Person[] array, Person[] sorted)
        {
            var actualSorted = BubbleSort.Sort(array, new PersonComparer());

            Assert.Equal(sorted, actualSorted);
        }