Ejemplo n.º 1
0
            public void RedirectToIndexWithTempDataMessage_WhenPostedValidViewModel()
            {
                // Arrange
                var visitsServiceMock         = new Mock <IVisitsService>();
                var municipalitiesServiceMock = new Mock <IMunicipalitiesService>();
                var usersServiceMock          = new Mock <IUserService>();
                var pageServiceMock           = new Mock <IPageService <Visit> >();

                var controller = new VisitsController(visitsServiceMock.Object, municipalitiesServiceMock.Object, usersServiceMock.Object, pageServiceMock.Object);

                var visitDetailsModel = new VisitDetailsViewModel();

                // Act & Assert
                controller
                .WithCallTo(c => c.Add(visitDetailsModel))
                .ShouldRedirectTo("Index");

                controller.ShouldHaveTempDataProperty("message", "Visit added successfully");
            }