예제 #1
0
        public void createStationTest()
        {
            //Arrange
            String name = "Station";
            //Act
            DataStation data = DataStation.createStation(name);

            //Assert
            Assert.AreEqual(data.Name, name);
        }
예제 #2
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);
            }
        }