public async void GetReadStatusByIdAsync_ReturnsAsyncNotFound() { var serviceMock = new Mock <IHistoricalCrudService <Guid, TestEntity> >(); serviceMock.Setup(_ => _.GetReadStatusByIdAsync(It.IsAny <Guid>())).ThrowsAsync(new EntityNotFoundException()); var controller = new HistoricalCrudController <Guid, TestEntity>(null, serviceMock.Object); var actionResult = await controller.GetReadStatusById(_entity.Id); Assert.IsType <NotFoundResult>(actionResult.Result); serviceMock.Verify(_ => _.GetReadStatusByIdAsync(It.IsAny <Guid>()), Times.Once); }
public async void GetReadStatusByIdAsync_ReturnsAsyncOk() { var serviceMock = new Mock <IHistoricalCrudService <Guid, TestEntity> >(); serviceMock.Setup(_ => _.GetReadStatusByIdAsync(It.IsAny <Guid>())).ReturnsAsync(_status); var controller = new HistoricalCrudController <Guid, TestEntity>(null, serviceMock.Object); var actionResult = await controller.GetReadStatusById(_entity.Id); Assert.IsType <ActionResult <ReadeableStatus <TestEntity> > >(actionResult); serviceMock.Verify(_ => _.GetReadStatusByIdAsync(It.IsAny <Guid>()), Times.Once); }