public void AddFundraisingPageImage_WhenCredentialsValidAndRequestValid_ReturnsSuccessful(WireDataFormat format)
        {
            //arrange
            var client              = TestContext.CreateClientValidCredentials(format);
            var pageClient          = new PageApi(client.HttpChannel);
            var pageCreationRequest = ValidRegisterPageRequest();

            pageClient.Create(pageCreationRequest);
            var validAddImageRequest = ValidAddFundraisingPageImageRequest(pageCreationRequest.PageShortName);

            //act
            var result = pageClient.AddImage(validAddImageRequest);

            //assert
            Assert.IsNotNullOrEmpty(result.Next.Rel);
        }
        public void AddFundraisingPageImage_WhenCredentialsValidAndRequestNotValid_ThrowsException(WireDataFormat format)
        {
            //arrange
            var client              = TestContext.CreateClientValidCredentials(format);
            var pageClient          = new PageApi(client.HttpChannel);
            var pageCreationRequest = ValidRegisterPageRequest();

            pageClient.Create(pageCreationRequest);
            var addImageRequest = new AddFundraisingPageImageRequest {
                Url = "", Caption = "", PageShortName = pageCreationRequest.PageShortName
            };

            //act
            var response = Assert.Throws <ErrorResponseException>(() => pageClient.AddImage(addImageRequest));

            //assert
            Assert.That(response.Response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
        }
        public void DeleteImage_WhileSupportedValidCredentialsAndValidRequest_ReturnTrue(WireDataFormat format)
        {
            //arrange
            var client = TestContext.CreateClientValidCredentials(format);
            var fundraisingResources     = new PageApi(client.HttpChannel);
            var validRegisterPageRequest = ValidRegisterPageRequest();

            fundraisingResources.Create(validRegisterPageRequest);
            var validAddImageRequest = ValidAddFundraisingPageImageRequest(validRegisterPageRequest.PageShortName);

            fundraisingResources.AddImage(validAddImageRequest);
            var images =
                fundraisingResources.GetImages(new GetFundraisingPageImagesRequest
            {
                PageShortName = validRegisterPageRequest.PageShortName
            });
            var image = images.First();

            //act
            var result = fundraisingResources.DeleteImage(validRegisterPageRequest.PageShortName, image.Url);

            //assert
            Assert.IsTrue(result);
        }