예제 #1
0
        public async Task Basic_Post_Put_Get_EPub()
        {
            var ePub = new EPub
            {
                Title      = "example0",
                Language   = "en-US",
                Filename   = "filename_example",
                Author     = "author_example",
                Publisher  = "publisher_example",
                SourceId   = "mediaId_example",
                SourceType = ResourceType.Media
            };

            var postResult = await _controller.PostEPub(ePub);

            Assert.IsType <CreatedAtActionResult>(postResult.Result);

            var getResult = await _controller.GetEPub(ePub.Id);

            Assert.Equal(ePub, getResult.Value);

            ePub.Title = "new title";

            var putResult = await _controller.PutEPub(ePub.Id, ePub);

            Assert.IsType <NoContentResult>(putResult);

            getResult = await _controller.GetEPub(ePub.Id);

            Assert.Equal(ePub, getResult.Value);
            Assert.Equal(PublishStatus.Published, getResult.Value.PublishStatus);
            Assert.Equal(Visibility.Visible, getResult.Value.Visibility);
        }
예제 #2
0
        public async Task Basic_Post_Put_Get_EPub()
        {
            var ePub = new EPub
            {
                Title      = "example0",
                Language   = "en-US",
                Filename   = "filename_example",
                Author     = "author_example",
                Publisher  = "publisher_example",
                SourceId   = "mediaId_example",
                SourceType = ResourceType.Media
            };

            var postResult = await _controller.PostEPub(ePub);

            var createdResult = postResult.Result as CreatedAtActionResult;

            Assert.NotNull(createdResult);

            var getResult = await _controller.GetEPub(ePub.Id);

            Assert.NotNull(getResult.Value);
            Assert.Equal(ePub, getResult.Value);

            ePub.Title = "new title";

            var putResult = await _controller.PutEPub(ePub.Id, ePub);

            var noContentResult = putResult as NoContentResult;

            Assert.NotNull(noContentResult);

            getResult = await _controller.GetEPub(ePub.Id);

            Assert.NotNull(getResult.Value);
            Assert.Equal(ePub, getResult.Value);
        }