Exemplo n.º 1
0
        public async Task SmsInput_ShouldReturn_CorrectErrorMessageForInput(string error, string expectedMessage)
        {
            var result = await _controller.SmsInput(error);

            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.Equal("SmsInput", viewResult.ViewName);

            var viewModel = Assert.IsType <SaveProgressViewModel>(viewResult.Model);

            Assert.True(viewModel.HasError);
            Assert.Equal(expectedMessage, viewModel.ErrorMessage);
        }
        public async Task SmsInput_ShouldReturn_CorrectErrorMessageForInput(string error, string expectedMessage)
        {
            _session.TryGetValue("session-id", out Arg.Any <byte[]>())
            .Returns(x => {
                x[1] = Encoding.UTF8.GetBytes("201904-Abc123");
                return(true);
            });

            var result = await _controller.SmsInput(error);

            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.Equal("SmsInput", viewResult.ViewName);

            var viewModel = Assert.IsType <SaveProgressViewModel>(viewResult.Model);

            Assert.True(viewModel.HasError);
            Assert.Equal(expectedMessage, viewModel.ErrorMessage);
        }