public void Handle_WhenContextIsNull_ExceptionExpected()
        {
            var      viewModel = TestHelper.CreateWindowTwoViewModel();
            var      state     = new EnterInvalidTextInWindowTwoState(viewModel);
            IContext context   = null;

            // ReSharper disable once ExpressionIsAlwaysNull
            Assert.Catch <ArgumentNullException>(() => state.Go(context));
        }
        public void Handle_WhenEnteredTextIsCorrect_SetExpectedStateToContext()
        {
            var viewModel = TestHelper.CreateWindowTwoViewModel();
            var state     = new EnterInvalidTextInWindowTwoState(viewModel);

            viewModel.EnteredText = Constants.ExpectedUserInput;
            var context = viewModel.Context;

            state.Go(context);

            Assert.AreEqual(typeof(EnterCorrectTextInWindowTwoState), context.State.GetType());
        }
        public void Handle_WhenEnteredTextIsCorrect_SetExpectedTextToUserMessage()
        {
            var viewModel = TestHelper.CreateWindowTwoViewModel();
            var state     = new EnterInvalidTextInWindowTwoState(viewModel);

            viewModel.EnteredText = Constants.ExpectedUserInput;
            var context = viewModel.Context;

            state.Go(context);

            Assert.AreEqual(Constants.ThankYouTextToUser, viewModel.UserMessage);
        }
        public void Handle_WhenEnteredTextIsCorrect_SetCanExecuteButtonThreeComandToTrue()
        {
            var viewModel = TestHelper.CreateWindowTwoViewModel();
            var state     = new EnterInvalidTextInWindowTwoState(viewModel);

            viewModel.EnteredText = Constants.ExpectedUserInput;
            var context = viewModel.Context;

            state.Go(context);

            Assert.IsTrue(viewModel.CanExecuteButtonThreeCommand);
        }
        public void Handle_WhenEnteredTextIsInvalid_SetCanExecuteButtonThreeComandToFalse()
        {
            var viewModel = TestHelper.CreateWindowTwoViewModel();
            var state     = new EnterInvalidTextInWindowTwoState(viewModel);

            viewModel.EnteredText = "123";
            var context = viewModel.Context;

            state.Go(context);

            Assert.IsFalse(viewModel.CanExecuteButtonThreeCommand);
        }
        public void Handle_WhenEnteredTextIsInvalid_NotChangeCurrentState()
        {
            var viewModel = TestHelper.CreateWindowTwoViewModel();
            var state     = new EnterInvalidTextInWindowTwoState(viewModel);

            viewModel.EnteredText = "123";
            var context       = viewModel.Context;
            var expectedState = context.State;

            state.Go(context);

            Assert.AreEqual(expectedState, context.State);
        }