Example #1
0
        public void ReturnDefaultView()
        {
            // Arrange
            var mockedIDestinationService = new Mock <IDestinationService>();
            var mockedMappingService      = new Mock <IMappingService>();
            var mockedImageService        = new Mock <IImageService>();
            var destinationsController    = new DestinationsController(mockedIDestinationService.Object, mockedMappingService.Object, mockedImageService.Object);

            //Act & Assert
            destinationsController
            .WithCallTo(c => c.Index())
            .ShouldRenderDefaultView();
        }
        public void ReturnViewWithModel()
        {
            // Arrange
            var mockedIDestinationService = new Mock <IDestinationService>();
            var mockedMappingService      = new Mock <IMappingService>();
            var mockedImageService        = new Mock <IImageService>();
            var destinationsController    = new DestinationsController(mockedIDestinationService.Object, mockedMappingService.Object, mockedImageService.Object);

            destinationsController.ModelState.AddModelError("", "dummy error");

            DestinationViewModel model = new DestinationViewModel();

            // Act & Assert
            destinationsController
            .WithCallTo(c => c.Create(model))
            .ShouldRenderDefaultView()
            .WithModel(model);
        }