public void NumericStringShouldNeverViolateConstraint() { // Fixture setup var generator = from n in Arb.Generate <uint>() select n.ToString(); var constraint = new DigitStringConstraint(); // Exercise system and verify outcome Prop.ForAll( generator.ToArbitrary(), s => constraint.Check(s).Violated.Should().BeFalse()) .QuickCheckThrowOnFailure(); }
public void NotNumericStringStringShouldAlwaysViolateConstraint() { // Fixture setup var generator = from s in Arb.Generate <string>() where s != null && !s.Any(char.IsDigit) select s; var constraint = new DigitStringConstraint(); // Exercise system and verify outcome Prop.ForAll(generator.ToArbitrary(), s => { var result = constraint.Check(s); result.Violated.Should().BeTrue(); result.Message.Should().Be("String must contains only digit symbols."); }).QuickCheckThrowOnFailure(); }