Ejemplo n.º 1
0
        public void Test_CombineSort()
        {
            int[]             arrayA      = { 1, 2 };
            int[]             arrayB      = { 3, 4 };
            CombineSort <int> combineSort = new CombineSort <int>();

            int[] array = combineSort.GetResult(arrayA, arrayB);
            for (int i = 1; i < 5; i++)
            {
                Assert.AreEqual(array[i - 1], i);
            }

            arrayA      = new[] { 1, 3 };
            arrayB      = new[] { 2, 4 };
            combineSort = new CombineSort <int>();
            array       = combineSort.GetResult(arrayA, arrayB);
            for (int i = 1; i < 5; i++)
            {
                Assert.AreEqual(array[i - 1], i);
            }

            arrayB      = new[] { 2, 4 };
            combineSort = new CombineSort <int>();
            array       = combineSort.GetResult(null, arrayB);
            Assert.AreEqual(arrayB, array);

            arrayA      = new[] { 2, 4 };
            combineSort = new CombineSort <int>();
            array       = combineSort.GetResult(arrayA, null);
            Assert.AreEqual(arrayA, array);

            combineSort = new CombineSort <int>();
            array       = combineSort.GetResult(null, null);
            Assert.AreEqual(null, array);
        }