예제 #1
0
        public void BuildTreeFromDocument_HostileMocking_TreeIsProperlyBuilt()
        {
            //ARRANGE
            DecisionTreeBuilder builder = new DecisionTreeBuilder();

            // ReSharper disable once InconsistentNaming
            var Morty = new Person("Morty", Gender.Male, Sex.Male, Orientation.Undefined, Guid.NewGuid());

            var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent)
            {
                FileController      = new DecisionTreeFileController(),
                DecisionTreeBuilder = new DecisionTreeBuilder()
            };

            //Hostile Mockery
            Action mockery = new Action
            {
                Tone       = Tone.Mocking,
                EventType  = EventType.Interaction,
                ActionType = ActionType.Verbal,
                Intent     = Intent.Hostile,
                Message    = "Did your mother dress you up this morning?",
                Target     = character.MyName,
                EventName  = "Mocking",
                Source     = "The Bully"
            };


            //ACT
            var rootNode = builder.BuildTreeFromDocument(new DecisionTreeFileController(), mockery, "Morty") as AbstractDecisionNode;

            //ASSERT
            //ASSERT
            Assert.IsNotNull(rootNode);
            //ajusted per event
            Assert.IsFalse(string.IsNullOrEmpty(rootNode.DefaultTreeReaction));
            Assert.AreEqual(60, rootNode.ConfiguredPassFailValue);
            Assert.IsTrue(rootNode.LeftNode != null);
            Assert.IsTrue(rootNode.RightNode != null);
        }
예제 #2
0
        public void BuildTreeFromDocument_NeutralSalute_TreeIsProperlyBuilt()
        {
            //ARRANGE
            DecisionTreeBuilder builder = new DecisionTreeBuilder();

            // ReSharper disable once InconsistentNaming
            var Morty = new Person("Morty", Gender.Male, Sex.Male, Orientation.Undefined, Guid.NewGuid());

            var character = new global::RNPC.Core.Character(Morty, Archetype.TheInnocent)
            {
                FileController      = new DecisionTreeFileController(),
                DecisionTreeBuilder = new DecisionTreeBuilder()
            };

            //Neutral Salute
            Action salute = new Action
            {
                EventType  = EventType.Interaction,
                ActionType = ActionType.NonVerbal,
                Intent     = Intent.Neutral,
                Message    = "",
                Target     = character.MyName,
                EventName  = "Salute",
                Source     = "The Ambassador"
            };


            //ACT
            var rootNode = builder.BuildTreeFromDocument(new DecisionTreeFileController(), salute, "Morty") as AbstractDecisionNode;

            //ASSERT
            //ASSERT
            Assert.IsNotNull(rootNode);
            //ajusted per event
            Assert.IsFalse(string.IsNullOrEmpty(rootNode.DefaultTreeReaction));
            Assert.AreEqual(0, rootNode.ConfiguredPassFailValue);
            Assert.IsTrue(rootNode.LeftNode != null);
            Assert.IsTrue(rootNode.RightNode != null);
        }