Exemple #1
0
        public void UpdateTimes()
        {
            // Arrange
            string    navas = "navas";
            TimeTable tt    = TablesBLL.ModelWithToken(navas, "http://busmon.westeurope.cloudapp.azure.com/csv/buses.csv");
            EMTClient emt   = new EMTClient(); // buses

            // act

            tt.Stops.SafeForEach(stop => {
                string[] lines = tt.LinesByStop(stop);
                //List<BusLine> times = emt.TimeArrivalBus( stop , lines , tt.EMTToken );
                List <BusLine> times = new List <BusLine>()
                {
                    new BusLine()
                    {
                        Stop = "878", Line = "39", Seconds = 608
                    }
                };
                tt.UpdateTimes(times);

                int x = 0;
            });

            //EMTClient cli = new EMTClient();
            //cli.TimeArrivalBus(  )

            // Assert
            Assert.AreEqual(tt.Lines[2].Seconds, 608);
        }
Exemple #2
0
        public static TimeTable ModelWithToken(string cat, string root_url)
        {
            TimeTable model = ReadCSV(cat, root_url);

            EMTClient cli = new EMTClient();

            model.EMTToken = cli.Login("*****@*****.**", "*****@*****.**");

            return(model);
        }
Exemple #3
0
        public static TimeTable ArrivalTimes(string category, string token, string root_url)
        {
            TimeTable model = ReadCSV(category, root_url);

            model.EMTToken = token;
            model.Category = category;

            EMTClient   emt = new EMTClient();   // buses
            AEMETClient met = new AEMETClient(); // weather

            model.Stops.SafeForEach(stop => {
                string[] lines       = model.LinesByStop(stop);
                List <BusLine> times = emt.TimeArrivalBus(stop, lines, model.EMTToken);
                model.UpdateTimes(times);
            });

            model.Temp = met.ReadTemp().ToString();

            return(model);
        }