예제 #1
0
        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));
        }
예제 #2
0
            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);
            }