Exemplo n.º 1
0
        public void RecipeStepCallCallNoAdvanceTest()
        {
            MockRecipeStep mockNextStep           = new MockRecipeStep("messageToUser", "nextGrammarNeeded", false, false, false);
            RecipeStepCall nextStepCall           = new RecipeStepCall(mockNextStep);
            MockRecipeStep mockStep               = new MockRecipeStep("messageToUser", "nextGrammarNeeded", false, false, false);
            RecipeStepCall stepCall               = new RecipeStepCall(mockStep, nextStepCall);
            Mock <IBartenderController> bartender = new Mock <IBartenderController>(MockBehavior.Strict);

            bartender.Setup(s => s.IsValid).Returns(true);
            Assert.AreEqual(stepCall, stepCall.Call(new Dialog(new Dictionary <String, String>(), "Phrase"), bartender.Object));
            Assert.AreEqual(true, mockStep.DoStepIsCalled);
            Assert.AreEqual(false, mockNextStep.DoStepIsCalled);
        }
Exemplo n.º 2
0
        public void RecipeStepCallCloneTest()
        {
            MockRecipeStep mockNextStep = new MockRecipeStep("messageToUser", "nextGrammarNeeded", false, false, true);
            RecipeStepCall nextStepCall = new RecipeStepCall(mockNextStep);
            MockRecipeStep mockStep     = new MockRecipeStep("messageToUser", "nextGrammarNeeded", false, false, true);
            RecipeStepCall stepCall     = new RecipeStepCall(mockStep, nextStepCall);

            RecipeStepCall clonedCall = stepCall.Clone() as RecipeStepCall;

            Assert.AreNotSame(clonedCall, stepCall);

            Mock <IBartenderController> bartender = new Mock <IBartenderController>(MockBehavior.Strict);

            bartender.Setup(s => s.IsValid).Returns(true);
            clonedCall.Call(new Dialog(new Dictionary <String, String>(), "Phrase"), bartender.Object);
            Assert.IsFalse(mockStep.DoStepIsCalled);
            Assert.IsFalse(mockNextStep.DoStepIsCalled);
        }