public void  simulation(DataStation station)
 {
     while (true)
     {
         Thread.Sleep(1500);
         station.simulateTemp(this.MaxHeat);
     }
 }
Exemplo n.º 2
0
        public void createStationTest()
        {
            //Arrange
            String name = "Station";
            //Act
            DataStation data = DataStation.createStation(name);

            //Assert
            Assert.AreEqual(data.Name, name);
        }
Exemplo n.º 3
0
        public void GetStationTest()
        {
            //Arrange
            int count = 10;
            //Act
            List <DataStation> dataStations = DataStation.GetStations(10);

            //Assert
            Assert.AreEqual(dataStations.Count, count);
        }
Exemplo n.º 4
0
        private ObservableCollection <DataStation> ConvertInObsCollection(Dictionary <String, List <Ligne> > dicoLignes)
        {
            ObservableCollection <DataStation> listLignesProx = new ObservableCollection <DataStation>();

            foreach (KeyValuePair <String, List <Ligne> > kvp in dicoLignes)
            {
                DataStation data = new DataStation(kvp.Key, kvp.Value);
                listLignesProx.Add(data);
            }
            return(listLignesProx);
        }
 public StationManager()
 {
     this.MaxHeat  = 35;
     this.stations = DataStation.GetStations(10);
     ///Taska
     foreach (DataStation station in stations)
     {
         Console.WriteLine(station.ToString());
         Thread tempThread = new Thread(() => simulation(station));
         threads.Add(tempThread);
         tempThread.Start();
     }
 }
Exemplo n.º 6
0
        public void simulateTempTest()
        {
            //Arrange
            int         maxTemp1     = 30;
            int         maxTemp2     = 15;
            DataStation dataStation1 = DataStation.createStation("testName1");
            DataStation dataStation2 = DataStation.createStation("testName2");
            var         excpected1   = dataStation1.TargetTemp;
            var         excpected2   = maxTemp2;

            //Act

            dataStation1.simulateTemp(maxTemp1);
            dataStation2.simulateTemp(maxTemp2);
            //Assert
            Assert.AreEqual(maxTemp2, excpected2);
            Assert.AreEqual(dataStation1.TargetTemp, excpected1);
        }
        public override void AddStation(string name)
        {
            bool was = false;

            foreach (DataStation station in Stations)
            {
                if (name == station.Name)
                {
                    was = true;
                }
            }
            if (!was)
            {
                DataStation dataStation = DataStation.createStation(name);
                Thread      tempThread  = new Thread(() => simulation(dataStation));
                threads.Add(tempThread);
                tempThread.Start();
                stations.Add(dataStation);
            }
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            DataStation.SetDataReporter("TestReporter");
            //DataStation.SetDataListener("TestGetter");
            DataStation.SetDataListener("ElasticSearchListener");

            try
            {
                Logger.Info("Start ====================== ");
                DataStation.Start(31000);
                Console.Read();
                DataStation.Stop();
                Logger.Info("========================= End");
            }
            catch (Exception e)
            {
                Logger.Error(e, "Main:");
                DataStation.Stop();
            }

            Console.Read();
        }