コード例 #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}>.");
            }
        }
コード例 #2
0
ファイル: CompareTests.cs プロジェクト: stan-osipov/testify
        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}>.");
            }
        }
コード例 #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}>.");
            }
        }