Ejemplo n.º 1
0
 public int Create(Photos photo)
 {
     using (var service = new PhotoController())
     {
         return(service.Create(photo));
     }
 }
Ejemplo n.º 2
0
 public int CreatePhoto(PhotoModel photo)
 {
     using (var service = new PhotoController())
     {
         return(service.Create(photo.GetData()));
     }
 }
Ejemplo n.º 3
0
    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);
    }
Ejemplo n.º 4
0
        public void Photo_Create_Default_Should_Pass()
        {
            // Arrange
            var myController = new PhotoController();

            // Act
            var result = myController.Create();

            // Assert
            Assert.IsNotNull(result);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        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);
    }