Exemple #1
0
        public void AssertAndTestComparisonFact()
        {
            Fact fact = new ComparisonFact("Temperature", Comparison.GreaterEqual, 36);

            this.world.AssertFact(fact);
            Assert.IsTrue(this.world.IsAFact(fact));
        }
Exemple #2
0
        public void AssertTwiceAndTestComparisonFact()
        {
            Fact fact = new ComparisonFact("Age", Comparison.GreaterEqual, 40);

            this.world.AssertFact(fact);
            this.world.AssertFact(new ComparisonFact("Age", Comparison.GreaterEqual, 40));
            Assert.IsTrue(this.world.IsAFact(fact));
        }
Exemple #3
0
        public void AssertAndRetractAndTestComparisonFact()
        {
            Fact fact = new ComparisonFact("Pressure", Comparison.GreaterEqual, 20);

            this.world.AssertFact(fact);
            this.world.RetractFact(fact);
            Assert.IsFalse(this.world.IsAFact(fact));
        }
Exemple #4
0
        public void GreaterEqual()
        {
            ComparisonFact fact = new ComparisonFact("Temperature", Comparison.GreaterEqual, 38);

            Assert.AreEqual("Temperature", fact.Name);
            Assert.AreEqual(">=", fact.Verb);
            Assert.AreEqual(38, fact.Value);

            Assert.IsTrue(fact.IsSatisfiedByValue(39));
            Assert.IsTrue(fact.IsSatisfiedByValue(40));
            Assert.IsTrue(fact.IsSatisfiedByValue(38));
            Assert.IsFalse(fact.IsSatisfiedByValue(22));

            Assert.IsFalse(fact.IsSatisfiedByValue((object)null));
        }
Exemple #5
0
        public void LessEqual()
        {
            ComparisonFact fact = new ComparisonFact("Temperature", Comparison.LessEqual, 40);

            Assert.AreEqual("Temperature", fact.Name);
            Assert.AreEqual("<=", fact.Verb);
            Assert.AreEqual(40, fact.Value);

            Assert.IsTrue(fact.IsSatisfiedByValue(38));
            Assert.IsTrue(fact.IsSatisfiedByValue(-10));
            Assert.IsTrue(fact.IsSatisfiedByValue(40));
            Assert.IsFalse(fact.IsSatisfiedByValue(42));

            Assert.IsFalse(fact.IsSatisfiedByValue((object)null));
        }
Exemple #6
0
        public void FalseComparisonFact()
        {
            Fact fact = new ComparisonFact("Temperature", Comparison.Greater, 42);

            Assert.IsFalse(this.world.IsAFact(fact));
        }
Exemple #7
0
        public void RaiseWhenRetractFalseComparisonFact()
        {
            Fact fact = new ComparisonFact("Age", Comparison.Greater, 40);

            this.world.RetractFact(fact);
        }