コード例 #1
0
        public void PaintingTestEverAccessibleQuery()
        {
            world = CreateITWorld();
            var q = new AccessibleEverQuery(new Negation(painted), new Negation(painted));

            var r = q.Evaluate(world);

            Assert.AreEqual(r, true);
        }
コード例 #2
0
        public void ShootingTurkeyAccessibleQueries3()
        {
            var world = CreateITWorld();
            var q1    = new AccessibleTypicallyQuery(new True(), walking);
            var q2    = new AccessibleEverQuery(new True(), walking);
            var q3    = new AccessibleAlwaysQuery(new True(), walking);

            Assert.AreEqual(q1.Evaluate(world), true); // enticing turkey will always/ever/typically cause it to walk!!!
            Assert.AreEqual(q2.Evaluate(world), true);
            Assert.AreEqual(q3.Evaluate(world), true);
        }
コード例 #3
0
        public void ShootingTurkeyAccessibleQueries2()
        {
            var world = CreateITWorld();
            var q1    = new AccessibleTypicallyQuery(new True(), loaded);
            var q2    = new AccessibleEverQuery(new True(), loaded);
            var q3    = new AccessibleAlwaysQuery(new True(), loaded);

            Assert.AreEqual(q1.Evaluate(world), true); // loading our gun will always/ever/typically cause it to be loaded!!!
            Assert.AreEqual(q2.Evaluate(world), true);
            Assert.AreEqual(q3.Evaluate(world), true);
        }
コード例 #4
0
        public void ShootingTurkeyAccessibleQueries1()
        {
            var world = CreateITWorld();
            var q1    = new AccessibleTypicallyQuery(new True(), new Negation(walking));
            var q2    = new AccessibleEverQuery(new True(), new Negation(walking));
            var q3    = new AccessibleAlwaysQuery(new True(), new Negation(walking));

            Assert.AreEqual(true, q1.Evaluate(world));  // there's possibility to kill turkey or start in state when it's not walking
            Assert.AreEqual(true, q2.Evaluate(world));  // killing turkey is typicall scenario
            Assert.AreEqual(false, q3.Evaluate(world)); // not always shooting will kill turkey
        }
コード例 #5
0
        public void ShootingTurkeyAccessibleQueries4()
        {
            var world = CreateITWorld();
            var q1    = new AccessibleTypicallyQuery(new Negation(alive), walking);
            var q2    = new AccessibleEverQuery(new Negation(alive), walking);
            var q3    = new AccessibleAlwaysQuery(new Negation(alive), walking);

            Assert.AreEqual(q1.Evaluate(world), false); // enticing dead turkey will never cause it to walk!!!
            Assert.AreEqual(q2.Evaluate(world), false);
            Assert.AreEqual(q3.Evaluate(world), false);
        }
コード例 #6
0
        public void EverAccessibleQuery()
        {
            world = CreateITWorld();

            var q1 = new AccessibleEverQuery(new True(), catVisible);
            var q2 = new AccessibleEverQuery(new True(), new Negation(elixirExists));
            var q3 = new AccessibleEverQuery(new True(), new Negation(cakeExists));

            var r1 = q1.Evaluate(world);
            var r2 = q2.Evaluate(world);
            var r3 = q3.Evaluate(world);

            Assert.AreEqual(r1, true);
            Assert.AreEqual(r2, true);
            Assert.AreEqual(r3, true);
        }