示例#1
0
        public void PauseSimulationTest()
        {
            Simulator_Accessor target = new Simulator_Accessor();

            target.PauseSimulation();
            Assert.IsFalse(target.m_running);
        }
示例#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);
        }
示例#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);
        }
示例#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);
 }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#13
0
 public void PauseSimulationTest()
 {
     Simulator_Accessor target = new Simulator_Accessor();
     target.PauseSimulation();
     Assert.IsFalse(target.m_running);
 }
示例#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);
 }
示例#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);
 }
示例#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);
        }
示例#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);
 }
示例#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);
 }
示例#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);
 }
示例#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);
        }
示例#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);
 }