public void CreateSubmissin_ShouldRedirectToSubmission() { // Arrange var mockSubmitService = new Mock <ISubmitService>(); var mockAuthenticationProvider = new Mock <IAuthenticationProvider>(); var mockViewModelFactory = new Mock <IViewModelFactory>(); var controller = new SubmitController(mockSubmitService.Object, mockAuthenticationProvider.Object, mockViewModelFactory.Object); var fakeNewSubmitViewModel = new NewSubmitViewModel(); var fakeSubmission = new Submission { Id = 0 }; mockSubmitService.Setup(x => x.CreateSubmission(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string[]>())) .Returns(fakeSubmission); //Act controller.WithCallTo(x => x.New(fakeNewSubmitViewModel)) .ShouldRedirectTo(x => x.Submission); }
public void Index_ShouldRenderDefaultView() { // Arrange var mockSubmitService = new Mock <ISubmitService>(); var mockAuthenticationProvider = new Mock <IAuthenticationProvider>(); var mockViewModelFactory = new Mock <IViewModelFactory>(); var controller = new SubmitController(mockSubmitService.Object, mockAuthenticationProvider.Object, mockViewModelFactory.Object); //Act && Assert controller.WithCallTo(x => x.Index()).ShouldRenderDefaultView(); }
public void Submission_ShouldRenderDefaultView(int id) { // Arrange var mockSubmitService = new Mock <ISubmitService>(); var mockAuthenticationProvider = new Mock <IAuthenticationProvider>(); var mockViewModelFactory = new Mock <IViewModelFactory>(); var controller = new SubmitController(mockSubmitService.Object, mockAuthenticationProvider.Object, mockViewModelFactory.Object); var fakeSubmission = new Submission { CategoryId = 0, Condition = "", Answers = new List <SubmissionAnswer>() }; mockSubmitService.Setup(x => x.GetSubmissionById(id)).Returns(fakeSubmission); //Act && Assert controller.WithCallTo(x => x.Submission(id)).ShouldRenderDefaultView(); }