public void ApplyTo_SinglePassingConstraints_Success() { var subject = new ConjunctionConstraint( Is.GreaterThan(5)); Assert.That(matches(subject, 6), Is.True); }
public void WriteMessageTo_SingleFailingConstraint_ContainsConstraints() { var subject = new ConjunctionConstraint( Is.GreaterThan(5)); Assert.That(getMessage(subject, 4), Does.StartWith(TextMessageWriter.Pfx_Expected + "greater than 5")); }
public void WriteMessageTo_SingleFailingConstraint_ContainsTheOffender() { var subject = new ConjunctionConstraint( Is.GreaterThan(5)); Assert.That(getMessage(subject, 4), Does.Contain("Specifically: greater than 5")); }
public void ApplyTo_SingleFailingConstraints_Failure() { var subject = new ConjunctionConstraint( Is.GreaterThan(5)); Assert.That(matches(subject, 4), Is.False); }
public NoOptimalChangeConstraint() { Delegate = new ConjunctionConstraint( Must.Have.Property(nameof(OptimalChangeSolution.IsSolution), Is.False), Is.Empty, Must.Have.Property(nameof(OptimalChangeSolution.Count), Is.EqualTo(0))); }
public NoChangeConstraint(Money remainder) { Delegate = new ConjunctionConstraint( Must.Have.Property(nameof(ChangeSolution.IsSolution), Is.False), Is.Empty, Must.Have.Property(nameof(ChangeSolution.Count), Is.EqualTo(0)), Must.Have.Property(nameof(ChangeSolution.Remainder), Is.EqualTo(remainder))); }
public OptimalChangeConstraint(QDenomination[] denominations) { Delegate = new ConjunctionConstraint( Must.Have.Property(nameof(OptimalChangeSolution.IsSolution), Is.True), new ConstrainedEnumerable( denominations.Select(d => new QuantifiedDenominationConstraint(d)) )); }
public void WriteMessageTo_FailingConstraint_ActualContainsActual() { var subject = new ConjunctionConstraint( Is.GreaterThan(1), Is.GreaterThan(5)); Assert.That(getMessage(subject, 4), Does.Contain(TextMessageWriter.Pfx_Actual + "4") ); }
public void ApplyTo_PassingConstraint_Success() { var subject = new ConjunctionConstraint( Is.GreaterThan(1), Is.GreaterThan(5)); Assert.That(matches(subject, 6), Is.True); Assert.That(getMessage(subject, 6), Is.Empty); }
public PartialChangeConstraint(Money remainder, uint totalCount, QDenomination[] denominations) { Delegate = new ConjunctionConstraint( Must.Have.Property(nameof(ChangeSolution.IsSolution), Is.True), Must.Have.Property(nameof(ChangeSolution.IsPartial), Is.True), Must.Have.Property(nameof(ChangeSolution.Remainder), Is.EqualTo(remainder)), Must.Have.Property(nameof(ChangeSolution.TotalCount), Is.EqualTo(totalCount)), new ConstrainedEnumerable( denominations.Select(d => new QuantifiedDenominationConstraint(d)) )); }
public QuantifiedDenominationConstraint(uint quantity, decimal denominationValue) { Delegate = new ConjunctionConstraint( Must.Have.Property(nameof(QuantifiedDenomination.Quantity), Is.EqualTo(quantity)), Must.Have.Property(nameof(QuantifiedDenomination.Denomination), Must.Have.Property(nameof(Denomination.Value), Is.EqualTo(denominationValue)))); }
public void ApplyTo_NoConstraints_Success() { var subject = new ConjunctionConstraint(); Assert.That(matches(subject, new object()), Is.True); }
public void ApplyTo_AllNullContraints_Success() { var subject = new ConjunctionConstraint(null, null); Assert.That(matches(subject, new object()), Is.True); }
public void ApplyTo_EmptyConstraints_Success() { var subject = new ConjunctionConstraint(new Constraint[0]); Assert.That(matches(subject, new object()), Is.True); }