Пример #1
0
        public async Task GetComparison_ExistingEntry_ShouldCompare()
        {
            _diffService.GetDiffResult(TestConstants.DiffId).Returns(new DiffResult {
                Type = DiffResultType.SizeMismatch
            });

            IActionResult result = await _controller.GetComparisonResultAsync(TestConstants.DiffId);

            await _diffService.Received().GetDiffResult(TestConstants.DiffId);

            Assert.IsType <OkObjectResult>(result);
        }
Пример #2
0
        public async Task <IActionResult> GetComparisonResultAsync([FromRoute] int diffId)
        {
            DiffResult result = await _diffService.GetDiffResult(diffId);

            // Assumption: Returning information whether one of the compared data items is missing.
            return(result.Type == DiffResultType.EntryDoesNotExists ?
                   (IActionResult)NotFound() :
                   Ok(result));
        }