Beispiel #1
0
        public async Task GetOne_EntryNotFound_ReturnsNotFound()
        {
            _service.Setup(s =>
                           s.GetById(It.IsAny <long>()))
            .ReturnsAsync(() => null);

            _controller = new EntriesController(_logger, _service.Object);

            var result = await _controller.GetOne(1L);

            result.Should().BeOfType <NotFoundResult>();
        }
Beispiel #2
0
        public async Task GetOne_EntryFound_ReturnsOk()
        {
            _service.Setup(s =>
                           s.GetById(It.IsAny <long>()))
            .ReturnsAsync(new EntryDto {
                Title = "Entry"
            });

            _controller = new EntriesController(_logger, _service.Object);

            var result = await _controller.GetOne(1L);

            result.Should().BeOfType <OkObjectResult>();
        }