Exemplo n.º 1
0
        public void CheckCloseStationsCount()
        {
            // Arrange, Act
            var closestStations = UnitTestActionHandler.ExecuteUnitTestFunction(() =>
                                                                                this.locatableStationService.GetClosestStations());

            // Assert
            Assert.AreEqual(closestStations.Count(), 10);
            Assert.AreEqual(closestStations.First().Name, "Uffikon, Kantonsstrasse");
        }
        public void CheckStationIsValid()
        {
            // Arrange, Act
            var stations = UnitTestActionHandler.ExecuteUnitTestFunction(() => this.transportQueryService
                                                                         .GetStations("Uffikon, Kantonsstrasse"));

            // Assert
            Assert.AreEqual(stations.StationList.Count, 1);
            Assert.AreEqual(stations.StationList.Single().Id, "008572991");
        }
Exemplo n.º 3
0
        public void CheckStationsCloseAreValid()
        {
            // Arrange, Act
            var closestStation = UnitTestActionHandler.ExecuteUnitTestFunction(() =>
                                                                               this.locatableStationService.GetClosestStation());

            // Assert
            Assert.AreEqual(closestStation.Name, "Uffikon, Kantonsstrasse");
            Assert.AreEqual(closestStation.Id, "8572991");
            Assert.AreEqual(closestStation.Distance, 124.5);
        }
        public void CheckTypeMappingIsWorking()
        {
            // Arrange
            var connection = UnitTestActionHandler.ExecuteUnitTestFunction(() => this.queryService
                                                                           .GetConnections("Luzern", "Dagmersellen")
                                                                           .ConnectionList.First());

            // Act
            var mappedType = connection.Map <TransportConnection, ListViewItem>();

            // Assert
            Assert.IsNotNull(mappedType);
        }
        public void CheckStationBoardContainsValidEntries()
        {
            // Arrange, Act
            var stationBoard = UnitTestActionHandler.ExecuteUnitTestFunction(() => this.stationBoardQueryService
                                                                             .GetStationBoard("8572991", new DateTime(2017, 5, 22)));

            // Assert
            Assert.IsNotNull(stationBoard);
            Assert.AreEqual(stationBoard.Entries.Count, 20);
            Assert.AreEqual(stationBoard.Station.Name, "Uffikon, Kantonsstrasse");
            Assert.IsTrue(stationBoard.Entries
                          .All(x => x.To == "Sursee, Bahnhof" || x.To == "Dagmersellen, Dorf"));
        }
        public void CheckConnectionBetweenSurseeAndLucerne()
        {
            // Arrange, Act
            var connections = UnitTestActionHandler.ExecuteUnitTestFunction(() => this.queryService.GetConnections(
                                                                                "Sursee",
                                                                                "Luzern",
                                                                                new DateTime(2017, 5, 22),
                                                                                isArrivalTime: false));
            var connection = connections.ConnectionList.First();

            // Assert
            Assert.IsNotNull(connections);
            Assert.AreEqual(connections.ConnectionList.Count(), 4);
            Assert.AreEqual(connection.Duration, "00d00:27:00");
        }
        public void CheckConnectionWithArrivalAndDepartureTime()
        {
            // Arrange, Act
            var arrivalTimeConnections = UnitTestActionHandler.ExecuteUnitTestFunction(() => this.queryService.GetConnections(
                                                                                           "Sursee",
                                                                                           "Luzern",
                                                                                           new DateTime(2017, 5, 22),
                                                                                           isArrivalTime: true));

            var departureTimeConnections = UnitTestActionHandler.ExecuteUnitTestFunction(() => this.queryService.GetConnections(
                                                                                             "Sursee",
                                                                                             "Luzern",
                                                                                             new DateTime(2017, 5, 22),
                                                                                             isArrivalTime: false));

            // Assert
            Assert.IsNotNull(arrivalTimeConnections);
            Assert.IsNotNull(departureTimeConnections);
            Assert.AreEqual(arrivalTimeConnections.ConnectionList.Count(), 4);
            Assert.AreEqual(departureTimeConnections.ConnectionList.Count(), 4);
            Assert.AreNotEqual(
                departureTimeConnections.ConnectionList.First().From.DepartureDateTime,
                arrivalTimeConnections.ConnectionList.First().From.DepartureDateTime);
        }