public int Create(Photos photo) { using (var service = new PhotoController()) { return(service.Create(photo)); } }
public int CreatePhoto(PhotoModel photo) { using (var service = new PhotoController()) { return(service.Create(photo.GetData())); } }
public void Test_Create() { var contextMock = new Mock <IPhotoSharingContext>(); var controller = new PhotoController(contextMock.Object); var result = controller.Create() as ViewResult; Assert.AreEqual("Create", result.ViewName); }
public void Photo_Create_Default_Should_Pass() { // Arrange var myController = new PhotoController(); // Act var result = myController.Create(); // Assert Assert.IsNotNull(result); }
public void Photo_Create_Post_Default_Should_Pass() { // Arrange var myController = new PhotoController(); var myData = new PhotoModel(); // Act var result = myController.Create(myData); // Reset // Assert Assert.IsNotNull(result); }
public void Photo_Create_Post_Invalid_Model_Should_Send_Back_For_Edit() { // Arrange var controller = new PhotoController(); var data = new PhotoModel(); // Make ModelState Invalid controller.ModelState.AddModelError("test", "test"); // Act var result = controller.Create(data) as RedirectToActionResult; // Assert Assert.AreEqual("Error", result.ActionName); }
public void Test_Create() { var result = controller.Create() as ViewResult; Assert.AreEqual("Create", result.ViewName); }