SetPerspective() public method

public SetPerspective ( Name newPerspective ) : void
newPerspective Name
return void
Exemplo n.º 1
0
        public void Test_Fail_Change_Perspective_To_Invalid_Perspective(string perspective)
        {
            var kb = new KB(Name.BuildName("Mark"));
            kb.Tell(Name.BuildName("IsPerson(Self)"), Name.BuildName(true), Name.BuildName("John(Self)"));

            Assert.Throws<ArgumentException>(() => kb.SetPerspective(Name.BuildName(perspective)));
        }
Exemplo n.º 2
0
        public void Test_Tell_Pass_Add_Self_Belief_and_Change_Perspective_02()
        {
            var kb = new KB(Name.BuildName("Mark"));
            kb.Tell(Name.BuildName("IsPerson(Self)"), Name.BuildName(true),Name.BuildName("John(Self)"));

            kb.SetPerspective(Name.BuildName("Mary"));

            Assert.Null(kb.AskProperty(Name.BuildName("IsPerson(Mark)"), Name.BuildName("John(Self)")));

            var n = kb.AskProperty(Name.BuildName("IsPerson(Mary)"), Name.BuildName("John(Self)"));
            bool b;
            if(!n.TryConvertToValue(out b))
                Assert.Fail();
            Assert.True(b);
        }