Esempio n. 1
0
        public AddFundraisingPageImageConfirmation AddImage(AddFundraisingPageImageRequest request)
        {
            var locationFormat = FundraisingPageImagesLocationFormat(request.PageShortName);

            return
                (HttpChannel.PerformRequest
                 <AddFundraisingPageImageRequest, AddFundraisingPageImageConfirmation>("PUT", locationFormat, request));
        }
        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 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));
        }
Esempio n. 4
0
 public void AddImageAsync(AddFundraisingPageImageRequest request, Action<AddFundraisingPageImageConfirmation> callback)
 {
     var locationFormat = FundraisingPageImagesLocationFormat(request.PageShortName);
     HttpChannel.PerformRequestAsync("PUT", locationFormat, request, callback);
 }
Esempio n. 5
0
 public AddFundraisingPageImageConfirmation AddImage(AddFundraisingPageImageRequest request)
 {
     var locationFormat = FundraisingPageImagesLocationFormat(request.PageShortName);
     return
         HttpChannel.PerformRequest
             <AddFundraisingPageImageRequest, AddFundraisingPageImageConfirmation>("PUT", locationFormat, request);
 }
Esempio n. 6
0
        public void AddImageAsync(AddFundraisingPageImageRequest request, Action <AddFundraisingPageImageConfirmation> callback)
        {
            var locationFormat = FundraisingPageImagesLocationFormat(request.PageShortName);

            HttpChannel.PerformRequestAsync("PUT", locationFormat, request, callback);
        }
		public void AddFundraisingPageImage_WhenCredentialsValidAndRequestValid_ReturnsSuccessful(WireDataFormat format)
        {
            var client = TestContext.CreateClientValidCredentials(format);
			var pageClient = new PageApi(client.HttpChannel);

            // Create Page
            var pageShortName = "api-test-" + Guid.NewGuid();
            var pageCreationRequest = new RegisterPageRequest
            {
                ActivityType = ActivityType.OtherCelebration,
                PageShortName = pageShortName,
                PageTitle = "Page Created For Update Story Integration Test",
                EventName = "Story Update Testing",
                CharityId = 2050,
                TargetAmount = 20M,
                EventDate = DateTime.Now.AddDays(5)
            };
            pageClient.Create(pageCreationRequest);

            var addImageRequest = new AddFundraisingPageImageRequest { Url = "http://placehold.it/350x150", Caption = "test image", PageShortName = pageCreationRequest.PageShortName };
            pageClient.AddImage(addImageRequest);
        }
		//[Ignore("Not yet live")]
        public void AddFundraisingPageImage_WhenCredentialsValidAndRequestNotValid_ThrowsException(WireDataFormat format)
        {
            var client = TestContext.CreateClientValidCredentials(format);
			var pageClient = new PageApi(client.HttpChannel);

            // Create Page
            var pageShortName = "api-test-" + Guid.NewGuid();
            var pageCreationRequest = new RegisterPageRequest
            {
                ActivityType = ActivityType.OtherCelebration,
                PageShortName = pageShortName,
                PageTitle = "Page Created For Update Story Integration Test",
                EventName = "Story Update Testing",
                CharityId = 2050,
                TargetAmount = 20M,
                EventDate = DateTime.Now.AddDays(5)
            };

            pageClient.Create(pageCreationRequest);

            var addImageRequest = new AddFundraisingPageImageRequest {Url = "", Caption = "", PageShortName=pageCreationRequest.PageShortName};
            var response = Assert.Throws<ErrorResponseException>(()=>pageClient.AddImage(addImageRequest));
            Assert.That(response.Response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
        }