public void CanCreateReusableConstraintByImplicitConversion() { ReusableConstraint c = Is.Not.Null; string s = "test"; Assert.That(s, c, "Should pass first time"); Assert.That(s, c, "Should pass second time"); Assert.That(s, c, "Should pass third time"); }
public void CanReuseReusableConstraintMultipleTimes(ReusableConstraint c) { string s = "test"; Assume.That(s, c); Assert.That(s, c, "Should pass first time"); Assert.That(s, c, "Should pass second time"); Assert.That(s, c, "Should pass third time"); }
public static Transmission AddPropertyContraint(this Transmission transmission, ReusableConstraint constraint, string propertyName) { transmission.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { var t = sender as Transmission; if (e.PropertyName == propertyName) { Assert.That(t, Has.Property(propertyName)); var value = t.GetType().GetProperty(propertyName).GetValue(t, null); if (value != null) { Assert.That(value, constraint, propertyName); } } }; return transmission; }
public void MostOperationsShouldThrow_IfInactive() { using (var context = this.CreateContext()) { var assertion = new ReusableConstraint(Throws.Exception.TypeOf<HexagonException>().With.Message.ContainsSubstring("not active")); Assert.That(() => context.Get<Entity1>(1), assertion); Assert.That(() => context.Add(new Entity1()), assertion); Assert.That(() => context.Remove(new Entity1()), assertion); Assert.That(() => context.Execute(new Entity1Query()), assertion); Assert.That(() => context.Execute(new CommandNoResult()), assertion); Assert.That(() => context.Execute(new CommandWithResult()), assertion); Assert.That(() => context.Commit(), assertion); } }