Exemple #1
0
        static List <Tshirt> FabricDesc()
        {
            List <Tshirt> shirts = PrepareSignature();
            //instatiate the delegate
            BubbleDelegate sortingDelegate = BubbleSortHardCoded.FabricDesc;

            //call the delegate
            sortingDelegate(shirts);

            return(shirts);
        }
Exemple #2
0
        // ******************** Delegated methods on 3 variations simultaneously ************************
        static List <Tshirt> SizeColorFablicAsc()
        {
            List <Tshirt> shirts = PrepareSignature();
            //instatiate the delegate
            BubbleDelegate sortingDelegate = BubbleSortHardCoded.SizeColorFablicAsc;

            //call the delegate
            sortingDelegate(shirts);

            return(shirts);
        }
Exemple #3
0
        //  ===================   Create methods for the delegate to use. =======================

        // Size-Color-Fablic Ascending
        public static void SizeColorFablicAsc(List <Tshirt> tshirts)
        {
            //instantiate the delegate
            BubbleDelegate sortingDelegate = BubbleSortHardCoded.FabricAsc;

            // Call the delegate.
            sortingDelegate(tshirts);

            //Repeat for the other 2 variations
            sortingDelegate = BubbleSortHardCoded.ColorAsc;
            sortingDelegate(tshirts);
            sortingDelegate = BubbleSortHardCoded.SizeAsc;
            sortingDelegate(tshirts);
        }
        public void IComparerSort_SumAscending()
        {
            int[][] expected = new int[][]
            {
                new int[] { 7, 8, 12 },
                new int[] { 3, 9, 16 },
                new int[] { 5, 10, 14 },
                new int[] { 1, 11, 18 },
            };

            BubbleDelegate.IComparerSort(toSort, new SumArrayValue(), BubbleDelegate.Order.Ascending);

            for (int i = 0; i < toSort.Length; i++)
            {
                CollectionAssert.AreEqual(expected[i], toSort[i]);
            }
        }