Пример #1
0
 public int Create(Photos photo)
 {
     using (var service = new PhotoController())
     {
         return(service.Create(photo));
     }
 }
Пример #2
0
 public int CreatePhoto(PhotoModel photo)
 {
     using (var service = new PhotoController())
     {
         return(service.Create(photo.GetData()));
     }
 }
Пример #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);
    }
Пример #4
0
        public void Photo_Create_Default_Should_Pass()
        {
            // Arrange
            var myController = new PhotoController();

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

            // Assert
            Assert.IsNotNull(result);
        }
Пример #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);
        }
Пример #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);
    }