示例#1
0
        public void AddStepDoStepInvalidUserInputTest()
        {
            AddStep step = new AddStep();
            Mock <IBartenderController> bartender = new Mock <IBartenderController>(MockBehavior.Strict);

            bartender.Setup(s => s.IsValid).Returns(true);
            step.DoStep(new Dialog(new Dictionary <String, String>(), "Test Phrase"), bartender.Object, new Ingredient("TestIngredient", 1, IngredientUnit.Part, "Test Ingredient"));
            Assert.AreEqual("Add Test Ingredient to the glass and tell me when you are done.", step.MessageToUser);
            Assert.AreEqual(false, step.IsStepDone);
            Assert.AreEqual("Add", step.Name);
            Assert.AreEqual(BartenderApp.ConfirmationRuleName, step.NextGrammarNeeded);
            Assert.AreEqual(false, step.ShouldCancel);
        }
示例#2
0
        public void AddStepDoStepFalseAnswerTest()
        {
            AddStep step = new AddStep();
            Mock <IBartenderController> bartender = new Mock <IBartenderController>(MockBehavior.Strict);

            bartender.Setup(s => s.IsValid).Returns(true);
            Dictionary <String, String> input = new Dictionary <string, string>
            {
                { "answer", "false" },
            };

            step.DoStep(new Dialog(input, "Test Phrase"), bartender.Object, new Ingredient("TestIngredient", 1, IngredientUnit.Part, "Test Ingredient"));
            Assert.AreEqual(null, step.MessageToUser);
            Assert.AreEqual(true, step.IsStepDone);
            Assert.AreEqual("Add", step.Name);
            Assert.AreEqual(null, step.NextGrammarNeeded);
            Assert.AreEqual(true, step.ShouldCancel);
        }