コード例 #1
0
        public async Task DeleteConfirmed_When_Id_Does_Not_Exist_In_Database_Returns_Index_View()
        {
            // Arrange
            var expected = "Index";

            // Act
            var actual = await _quizzesController.DeleteConfirmed(1) as RedirectToActionResult;

            // Assert
            Assert.AreEqual(expected, actual.ActionName);
        }
コード例 #2
0
        public async Task DeleteConfirmed_post_action_result_should_redirect_to_action_when_modelState_valid()
        {
            var id = 1;

            var httpContext = new DefaultHttpContext();

            var tempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>());

            var controller = new QuizzesController(_quizRepository.Object, _questionRepository.Object)
            {
                TempData = tempData
            };

            // Act
            var result = await controller.DeleteConfirmed(id);

            // Assert
            Assert.IsType <RedirectToActionResult>(result);
        }