コード例 #1
0
        public void Multiplying_by_negative_reverses_order(NegativeInt x, SameCurrency <string> monies)
        {
            var(y, z) = monies;
            var x_ = (int)x;

            Assert.NotEqual(y > z, (y * x_) > (z * x_));
            Assert.NotEqual(y > z, y.Multiply(x_) > z.Multiply(x_));
        }
コード例 #2
0
        public void TheConstructorThrowsWithNegativeRadius(NegativeInt negativeInt)
        {
            Action constructorWithNegativeRadius =
                () => CreateBlurrerWith(negativeInt.Get);

            constructorWithNegativeRadius
            .Should().Throw <ArgumentException>();
        }
コード例 #3
0
        public Property Structure(PositiveInt x, NegativeInt y, FsCheck.NonZeroInt z)
        {
            Spec <int[]> spec = Spec.Of <int[]>()
                                .Structure(new Func <int, bool>[]
            {
                i => i > 0,
                i => i < 0,
                i => i != 0
            }, "should match the structure");

            return(spec.ToProperty(new [] { x.Get, y.Get, z.Get }));
        }
コード例 #4
0
ファイル: CsvRowToObjectTest.cs プロジェクト: henrik79/Csv
        public Property Negative_Integer_Should_Be_Parsed_As_Negative_Integer(NegativeInt x)
        {
            var csvRow = new CsvRow
            {
                RowNumber = 1,
                Fields    = new List <FieldValue> {
                    new FieldValue("Volume", x.ToString())
                }
            };

            return((CsvRowToObject <Sale> .Convert(csvRow).Volume == x.Item).ToProperty());
        }
コード例 #5
0
        public void Cascade(NegativeInt x)
        {
            ValidationResult <int> result =
                Spec.Of <int>("int")
                .GreaterThan(0, "should be greater than zero")
                .Equal(0, "should be equal to zero")
                .Cascade(CascadeMode.Continue)
                .Validate(x.Get);

            Assert.Equal(1, result.Details.Count);
            Assert.True(result.Details.TryGetValue("int", out string[] errors));
            Assert.Equal(2, errors.Length);
        }
コード例 #6
0
        public Property NotUniqueItems(NegativeInt item)
        {
            Gen <int[]> gen = Arb.Generate <NonEmptyArray <int> >()
                              .Select(x => x.Get)
                              .Where(xs => xs.GroupBy(x => x).Any(g => g.Count() > 1))
                              .Or(Gen.Constant(item.Get).ArrayOf().Where(xs => xs.Length > 1));

            return(Prop.ForAll(gen.ToArbitrary(), target =>
            {
                Spec <int[]> spec = Spec.Of <int[]>().Unique("should include only unique items");
                return spec.ToProperty(target, expected: false);
            }));
        }
コード例 #7
0
            public void ThrowsWhenTheNumberIsLessThanZero(NegativeInt number, PositiveInt length)
            {
                Action withNegativeNumber = () => number.Get.PingPongClamp(length.Get);

                withNegativeNumber.Should().Throw <ArgumentOutOfRangeException>();
            }
コード例 #8
0
        public Property IsType(NegativeInt x)
        {
            Spec <object> spec = Spec.Of <object>().IsType(typeof(NegativeInt), "should be of type 'negative int'");

            return(spec.ToProperty(x));
        }
コード例 #9
0
ファイル: Rational.cs プロジェクト: ariasemis/monies
 public NegativeRational(NegativeInt numerator, PositiveInt denominator)
 {
     Item = new Rational(numerator.Item, denominator.Item);
 }
コード例 #10
0
 public void ShouldThrowForNegativeMaximum(int seed, NegativeInt max)
 {
     CallingWith(seed, max.Get).Should().Throw <ArgumentException>();
 }
コード例 #11
0
 public void ReturnsOnlyFalseForNegativeParameter(int seed, NegativeInt negativeInt)
 {
     ResultOfCallingWith(seed, negativeInt.Get).Should().Be(false);
 }