Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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));
        }