Exemple #1
0
        public void Fire_OneMatchingFactSetOneNotMatching_FiresOnce()
        {
            //Arrange
            var fact1A = new FactType1 {
                TestProperty = "Valid Value 1"
            };
            var fact1B = new FactType1 {
                TestProperty = "Valid Value 2"
            };
            var fact4A = new FactType4 {
                TestProperty = "Valid Value 1"
            };
            var fact4B = new FactType4 {
                TestProperty = "Valid Value 3"
            };

            Session.Insert(fact1A);
            Session.Insert(fact1B);
            Session.Insert(fact4A);
            Session.Insert(fact4B);

            //Act
            Session.Fire();

            //Assert
            AssertFiredOnce();
        }
Exemple #2
0
        public void Fire_TwoMatchingFactSets_FiresTwice()
        {
            //Arrange
            var fact1A = new FactType1 {
                TestProperty = "Valid Value 1"
            };
            var fact1B = new FactType1 {
                TestProperty = "Valid Value 2"
            };
            var fact4A = new FactType4 {
                TestProperty = "Valid Value 1"
            };
            var fact4B = new FactType4 {
                TestProperty = "Valid Value 2"
            };

            Session.Insert(fact1A);
            Session.Insert(fact1B);
            Session.Insert(fact4A);
            Session.Insert(fact4B);

            //Act
            Session.Fire();

            //Assert
            AssertFiredTwice();
        }
Exemple #3
0
        public void Fire_MatchingFacts_FiresOnce()
        {
            //Arrange
            var fact1 = new FactType4 {
                TestProperty = "Valid Value 1"
            };
            var fact2 = new FactType4 {
                TestProperty = "Valid Value 2", Parent = fact1
            };
            var fact3 = new FactType4 {
                TestProperty = "Invalid Value 3", Parent = fact1
            };
            var fact4 = new FactType4 {
                TestProperty = "Valid Value 4", Parent = null
            };

            Session.Insert(fact1);
            Session.Insert(fact2);
            Session.Insert(fact3);
            Session.Insert(fact4);

            //Act
            Session.Fire();

            //Assert
            AssertFiredOnce();
        }
        public override void Define()
        {
            FactType4 fact1 = null;
            FactType4 fact2 = null;

            When()
            .Match <FactType4>(() => fact1, f => f.TestProperty.StartsWith("Valid"))
            .Match <FactType4>(() => fact2, f => f.TestProperty.StartsWith("Valid"), f => f.Parent == fact1);

            Then()
            .Do(ctx => Action());
        }
Exemple #5
0
        public void Fire_OneMatchingFactSet_FiresOnce()
        {
            //Arrange
            var fact1 = new FactType1 {
                TestProperty = "Valid Value 1"
            };
            var fact4 = new FactType4 {
                TestProperty = "Valid Value 1"
            };

            Session.Insert(fact1);
            Session.Insert(fact4);

            //Act
            Session.Fire();

            //Assert
            AssertFiredOnce();
        }
Exemple #6
0
        public void Fire_FirstMatchingFactSecondInvalid_DoesNotFire()
        {
            //Arrange
            var fact1 = new FactType4 {
                TestProperty = "Valid Value 1"
            };
            var fact2 = new FactType4 {
                TestProperty = "Valid Value 2"
            };

            Session.Insert(fact1);
            Session.Insert(fact2);

            //Act
            Session.Fire();

            //Assert
            AssertDidNotFire();
        }
Exemple #7
0
            public override void Define()
            {
                IGrouping <string, FactType1> facts      = null;
                IEnumerable <FactType2>       otherFacts = null;
                FactType4 projection = null;

                When()
                .Query(() => facts, q => q
                       .Match <FactType1>()
                       .GroupBy(x => x.GroupKey))
                .Query(() => otherFacts, q => q
                       .Match <FactType2>(x => x.Key != facts.Key)
                       .Collect())
                .Query(() => projection, q => q
                       .Match <FactType3>()
                       .Collect()
                       .Select(x => ProjectValue(x)));

                Filter()
                .OnChange(() => otherFacts.Count());

                Then()
                .Yield(ctx => Create(facts));
            }