Пример #1
0
        public void AddFundraisingPageVideo_WhenCredentialsValidAndRequestValid_ReturnsSuccessful(WireDataFormat format)
        {
            //arrange
            var client = TestContext.CreateClientValidCredentials(format);
            var pageClient = new PageApi(client.HttpChannel);
            var pageCreationRequest = ValidRegisterPageRequest();
            pageClient.Create(pageCreationRequest);
            var addVideoRequest = new AddFundraisingPageVideoRequest { Url = "http://www.youtube.com/watch?v=MSxjbF18BBM", Caption = "neckbrace", PageShortName = pageCreationRequest.PageShortName };

            //act
            var result = pageClient.AddVideo(addVideoRequest);

            //assert
            Assert.IsNotNullOrEmpty(result.Next.Rel);
        }
Пример #2
0
        public void AddFundraisingPageVideo_WhenCredentialsValidAndRequestNotValid_ThrowsException(WireDataFormat format)
        {
            //arrange
            var client = TestContext.CreateClientValidCredentials(format);
            var pageClient = new PageApi(client.HttpChannel);
            var pageCreationRequest = ValidRegisterPageRequest();
            pageClient.Create(pageCreationRequest);
            var addVideoRequest = new AddFundraisingPageVideoRequest { Url = "", Caption = "", PageShortName = pageCreationRequest.PageShortName };

            //act
            var response = Assert.Throws<ErrorResponseException>(() => pageClient.AddVideo(addVideoRequest));

            //arrange
            Assert.That(response.Response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
        }
Пример #3
0
 public void AddVideoAsync(AddFundraisingPageVideoRequest request, Action<AddFundraisingPageVideoConfirmation> callback)
 {
     var locationFormat = FundraisingPageVideosLocationFormat(request.PageShortName);
     HttpChannel.PerformRequestAsync("PUT", locationFormat, request, callback);
 }
Пример #4
0
 public AddFundraisingPageVideoConfirmation AddVideo(AddFundraisingPageVideoRequest request)
 {
     var locationFormat = FundraisingPageVideosLocationFormat(request.PageShortName);
     return
         HttpChannel.PerformRequest
             <AddFundraisingPageVideoRequest, AddFundraisingPageVideoConfirmation>("PUT", locationFormat, request);
 }
		public void AddFundraisingPageVideo_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 addVideoRequest = new AddFundraisingPageVideoRequest { Url = "http://www.youtube.com/watch?v=MSxjbF18BBM", Caption = "neckbrace", PageShortName = pageCreationRequest.PageShortName };
            pageClient.AddVideo(addVideoRequest);
        }
		public void AddFundraisingPageVideo_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 addVideoRequest = new AddFundraisingPageVideoRequest { Url = "", Caption = "", PageShortName = pageCreationRequest.PageShortName };
            var response = Assert.Throws<ErrorResponseException>(() => pageClient.AddVideo(addVideoRequest));
            Assert.That(response.Response.StatusCode, Is.EqualTo(HttpStatusCode.BadRequest));
        }