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_)); }
public void TheConstructorThrowsWithNegativeRadius(NegativeInt negativeInt) { Action constructorWithNegativeRadius = () => CreateBlurrerWith(negativeInt.Get); constructorWithNegativeRadius .Should().Throw <ArgumentException>(); }
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 })); }
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()); }
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); }
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); })); }
public void ThrowsWhenTheNumberIsLessThanZero(NegativeInt number, PositiveInt length) { Action withNegativeNumber = () => number.Get.PingPongClamp(length.Get); withNegativeNumber.Should().Throw <ArgumentOutOfRangeException>(); }
public Property IsType(NegativeInt x) { Spec <object> spec = Spec.Of <object>().IsType(typeof(NegativeInt), "should be of type 'negative int'"); return(spec.ToProperty(x)); }
public NegativeRational(NegativeInt numerator, PositiveInt denominator) { Item = new Rational(numerator.Item, denominator.Item); }
public void ShouldThrowForNegativeMaximum(int seed, NegativeInt max) { CallingWith(seed, max.Get).Should().Throw <ArgumentException>(); }
public void ReturnsOnlyFalseForNegativeParameter(int seed, NegativeInt negativeInt) { ResultOfCallingWith(seed, negativeInt.Get).Should().Be(false); }