Esempio n. 1
0
        public void PauseSimulationTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();

            target.PauseSimulation();
            Assert.IsFalse(target.m_running);
        }
Esempio n. 2
0
        public void SimulationRunningTest_true()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            bool expected             = target.m_running = true;
            bool actual = target.SimulationRunning;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void SpawnNewTrainTest_nullBlock()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            TrackBlock         block  = null;
            string             name   = "train";

            target.SpawnNewTrain(block, name);
            Assert.AreEqual(0, target.m_trainControllerList.Count);
        }
Esempio n. 4
0
 public void OnSimulationTimerElapsedTest()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     object sender = null;
     ElapsedEventArgs e = null;
     target.m_lastUpdateTime = DateTime.Now;
     target.OnSimulationTimerElapsed(sender, e);
     //Make sure the time updates within the minute
     //Chances of the minute rolling over in the middle of the test are slim
     Assert.AreEqual(DateTime.Now.Minute, target.m_lastUpdateTime.Minute);
 }
Esempio n. 5
0
        public void SetSimulationSpeedTest_upperBound()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            double             scale  = 99;
            bool expected             = true;
            bool actual;

            actual = target.SetSimulationSpeed(scale);
            Assert.AreEqual(expected, actual);
            Assert.AreEqual(scale, target.m_simulationScale);
        }
Esempio n. 6
0
        public void SetSimulationSpeedTest_highBad()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            double             scale  = 100;
            bool expected             = false;
            bool actual;

            actual = target.SetSimulationSpeed(scale);
            Assert.AreEqual(expected, actual);
            Assert.AreNotEqual(scale, target.m_simulationScale);
        }
Esempio n. 7
0
        public void SpawnNewTrainTest_badBlock()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            TrackBlock         block  = new TrackBlock();

            block.Transponder = new Transponder("BLOCK", 0);
            string name = "train";

            target.SpawnNewTrain(block, name);
            Assert.AreEqual(0, target.m_trainControllerList.Count);
        }
Esempio n. 8
0
        public void StartSimulationTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();

            target.StartSimulation();
            Assert.IsTrue(target.m_running);
            //Make sure the time updates within the minute
            //Chances of the minute rolling over in the middle of the test are slim
            Assert.AreEqual(DateTime.Now.Minute, target.m_lastUpdateTime.Minute);
            Assert.IsNotNull(target.m_trackControllerList);
        }
Esempio n. 9
0
        public void OnSimulationTimerElapsedTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            object             sender = null;
            ElapsedEventArgs   e      = null;

            target.m_lastUpdateTime = DateTime.Now;
            target.OnSimulationTimerElapsed(sender, e);
            //Make sure the time updates within the minute
            //Chances of the minute rolling over in the middle of the test are slim
            Assert.AreEqual(DateTime.Now.Minute, target.m_lastUpdateTime.Minute);
        }
Esempio n. 10
0
        public void SimulatorConstructorTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();

            Assert.IsNotNull(target.m_log);
            Assert.IsFalse(target.m_running);
            Assert.AreEqual(1, target.m_simulationScale);
            Assert.IsNotNull(target.m_simulationTimer);
            Assert.IsNotNull(target.m_startingDirections);
            Assert.AreEqual(2, target.m_startingDirections.Count);
            Assert.IsNotNull(target.m_trainControllerList);
        }
Esempio n. 11
0
        public void OnTrainAtStationTest_null()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            ITrainController   train  = new TrainControllerStub();

            target.m_trainControllerList.Add(train);
            string stationName = null;

            target.OnTrainAtStation(null, stationName);

            Assert.AreEqual(1, target.m_trainControllerList.Count);
        }
Esempio n. 12
0
        public void StopSimulationTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();

            target.m_trainControllerList.Add(new TrainControllerStub());
            target.m_trackControllerList = new List <TrackControlLib.Sean.ITrackController>()
            {
                new TrackControllerStub()
            };
            target.StopSimulation();
            Assert.IsFalse(target.m_running);
            Assert.AreEqual(0, target.m_trainControllerList.Count);
            Assert.AreEqual(0, target.m_trackControllerList.Count);
        }
Esempio n. 13
0
 public void PauseSimulationTest()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     target.PauseSimulation();
     Assert.IsFalse(target.m_running);
 }
Esempio n. 14
0
 public void SetSimulationSpeedTest_upperBound()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     double scale = 99;
     bool expected = true;
     bool actual;
     actual = target.SetSimulationSpeed(scale);
     Assert.AreEqual(expected, actual);
     Assert.AreEqual(scale, target.m_simulationScale);
 }
Esempio n. 15
0
 public void SimulationRunningTest_true()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     bool expected = target.m_running = true;
     bool actual = target.SimulationRunning;
     Assert.AreEqual(expected, actual);
 }
Esempio n. 16
0
        public void SimulatorConstructorTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();

            Assert.IsNotNull(target.m_log);
            Assert.IsFalse(target.m_running);
            Assert.AreEqual(1, target.m_simulationScale);
            Assert.IsNotNull(target.m_simulationTimer);
            Assert.IsNotNull(target.m_startingDirections);
            Assert.AreEqual(2, target.m_startingDirections.Count);
            Assert.IsNotNull(target.m_trainControllerList);
        }
Esempio n. 17
0
 public void SpawnNewTrainTest_nullTransponder()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     TrackBlock block = new TrackBlock();
     block.Transponder = null;
     string name = "train";
     target.SpawnNewTrain(block, name);
     Assert.AreEqual(0, target.m_trainControllerList.Count);
 }
Esempio n. 18
0
 public void StartSimulationTest()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     target.StartSimulation();
     Assert.IsTrue(target.m_running);
     //Make sure the time updates within the minute
     //Chances of the minute rolling over in the middle of the test are slim
     Assert.AreEqual(DateTime.Now.Minute, target.m_lastUpdateTime.Minute);
     Assert.IsNotNull(target.m_trackControllerList);
 }
Esempio n. 19
0
 public void StopSimulationTest()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     target.m_trainControllerList.Add(new TrainControllerStub());
     target.m_trackControllerList = new List<TrackControlLib.Sean.ITrackController>(){new TrackControllerStub()};
     target.StopSimulation();
     Assert.IsFalse(target.m_running);
     Assert.AreEqual(0, target.m_trainControllerList.Count);
     Assert.AreEqual(0, target.m_trackControllerList.Count);
 }
Esempio n. 20
0
        public void OnTrainAtStationTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();
            ITrainController train = new TrainControllerStub();
            target.m_trainControllerList.Add(train);
            string stationName = "YARD";
            target.OnTrainAtStation(train, stationName);

            Assert.AreEqual(0, target.m_trainControllerList.Count);
        }
Esempio n. 21
0
 public void SetSimulationSpeedTest_lowBad()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     double scale = 0;
     bool expected = false;
     bool actual;
     actual = target.SetSimulationSpeed(scale);
     Assert.AreEqual(expected, actual);
     Assert.AreNotEqual(scale, target.m_simulationScale);
 }