public void Slides_Slides_Tests()
        {
            try
            {
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", Utils.CloudStorage_Output_Folder + "/slide-sample.pptx");
                SlidesResponse slidesResponse = slidesService.Slides.ReadPresentationSlidesInfo("slide-sample.pptx", Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.AddEmptySlideToTheEndOfPresentation("slide-sample.pptx", Utils.CloudStorage_Output_Folder);
                slidesService.Slides.AddCopyOfSlideToTheEndOfPresentation("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.AddEmptySlideToSpecifiedPosition("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.AddCopyOfSlideToSpecifiedPosition("slide-sample.pptx", 1, 2, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.ChangeSlidePosition("slide-sample.pptx", 1, 2, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.AddCopyOfSlideFromAnotherPresentaion("slide-sample.pptx", 1, Utils.CloudStorage_Input_Folder + "/slide-sample.pptx", 2, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                SlideResponse slideResponse = slidesService.Slides.ReadSlideInfo("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.ConvertSlideToSomeFormat("slide-sample.pptx", 1, SlidesImageFormat.Tiff, Utils.CloudStorage_Output_Folder, Utils.Local_Output_Path + "slide-out.tiff");
                System.Threading.Thread.Sleep(3000); // Just for testing
                SlidesBackgroundResponse slidesBackgroundResponse = slidesService.Slides.ReadPresentationSlideBackgroundColorType("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);

                //slidesService.Slides.SetPresentationSlideBackgroundColor("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder, "black");
                slidesService.Slides.RemovePresentationSlideBackgroundColor("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                SlidesCommentsResponse slidesCommentsResponse = slidesService.Slides.ReadPresentationSlideComments("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                slidesService.Slides.DeletePresentationSlideByItsIndex("slide-sample.pptx", 1, Utils.CloudStorage_Output_Folder);
                System.Threading.Thread.Sleep(3000); // Just for testing
                slidesService.Slides.DeletePresentationSlides("slide-sample.pptx", Utils.CloudStorage_Output_Folder);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public async Task GivenSlideExistsQueryHandlerReturnsSlide()
        {
            const int    slideId      = 1;
            const string slideName    = "slideName";
            const string slideContent = "slideContent";

            var slide = new Slide
            {
                Id      = slideId,
                Name    = slideName,
                Content = slideContent
            };

            _mockSlideReader.GetSlideAsync(Arg.Is(slideId))
            .Returns(slide);

            var expectedResult = new SlideResponse
            {
                Id      = slideId,
                Name    = slideName,
                Content = slideContent
            };

            var request = new GetSlideByIdQuery(slideId);

            var handler = CreateHandler();

            var actualResult = await handler.Handle(request, new CancellationToken());

            actualResult.Should().BeEquivalentTo(expectedResult);
        }
Ejemplo n.º 3
0
        public async Task GivenProperCreateSlideCommandHandlerSuccessfullyCreatesSlide()
        {
            const int    slideId      = 1;
            const string slideName    = "slideName";
            const string slideContent = "slideContent";

            var command = new CreateSlideCommand
            {
                Name    = slideName,
                Content = slideContent
            };

            var expectedResult = new SlideResponse
            {
                Id = slideId
            };

            var createdSlide = new Slide
            {
                Id      = slideId,
                Name    = slideName,
                Content = slideContent
            };

            _mockSlideWriter.CreateSlideAsync(Arg.Is(slideName), Arg.Is(slideContent))
            .Returns(createdSlide);

            var handler = CreateHandler();

            var actualResult = await handler.Handle(command, new CancellationToken());

            actualResult.Should().BeEquivalentTo(expectedResult);
        }
        public void deleteNotesSlideExample()
        {
            SlideResponse response = null;

            try
            {
                DeleteNotesSlideRequest request = createDeleteNotesSlideRequest();
                response = api.DeleteNotesSlide(request);
                Console.WriteLine(response);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 5
0
        private CollisionResponse(ICollision col, CollisionResponses response)
        {
            switch (response)
            {
            case CollisionResponses.Touch: child = new TouchResponse(col); break;

            case CollisionResponses.Cross: child = new CrossResponse(col); break;

            case CollisionResponses.Slide: child = new SlideResponse(col); break;

            case CollisionResponses.Bounce: child = new BounceResponse(col); break;

            default: throw new ArgumentException("Unsupported collision type");
            }
        }
Ejemplo n.º 6
0
        public async Task GivenValidCreateCommandCreateSlideCreatesSlideSuccessfully()
        {
            // Arrange
            const string slideName    = "slideName";
            const string slideContent = "slideContent";
            const string endpoint     = "api/v1/slides/";

            const int expectedId = 2;

            var command = new CreateSlideCommand
            {
                Name    = slideName,
                Content = slideContent
            };

            var expectedResult = new SlideResponse
            {
                Id      = expectedId,
                Name    = slideName,
                Content = slideContent
            };

            var client = _factory.CreateClient();

            var expectedLocation = client.BaseAddress + endpoint + expectedId;

            var json           = JsonConvert.SerializeObject(command);
            var requestContent = new StringContent(json, Encoding.UTF8, MediaTypeNames.Application.Json);

            // Act
            var response = await client.PostAsync(endpoint, requestContent);

            // Assert
            response.StatusCode.Should().Be((int)HttpStatusCode.Created);
            response.Headers.Location.AbsoluteUri.Should().BeEquivalentTo(expectedLocation);

            var responseBody = await response.Content.ReadAsStringAsync();

            responseBody.Should().NotBeNullOrEmpty();

            var slideResponse = JsonConvert.DeserializeObject <SlideResponse>(responseBody);

            slideResponse.Should().BeEquivalentTo(expectedResult);
        }
Ejemplo n.º 7
0
        public async Task GivenValidDeleteSlideRequestHandlerReportsSuccessfulDeletion()
        {
            const int slideId = 1;

            _mockSlideWriter.DeleteSlideAsync(Arg.Is(slideId))
            .Returns(true);

            var expectedResult = new SlideResponse
            {
                Id = slideId
            };

            var handler = CreateHandler();

            var command = new DeleteSlideCommand(slideId);

            var actualResult = await handler.Handle(command, new CancellationToken());

            actualResult.Should().BeEquivalentTo(expectedResult);
        }
Ejemplo n.º 8
0
        public void DeleteNotesSlideInvalidName()
        {
            InvalidPropertyTestExecutor <DeleteNotesSlideRequest, SlideResponse> testExecutor =
                new InvalidPropertyTestExecutor <DeleteNotesSlideRequest, SlideResponse>("DeleteNotesSlide", "Name");
            DeleteNotesSlideRequest request  = testExecutor.PrepareRequest();
            SlideResponse           response = null;
            bool needAssertResponse          = false;

            try
            {
                response           = m_instance.DeleteNotesSlide(request);
                needAssertResponse = true;
            }
            catch (Exception ex)
            {
                testExecutor.AssertException(ex);
            }
            if (needAssertResponse)
            {
                testExecutor.AssertResult(response);
            }
        }
Ejemplo n.º 9
0
        public async Task GivenSlideWithIdExistsGetSlideReturnsExpectedSlide()
        {
            // Arrange
            var expectedResult = new SlideResponse
            {
                Id      = 1,
                Name    = "Sample",
                Content = "<h1>My Sample Slide</h1><p>This is a sample slide containing some simple html as an example of what type of content a slide could have.</p>"
            };

            var client = _factory.CreateClient();

            // Act
            var response = await client.GetAsync("/api/v1/slides/1");

            // Assert
            response.StatusCode.Should().Be((int)HttpStatusCode.OK);
            var responseBody = await response.Content.ReadAsStringAsync();

            var slideResponse = JsonConvert.DeserializeObject <SlideResponse>(responseBody);

            slideResponse.Should().BeEquivalentTo(expectedResult);
        }