Ejemplo n.º 1
0
        public async Task Update()
        {
            // given
            var request = new PageVersionRequest()
            {
                Id       = Guid.NewGuid(),
                Author   = "buxton",
                DateTime = DateTime.Today,
                PageId   = 42,
                Text     = "Some new text"
            };

            var pageVersion = new PageVersion()
            {
                Id       = request.Id,
                Author   = request.Author,
                DateTime = request.DateTime,
                PageId   = request.PageId,
                Text     = request.Text,
            };

            _objectsConverterMock
            .ConvertToPageVersion(request)
            .Returns(pageVersion);

            _pageVersionRepositoryMock
            .UpdateExistingVersionAsync(pageVersion)
            .Returns(Task.CompletedTask);

            // when
            ActionResult <string> actionResult = await _pageVersionsController.Update(request);

            // then
            actionResult.ShouldBeNoContentResult();
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <string> > Update(PageVersionRequest pageVersionRequest)
        {
            // doesn't add a new version
            PageVersion pageVersion = _objectsConverter.ConvertToPageVersion(pageVersionRequest);
            await _pageVersionRepository.UpdateExistingVersionAsync(pageVersion);

            return(NoContent());
        }
 public async Task Update(PageVersionRequest pageVersionRequest)
 {
     PageVersion pageVersion = _objectsConverter.ConvertToPageVersion(pageVersionRequest);
     await _pageVersionRepository.UpdateExistingVersionAsync(pageVersion);
 }