public void TestGetRoute() { var useCase = new GetRouteListUseCase(CreateRoteRepository(CreateTransportOrganizationRepository())); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetRouteListUseCaseRequest.CreateRouteRequest(2), outputPort).Result); Assert.Single(outputPort.Routes, r => 2 == r.Id); }
public void TestTryGetNotExistingRoute() { var useCase = new GetRouteListUseCase(CreateRoteRepository(CreateTransportOrganizationRepository())); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetRouteListUseCaseRequest.CreateRouteRequest(999), outputPort).Result); Assert.Empty(outputPort.Routes); }
public void TestGetAllRoutesFromEmptyRepository() { var useCase = new GetRouteListUseCase(new InMemoryRouteRepository()); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetRouteListUseCaseRequest.CreateAllRoutesRequest(), outputPort).Result); Assert.Empty(outputPort.Routes); }
public void TestGetOrganizationRoutes() { var useCase = new GetRouteListUseCase(CreateRoteRepository(CreateTransportOrganizationRepository())); var outputPort = new OutputPort(); Assert.True(useCase.Handle(GetRouteListUseCaseRequest.CreateOrganizationRoutesRequest(1), outputPort).Result); Assert.Equal <int>(2, outputPort.Routes.Count()); Assert.Equal(new long[] { 3, 4 }, outputPort.Routes.Select(r => r.Id)); }