예제 #1
0
 protected IConfigurationManager GetConfigurationManager()
 {
     if (_configMan == null)
     {
         _configMan = new MockConfigurationManager();
     }
     return(_configMan);
 }
예제 #2
0
        public void TestGrammar(BaseSAMIApp app, IConfigurationManager configManager, String input, Dictionary <String, String> expectedParams, String grammarName = null)
        {
            // Setup fake configuration manager
            MockConfigurationManager mockConfigManager = configManager as MockConfigurationManager;
            MockVoiceControl         control           = new MockVoiceControl();

            mockConfigManager.AddComponent(control);

            // Make app object to get grammar for.
            TestGrammar(input, expectedParams, grammarName, control, app);
        }
예제 #3
0
        public void TestGrammar <T>(String input, Dictionary <String, String> expectedParams, String grammarName = null)
            where T : BaseSAMIApp
        {
            // Setup fake configuration manager
            MockConfigurationManager configManager = GetConfigurationManager() as MockConfigurationManager;
            MockVoiceControl         control       = new MockVoiceControl();

            configManager.AddComponent(control);

            // Make app object to get grammar for.
            T app = typeof(T).GetConstructor(new Type[] { }).Invoke(new Object[] { }) as T;

            TestGrammar(input, expectedParams, grammarName, control, app);
        }
예제 #4
0
        protected String RunSingleConversation <T>(Dictionary <String, String> dialogParameters, bool conversationIsOver = true)
            where T : Conversation
        {
            MockConfigurationManager configManager = GetConfigurationManager() as MockConfigurationManager;

            if (CurrentConversation == null)
            {
                CurrentConversation = typeof(T).GetConstructor(new Type[] { typeof(IConfigurationManager) }).Invoke(new Object[] { configManager }) as T;
            }
            Assert.IsNotNull(CurrentConversation);
            Assert.IsTrue(CurrentConversation.TryAddDialog(new Dialog(dialogParameters, String.Empty)));
            String response = CurrentConversation.Speak();

            Assert.AreEqual(conversationIsOver, CurrentConversation.ConversationIsOver);
            return(response);
        }