Exemple #1
0
    public static void SortArrayArraySecondParamNull()
    {
        Array keys  = (Array)TestObjects.integerArray.Clone();
        Array items = null;

        Array.Sort(keys, items);
        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedIntegerArray, keys);
    }
Exemple #2
0
    public static void SortArrayArrayValidParams()
    {
        Array keys  = (Array)TestObjects.integerArray.Clone();
        Array items = (Array)TestObjects.stringArray.Clone();

        Array.Sort(keys, items);
        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedIntegerArray, keys);
        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedStringArray, items);
    }
    public static void SortArrayArrayWithCustomStructAndClass()
    {
        Array keys  = (Array)TestObjects.customValueTypeArray.Clone();
        Array items = (Array)TestObjects.customRefTypeArray.Clone();

        Array.Sort(keys, items);

        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedValueTypeArray, keys);
        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedRefTypeArray, items);
    }
    public static void SortArrayArrayWithCustomClassAndReverseComparer()
    {
        Array     keys     = (Array)TestObjects.customRefTypeArray.Clone();
        Array     items    = (Array)TestObjects.customRefTypeArray.Clone();
        IComparer comparer = new RefTypeReverseComparer();

        Array.Sort(keys, items, comparer);

        ArrayUtil.AssertAllArrayElementsAreEqual(ArrayUtil.ReverseArray(TestObjects.sortedRefTypeArray), keys);
        ArrayUtil.AssertAllArrayElementsAreEqual(ArrayUtil.ReverseArray(TestObjects.sortedRefTypeArray), items);
    }
Exemple #5
0
    public static void SortArrayArrayIntIntValidParams()
    {
        Array keys  = (Array)TestObjects.integerArray.Clone();
        Array items = (Array)TestObjects.stringArray.Clone();

        int index  = 0;
        int length = keys.Length;

        Array.Sort(keys, items, index, length);
        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedIntegerArray, keys);
        ArrayUtil.AssertAllArrayElementsAreEqual(TestObjects.sortedStringArray, items);
    }
Exemple #6
0
    public static void SortArrayArrayIntIntReverseComparerValidParams()
    {
        Array     keys     = (Array)TestObjects.integerArray.Clone();
        Array     items    = (Array)TestObjects.stringArray.Clone();
        IComparer comparer = new ReverseIntComparer();

        int index  = 0;
        int length = keys.Length;

        Array.Sort(keys, items, index, length, comparer);
        ArrayUtil.AssertAllArrayElementsAreEqual(ArrayUtil.ReverseArray(TestObjects.sortedIntegerArray), keys);
        ArrayUtil.AssertAllArrayElementsAreEqual(ArrayUtil.ReverseArray(TestObjects.sortedStringArray), items);
    }