public void CreateNewPhoto() { // arrange var mockUserRep = new Mock <IUserRepository>(); var mockPhotoRep = new Mock <IPhotoRepository>(); var mockLogger = new Mock <INRAKOLogger>(); var mockS3Amazon = new Mock <AmazonS3Tools>(); var mockMutation = new Mock <IMutationActionFactorySelector>(); CreatePhotoViewModel photoVM = new CreatePhotoViewModel() { Description = "Test", DoConversion = false, DoResize = false, HashtagsString = "Test", OriginalImageExtension = "png" }; mockUserRep.Setup(x => x.GetUser(null)).Returns((NRAKOUser)null); mockLogger.Setup(x => x.Log(null, null)); mockPhotoRep.Setup(x => x.SavePhoto(photoVM, null)).Returns(new Photo { Size = 0, Width = 0, Height = 0 }); var controller = new PhotosController(mockUserRep.Object, mockPhotoRep.Object, mockLogger.Object, mockS3Amazon.Object, mockMutation.Object); // act var result = controller.CreateNewPhoto(photoVM); // assert var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result); Assert.Equal("Index", redirectToActionResult.ActionName); Assert.Null(redirectToActionResult.ControllerName); }