public void SetInvalidOrEmptyLanguage()
        {
            //Arrange
            foreach (string s in new string[] { "xx", "" })
            {
                string           newLang   = s;
                Dialog_Processor processor = Get_Dialog_Processor(0);
                Assert.True(string.IsNullOrEmpty(processor.UserView.strProp_selectedLanguage));
                Assert.Equal("en_useSelectedLanguage", processor.UserView.strProp_actionExplanation_SelectLanguage);

                //Act
                processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                    newLang = s
                });

                //Assert
                Assert.True(string.IsNullOrEmpty(processor.UserView.strProp_selectedLanguage));
                Assert.Equal("en_useSelectedLanguage", processor.UserView.strProp_actionExplanation_SelectLanguage);
                Assert.True(string.IsNullOrEmpty(processor.UserView.strProp_userName));
                //Resetting all dialogue fields
                Assert.True(processor.UserView.boolProp_isActionPossible_SelectLanguage);
                Assert.False(processor.UserView.boolProp_isActionPossible_TellUserName);
                Assert.False(processor.UserView.boolProp_greetingVisible);
                Assert.False(processor.UserView.boolProp_isActionPossible_AnswerChatAgainQuestion);
            }
        }
        public void AnswerChatAgainQuestion_NO()
        {
            //Arrange
            Dialog_Processor processor = Get_Dialog_Processor(0);

            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = "de"
            });
            ViewStateManager.saveViewToViewState(processor.UserView);
            int viewID = processor.UserView.viewID;

            processor = Get_Dialog_Processor(viewID);
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_ReportUserName {
                userName = "******"
            });
            ViewStateManager.saveViewToViewState(processor.UserView);
            viewID = processor.UserView.viewID;

            processor = Get_Dialog_Processor(viewID);

            //Act
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_AcceptChatAgain {
                needChatAgain = false
            });

            //Assert
            Assert.Equal("", processor.UserView.strProp_selectedLanguage);
            Assert.Equal("", processor.UserView.strProp_userName);
            //Resetting all dialogue fields
            Assert.False(processor.UserView.boolProp_isActionPossible_TellUserName);
            Assert.False(processor.UserView.boolProp_greetingVisible);
            Assert.False(processor.UserView.boolProp_isActionPossible_AnswerChatAgainQuestion);
        }
        public void SelectValidLanguage_UserNameAlreadySubmitted()
        {
            //Arrange
            string           newLang   = "de";
            Dialog_Processor processor = Get_Dialog_Processor(0);

            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = "fr"
            });
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_ReportUserName {
                userName = "******"
            });
            Assert.Equal("helloUserMessage_fr_Fransois", processor.UserView.strProp_helloUserMessageText);
            ViewStateManager.saveViewToViewState(processor.UserView);
            int viewID = processor.UserView.viewID;

            //Act
            processor = Get_Dialog_Processor(viewID);
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = newLang
            });

            //Assert
            Assert.Equal(newLang, processor.UserView.strProp_selectedLanguage);
            Assert.Equal("helloUserMessage_de_Fransois", processor.UserView.strProp_helloUserMessageText);
            Assert.False(processor.UserView.boolProp_greetingVisible);
            Assert.False(processor.UserView.boolProp_isActionPossible_TellUserName);
            Assert.True(processor.UserView.boolProp_isActionPossible_AnswerChatAgainQuestion);
            Assert.Equal("questionForChatingAgain_de", processor.UserView.strProp_questionForChatingAgain);
            Assert.Equal("yes_de", processor.UserView.strProp_actionExplanation_DoChatAgain);
            Assert.Equal("no_de", processor.UserView.strProp_actionExplanation_DontChatAgain);
        }
        public void SelectValidLanguage_AfterAnswerChatAgainQuestion_YES()
        {
            //Arrange
            Dialog_Processor processor = Get_Dialog_Processor(0);

            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = "de"
            });
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_ReportUserName {
                userName = "******"
            });
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_AcceptChatAgain {
                needChatAgain = true
            });

            //Act
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = "fr"
            });

            //Assert
            Assert.Equal("fr", processor.UserView.strProp_selectedLanguage);
            Assert.True(processor.UserView.boolProp_greetingVisible);
            Assert.Equal("fr_greeting", processor.UserView.strProp_greetingText);
            Assert.True(processor.UserView.boolProp_isActionPossible_TellUserName);
            Assert.Equal("fr_tellUserName", processor.UserView.strProp_actionExplanation_TellUserName);
            Assert.False(processor.UserView.boolProp_isActionPossible_AnswerChatAgainQuestion);
        }
        //
        // GET: /SingleD/
        public ActionResult Index()
        {
            SingleDialogueModelHelper userView;

            try
            {
                userView = ViewStateManager.getViewFromViewState <SingleDialogueModelHelper>(_dialogViewIndex);
            }
            catch (KeyNotFoundException)
            {
                userView = new SingleDialogueModelHelper();
            }

            RAM_HelloWorldRepository rep = new RAM_HelloWorldRepository();

            rep.populateWithTestData();
            Dialog_Processor viewProcessor = new Dialog_Processor(userView, rep);

            _dialogViewIndex = viewProcessor.UserView.viewID;

            //viewProcessor.AddUserAction(new Dialog_UserActions.Action_SetSelectedLanguage { newLang = "ru" });
            //viewProcessor.AddUserAction(new Dialog_UserActions.Action_ReportUserName { userName = "******" });
            //viewProcessor.InvokeUserActions();
            viewProcessor.InvokeUserActions(ExtractRequestActions_Index());
            //viewProcessor.InvokeUserAction(new Dialog_UserActions.Action_SetSelectedLanguage {newLang = "de"});

            return(View("Index", viewProcessor.UserView));
        }
        public void SetValidSelectedLanguage()
        {
            //Arrange
            string           newLang   = "de";
            Dialog_Processor processor = Get_Dialog_Processor(0);

            Assert.True(string.IsNullOrEmpty(processor.UserView.strProp_selectedLanguage));
            Assert.True(processor.UserView.boolProp_isActionPossible_SelectLanguage);

            //Act
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = newLang
            });


            //Assert
            Assert.Equal(newLang, processor.UserView.strProp_selectedLanguage);
            Assert.True(processor.UserView.boolProp_isActionPossible_SelectLanguage);
            Assert.Equal("de_useSelectedLanguage", processor.UserView.strProp_actionExplanation_SelectLanguage);
        }
        public void SelectValidLanguage_UserNameUnknown()
        {
            //Arrange
            string           newLang   = "de";
            Dialog_Processor processor = Get_Dialog_Processor(0);

            Assert.True(string.IsNullOrEmpty(processor.UserView.strProp_selectedLanguage));
            Assert.True(string.IsNullOrEmpty(processor.UserView.strProp_userName));

            //Act
            processor.InvokeUserAction(new BasementHelloWorldCommonParts.UA_Processors.Dialog_Processor.Action_SetSelectedLanguage {
                newLang = newLang, hostViewID = processor.UserView.viewID
            });

            //Assert
            Assert.Equal(newLang, processor.UserView.strProp_selectedLanguage);
            Assert.True(processor.UserView.boolProp_greetingVisible);
            Assert.Equal("de_greeting", processor.UserView.strProp_greetingText);
            Assert.True(processor.UserView.boolProp_isActionPossible_TellUserName);
            Assert.Equal("de_tellUserName", processor.UserView.strProp_actionExplanation_TellUserName);
            Assert.False(processor.UserView.boolProp_isActionPossible_AnswerChatAgainQuestion);
        }