public async Task <IActionResult> Get(long apprenticeshipId) { var query = new GetApprenticeshipQuery(apprenticeshipId); var result = await _mediator.Send(query); if (result == null) { return(NotFound()); } var response = await _modelMapper.Map <GetApprenticeshipResponse>(result); return(Ok(response)); }
public GetApprenticeshipHandlerTestsFixture() { _autoFixture = new Fixture(); AccountLegalEntityId = _autoFixture.Create <long>(); AuthenticationService = new Mock <IAuthenticationService>(); AuthenticationService.Setup(x => x.GetUserParty()).Returns(Party.Employer); _db = new ProviderCommitmentsDbContext(new DbContextOptionsBuilder <ProviderCommitmentsDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options); SeedData(); _query = new GetApprenticeshipQuery(ApprenticeshipId); _handler = new GetApprenticeshipQueryHandler(new Lazy <ProviderCommitmentsDbContext>(() => _db), AuthenticationService.Object); }