public void PauseSimulationTest() { Simulator_Accessor target = new Simulator_Accessor(); target.PauseSimulation(); Assert.IsFalse(target.m_running); }
public void SimulationRunningTest_true() { Simulator_Accessor target = new Simulator_Accessor(); bool expected = target.m_running = true; bool actual = target.SimulationRunning; Assert.AreEqual(expected, actual); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }