public async Task <ActionResult> GetInstitute(long instituteID) { var presenter = new InstituteListPresenter(); await _getInstituteListUseCase.Handle(GetInstituteListUseCaseRequest.CreateInstituteRequest(instituteID), presenter); return(presenter.ContentResult); }
public void TestTryGetNotExistingInstitute() { var useCase = new GetInstituteListUseCase(CreateRoteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetInstituteListUseCaseRequest.CreateInstituteRequest(999), outputPort).Result); Assert.Empty(outputPort.Institute); }
public void TestGetAllInstituteFromEmptyRepository() { var useCase = new GetInstituteListUseCase(new InMemoryInstituteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetInstituteListUseCaseRequest.CreateAllInstitutesRequest(), outputPort).Result); Assert.Empty(outputPort.Institute); }
public void TestGetInstitute() { var useCase = new GetInstituteListUseCase(CreateRoteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetInstituteListUseCaseRequest.CreateInstituteRequest(2), outputPort).Result); Assert.Single(outputPort.Institute, r => 2 == r.Id); }
public void TestGetAllInstitutes() { var useCase = new GetInstituteListUseCase(CreateRoteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetInstituteListUseCaseRequest.CreateAllInstitutesRequest(), outputPort).Result); Assert.Equal <int>(4, outputPort.Institute.Count()); Assert.Equal(new long[] { 1, 2, 3, 4 }, outputPort.Institute.Select(o => o.Id)); }