public void TestRunFirstRound() { controller.ConversationTopicsDiscussed["weather"] = false; controller.ConversationTopicsDiscussed["event"] = false; controller.ConversationTopicsDiscussed["greeting"] = false; for (int i = 0; i < 1000; i++) { ModuleDialoguePackage data = controller.RunFirstRound(); Assert.IsTrue(data.DialogueAndEffects.Count == 2); if (i < 3) { Assert.IsFalse(controller.EndConversation); } else //can only run a max of three times { Assert.IsTrue(controller.EndConversation); Assert.IsTrue(data.Status == ModuleStatus.EXIT); } if (data.Status == ModuleStatus.CONTINUE) { Assert.IsTrue(data.DialogueAndEffects["setStage"][1].Equals(SmallTalk_Controller.STATEMENT)); } else if (data.Status == ModuleStatus.RETURN) { Assert.IsTrue(data.DialogueAndEffects["setStage"][1].Equals(SmallTalk_Controller.QUESTION)); } } }
public void TestRunNextRound() { for (int i = 0; i < 1000; i++) { controller.EndConversation = false; int option = (int)(controller.Dice.NextDouble() * 3 + 1); controller.DialogueState = (option == 1) ? SmallTalk_Controller.STATEMENT : (option == 2) ? SmallTalk_Controller.QUESTION : SmallTalk_Controller.RESPONSE; controller.ConversationTopicsDiscussed["event"] = false; controller.ConversationTopicsDiscussed["weather"] = false; controller.ConversationTopicsDiscussed["greeting"] = false; ModuleDialoguePackage mod = controller.RunNextRound(); if (controller.DialogueState == SmallTalk_Controller.RESPONSE) { Assert.IsNotNull(mod.DialogueAndEffects); Assert.IsTrue(mod.Status == ModuleStatus.CONTINUE); } if (controller.DialogueState == SmallTalk_Controller.QUESTION) { Assert.IsNotNull(mod.DialogueAndEffects); Assert.IsTrue(mod.Status == ModuleStatus.RETURN); } } }