public override void Define() { FactType5 fact = null; When() .Match <FactType5>(() => fact, f => f.TestProperty.StartsWith("Valid")); Then() .Do(ctx => ctx.Retract(fact)) .Do(ctx => Action()); }
public override void Define() { FactType5 fact = null; When() .Match <FactType5>(() => fact, f => f.TestProperty.StartsWith("Valid"), f => f.TestCount <= 2); Then() .Do(ctx => fact.IncrementCount()) .Do(ctx => ctx.Update(fact)) .Do(ctx => Action()); }
public void Fire_OneMatchingFactEligibleForTwoIncrements_FiresTwice() { //Arrange var fact = new FactType5 { TestProperty = "Valid Value 1", TestCount = 1 }; Session.Insert(fact); //Act Session.Fire(); //Assert AssertFiredTwice(); }
public void Fire_OneMatchingFact_FiresOnceAndRetractsFact() { //Arrange var fact = new FactType5 { TestProperty = "Valid Value 1" }; Session.Insert(fact); //Act Session.Fire(); //Assert AssertFiredOnce(); Assert.AreEqual(0, Session.Query <FactType5>().Count()); }