Exemplo n.º 1
0
        private void VerifyCompareToOtherWithLesserItems()
        {
            var equalItems   = Items.ToArray();
            var greaterItems = ShiftedItems.ToArray();

            SwapLast(equalItems, greaterItems);
            var failure = CompareItems(greaterItems, equalItems, (x, y) => x.CompareTo(y) > 0);

            if (failure != null)
            {
                Fail($"IComparable<T>.CompareTo  failed with values expected to be lesser at index {failure.Value.Index}. Expected: <{failure.Value.Right}>. Actual: <{failure.Value.Left}>.");
            }
        }
Exemplo n.º 2
0
        private void VerifyCompareToObjWithGreaterItems()
        {
            var equalItems   = Items.ToArray();
            var greaterItems = ShiftedItems.ToArray();

            SwapLast(equalItems, greaterItems);
            var failure = CompareItems(equalItems, greaterItems, (x, y) => ((IComparable)x).CompareTo(y) < 0);

            if (failure != null)
            {
                Fail($"IComparable.CompareTo failed with values expected to be greater at index {failure.Value.Index}. "
                     + $"Expected: <{failure.Value.Right}>. Actual: <{failure.Value.Left}>.");
            }
        }
Exemplo n.º 3
0
        private void VerifyOpLessThanWithLesserItems()
        {
            if (OpLessThanFunc == null)
            {
                return;
            }

            var equalItems   = Items.ToArray();
            var greaterItems = ShiftedItems.ToArray();

            SwapLast(equalItems, greaterItems);
            var failure = CompareItems(greaterItems, equalItems, (x, y) => !OpLessThanFunc(x, y));

            if (failure != null)
            {
                Fail($"op_LessThan failed with values expected to be greater at index {failure.Value.Index}. Expected: <{failure.Value.Right}>. Actual: <{failure.Value.Left}>.");
            }
        }