Exemple #1
0
        public async Task Create_Post_ReturnsRedirectToResult_OnSuccess()
        {
            var mockRepo     = MockLanguageRepository();
            var mockLanguage = MockLanguage();

            mockRepo.Setup(repo => repo.AddAsync(mockLanguage))
            .ReturnsAsync(true);

            var controller = new LanguageController(mockRepo.Object);
            var result     = await controller.Add(mockLanguage);

            Assert.IsType <RedirectToActionResult>(result);
        }
Exemple #2
0
        public void Create_Get_ReturnsViewResult_WithLanguage()
        {
            //Arrange
            var mockRepo   = MockLanguageRepository();
            var controller = new LanguageController(mockRepo.Object);

            //Act
            var result = controller.Add();

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

            Assert.IsAssignableFrom <Language>(viewResult.ViewData.Model);
        }