コード例 #1
0
        public void GetRailQueryJason()
        {
           //Arrange
            var route = new Route(){FromStation = _stoneleigh};
            var networkRailRetriever = new NationalRailQuery(route);
            //Assert
            networkRailRetriever.CompletedAsynchCall += () =>
                                                            {
                                                                try
                                                                {
                                                                    Assert.IsTrue(
                                                                    networkRailRetriever.RetrievedScheduleSuccessfully,
                                                                    "Failed to retrieve JSON from Uri");
                                                                    Assert.IsTrue(networkRailRetriever.StationQueryDetails.Trains.Count > 0, "Invalid data returned for Stoneleigh station from network rail");
                                                                    Assert.IsTrue(networkRailRetriever.StationQueryDetails.QueryStation == _stoneleigh, "Invalid query station returned");
                                                                }
                                                                finally
                                                                {
                                                                    EnqueueTestComplete();
                                                                }
                                                            };
            //Act
            networkRailRetriever.UpdateScheduleData();

        }
コード例 #2
0
            public void ThrowErrorOnInvalidStationInputNotOnList()
            {
                //Arrange
                var invalidStation = new Station(){Name = "Test", Code = "Test"};
                //Act
                var nationalRailQuery = new NationalRailQuery(invalidStation, null);

            }
コード例 #3
0
            public void ThrowErrorOnInvalidStationInputGreaterThan3Chars()
            {
                //Arrange
                const string invalidStation = "$%$123";
                NationalRailQuery.Stations.First().Code = invalidStation;
                //Act
                var nationalRailQuery = new NationalRailQuery(_stoneleigh, null);
                NationalRailQuery.Stations.First().Code = invalidStation;

            }
コード例 #4
0
 public void ParseJsonReponseAndCreateTimeTable()
 {
     //Arrange
     var query = new NationalRailQuery();
     //Act
     query.BuildTimeTableData(_jsonData);
     //Assert
     Assert.IsNotNull(query.StationQueryDetails, "Time Table not created correctly");
     Assert.IsTrue(query.StationQueryDetails.Trains.Count == 17, "Train count from sample data is incorrect");
 }