Beispiel #1
0
        public async Task UpdateTransitStateEntryOrExitHandler_CallsUpdateToTransitState_ReturnsTransitStateId()
        {
            var transitState = new TestableTransitState()
            {
                Id      = transitStateId,
                Country = new TestableCountry()
                {
                    Id = countryId
                },
                CompetentAuthority = new TestableCompetentAuthority()
            };
            var transportRoute = new TestableTransportRoute()
            {
                TransitStates = new List <TransitState>()
                {
                    transitState
                }
            };

            A.CallTo(() => transportRouteRepository.GetByNotificationId(notificationId))
            .Returns(transportRoute);

            var result = await handler.HandleAsync(GetRequest(entryPointId, exitPointId));

            Assert.Equal(transitStateId, result);
        }
Beispiel #2
0
        public async Task GetTransitStateWithEntryOrExitDataHandler_HasTransitState_ReturnsData()
        {
            var transitState = new TestableTransitState()
            {
                Id      = transitStateId,
                Country = new TestableCountry()
                {
                    Id = countryId
                }
            };
            var transportRoute = new TestableTransportRoute()
            {
                TransitStates = new List <TransitState>()
                {
                    transitState
                }
            };

            A.CallTo(() => transportRouteRepository.GetByNotificationId(notificationId))
            .Returns(transportRoute);
            A.CallTo(() => mapper.Map <TransitStateData>(transitState))
            .Returns(new TransitStateData()
            {
                Id = transitStateId
            });

            var result = await handler.HandleAsync(GetRequest());

            Assert.Equal(transitStateId, result.TransitState.Id);
            Assert.Equal(EntryExitPoints, result.EntryOrExitPoints.Count());
            Assert.All(result.EntryOrExitPoints, ep => Assert.Equal(countryId, ep.CountryId));
        }