Exemple #1
0
            public override void Define()
            {
                NameFact      thisNameFact  = null;
                NameFact      otherNameFact = null;
                ReferenceFact referenceFact = null;

                When()
                .Match(() => thisNameFact, f => f.Name == "ThisName")
                .Match(() => otherNameFact, f => f.Name == "OtherName")
                .Match(() => referenceFact, rf => rf.Reference == otherNameFact);

                Then()
                .Do(ctx => ctx.NoOp());
            }
Exemple #2
0
            public override void Define()
            {
                NameFact thisNameFact  = null;
                NameFact otherNameFact = null;
                IEnumerable <ReferenceFact> referenceFacts = null;

                When()
                .Match(() => thisNameFact, f => f.Name == "ThisName")
                .Match(() => otherNameFact, f => f.Name == "OtherName")
                .Query(() => referenceFacts, q => q
                       .Match <ReferenceFact>()
                       .GroupBy(x => x.GetKey(otherNameFact))
                       .Where(g => g.All(x => x.Reference == g.Key)));

                Then()
                .Do(ctx => ctx.NoOp());
            }
Exemple #3
0
        public void Fire_FourthRuleMatchesFacts_OnlyMatchingRuleFires()
        {
            //Arrange
            var thisNameFact = new NameFact {
                Name = "ThisName"
            };
            var otherNameFact = new NameFact {
                Name = "OtherName"
            };
            var referenceFact = new ReferenceFact {
                Reference = otherNameFact
            };

            Session.Insert(thisNameFact);
            Session.Insert(otherNameFact);
            Session.Insert(referenceFact);

            //Act
            Session.Fire();

            //Assert
            AssertDidNotFire <TestRule3>();
            AssertFiredOnce <TestRule4>();
        }
Exemple #4
0
 public NameFact GetKey(NameFact nameFact)
 {
     return(nameFact);
 }