Ejemplo n.º 1
0
        public void ArgumentHelperTest()
        {
            var min  = new EmptyComparable(-1);
            var max  = new EmptyComparable(+1);
            var mint = new EmptyComparableT(-1);
            var maxt = new EmptyComparableT(+1);

            ArgumentHelper.EnsureNotNull(new(), string.Empty);
            ArgumentHelper.EnsureNotNull <EmptyClass>(new(), string.Empty);

            new object().EnsureNotNull(string.Empty);
            new EmptyClass().EnsureNotNull <EmptyClass>(string.Empty);

            ArgumentHelper.EnsureWithinClosedRange(new EmptyComparable(), new(), new(), string.Empty);
            ArgumentHelper.EnsureWithinClosedRange <EmptyComparableT>(new EmptyComparableT(), new(), new(), string.Empty);

            new EmptyComparable().EnsureWithinClosedRange(new(), new(), string.Empty);
            new EmptyComparableT().EnsureWithinClosedRange <EmptyComparableT>(new(), new(), string.Empty);

            ArgumentHelper.EnsureWithinOpenRange(new EmptyComparable(), min, max, string.Empty);
            ArgumentHelper.EnsureWithinOpenRange <EmptyComparableT>(new EmptyComparableT(), mint, maxt, string.Empty);

            new EmptyComparable().EnsureWithinOpenRange(min, max, string.Empty);
            new EmptyComparableT().EnsureWithinOpenRange <EmptyComparableT>(mint, maxt, string.Empty);

            ArgumentHelper.EnsureNotNullWithinClosedRange(new EmptyComparable(), new(), new(), string.Empty);
            ArgumentHelper.EnsureNotNullWithinClosedRange <EmptyComparableT>(new EmptyComparableT(), new(), new(), string.Empty);

            new EmptyComparable().EnsureNotNullWithinClosedRange(new(), new(), string.Empty);
            new EmptyComparableT().EnsureNotNullWithinClosedRange <EmptyComparableT>(new(), new(), string.Empty);

            ArgumentHelper.EnsureNotNullWithinOpenRange(new EmptyComparable(), min, max, string.Empty);
            ArgumentHelper.EnsureNotNullWithinOpenRange <EmptyComparableT>(new EmptyComparableT(), mint, maxt, string.Empty);

            new EmptyComparable().EnsureNotNullWithinOpenRange(min, max, string.Empty);
            new EmptyComparableT().EnsureNotNullWithinOpenRange <EmptyComparableT>(mint, maxt, string.Empty);

            ArgumentHelper.ThrowIfNull(new(), string.Empty);

            new object().ThrowIfNull(string.Empty);
        }