public async Task EmailInput_ShouldReturn_CorrectErrorMessageForInput(string error, string expectedMessage) { var result = await _controller.EmailInput(error); var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal("EmailInput", viewResult.ViewName); var viewModel = Assert.IsType <SaveProgressViewModel>(viewResult.Model); Assert.True(viewModel.HasError); Assert.Equal(expectedMessage, viewModel.ErrorMessage); }
public async Task EmailInput_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.EmailInput(error); var viewResult = Assert.IsType <ViewResult>(result); Assert.Equal("EmailInput", viewResult.ViewName); var viewModel = Assert.IsType <SaveProgressViewModel>(viewResult.Model); Assert.True(viewModel.HasError); Assert.Equal(expectedMessage, viewModel.ErrorMessage); }