public void ToyPlaneWindUp() { //Arrange test = new ToyPlane(); //Act string beforeWindUp = test.getWindUpString(); test.WindUp(); string afterWindUp = test.getWindUpString(); //Assert Assert.AreEqual(beforeWindUp, $"{test.ToString()} string is not wound up."); Assert.AreEqual(afterWindUp, $"{test.ToString()} string is wound up."); }
public void ToyPlaneAboutTest() { // Toy Plane instance to be tested ToyPlane tp = new ToyPlane(); Assert.AreEqual(tp.About(), $"This {tp.ToString()} has a max altitude of 41000 ft. \nIt's current altitude is 0 ft. \nThis{tp.Engine.ToString()}'s engine is not started."); }
public void ToyPlaneStartEngine() { //Arrange test = new ToyPlane(); //Act test.StartEngine(); string engineNoWindup = test.About(); test.WindUp(); test.StartEngine(); string engineWindup = test.About(); //Assert Assert.AreEqual(engineNoWindup, $"This {test.ToString()} has a max altitude of 50 ft.\nIt's current altitude is 0 ft.\n{test.Engine.ToString()} is not started."); Assert.AreEqual(engineWindup, $"This {test.ToString()} has a max altitude of 50 ft.\nIt's current altitude is 0 ft.\n{test.Engine.ToString()} is started."); }
public void ToyPlaneAbout() { //Arrange ToyPlane tp = this.ToyPlane; //Act // Nothing to act on here. //Assert Assert.AreEqual(tp.About(), $"This {tp.ToString()} has a max altitude of 50 ft.\nIts current altitude is 0 ft.\n{tp.ToString()} is not wound up.\n{tp.Engine.ToString()} is not started."); }
public void ToyPlaneMaxAltitude() { //Arrange test = new ToyPlane(); //Act string about = test.About(); //Assert Assert.AreEqual(about, $"This {test.ToString()} has a max altitude of 50 ft.\nIt's current altitude is 0 ft.\n{test.Engine.ToString()} is not started."); }
public void ToyPlaneTakeOff() { //Arrange ToyPlane tp = this.ToyPlane; //act string firstTakeoff = tp.TakeOff(); bool windUpStatusBeforeStart = tp.IsWoundUp; bool engineBeforeStart = tp.Engine.IsStarted; tp.WindUp(); tp.StartEngine(); string secondTakeOff = tp.TakeOff(); //Assert Assert.AreEqual(firstTakeoff, tp.ToString() + " can't fly, its engine is not started."); Assert.AreEqual(secondTakeOff, tp.ToString() + " is flying."); Assert.AreEqual(windUpStatusBeforeStart, false); Assert.AreEqual(engineBeforeStart, false); Assert.AreEqual(tp.Engine.IsStarted, true); }
public void TestToyPlane() { // Arrange toy = new ToyPlane(); // Act string initialAbout = toy.About(); int planeGroundHeight = toy.currentAltitude; // 0 ft bool planePreWindUp = toy.isWoundUp; // Test before winding up or starting engine toy.FlyUp(); int planeHeightPreStartUp = toy.currentAltitude; // 0 ft toy.FlyDown(); int planeHeightPreStartDown = toy.currentAltitude; // 0 ft bool EngineStatusPreStart = toy.engine.isStarted; string TakeoffPreStart = toy.TakeOff(); // Test after winding up but before starting engine toy.WindUp(); bool planePostWindUp = toy.isWoundUp; toy.FlyUp(); int planeHeightPreWindUp = toy.currentAltitude; toy.FlyDown(); int planeHeightPreWindDown = toy.currentAltitude; // Test after starting engine but before taking off toy.StartEngine(); bool EngineStatusPostStart = toy.engine.isStarted; toy.FlyUp(); int planeHeightPreTakeoffUp = toy.currentAltitude; // 0 ft toy.FlyDown(); int planeHeightPreTakeOffDown = toy.currentAltitude; // 0 ft // Test after starting engine and after taking off string confirmTakeOff = toy.TakeOff(); toy.FlyUp(); int planeHeightPostStartUp = toy.currentAltitude; // 10 ft toy.FlyUp(20); int planeHeightPostStartUpX = toy.currentAltitude; // 30 ft toy.FlyUp(50000); int planeHeightPostStartUpMax = toy.currentAltitude; // maxAltitude toy.FlyDown(); int planeHeightPostStartDown = toy.currentAltitude; // maxAltitude - 10 ft string planeFlightAbout = toy.About(); toy.FlyDown(50000); int planeHeightPostStartDownMax = toy.currentAltitude; // same as above toy.FlyDown(15); int planeHeightPostStartDownX = toy.currentAltitude; // maxAltitude - 25 ft toy.StopEngine(); bool EngineStatusPostStop = toy.engine.isStarted; string planeMidflightEngineOff = toy.About(); toy.FlyDown(toy.currentAltitude); bool planeLand = toy.isFlying; // Assert Assert.AreEqual("This " + toy.ToString() + " has a max altitude of " + toy.maxAltitude + " ft.\n" + "It's current altitude is " + "0 ft.\n" + toy.ToString() + "Engine is started = False", initialAbout); Assert.AreEqual(0, planeGroundHeight); Assert.AreEqual(0, planeHeightPreStartUp); Assert.AreEqual(0, planeHeightPreStartDown); Assert.AreEqual(EngineStatusPreStart, false); Assert.AreEqual(toy.ToString() + " cannot fly, its' engine is not started.", TakeoffPreStart); Assert.AreEqual(true, EngineStatusPostStart); Assert.AreEqual(true, planePostWindUp); Assert.AreEqual(0, planeHeightPreWindUp); Assert.AreEqual(0, planeHeightPreWindDown); Assert.AreEqual(0, planeHeightPreTakeoffUp); Assert.AreEqual(0, planeHeightPreTakeOffDown); Assert.AreEqual(toy.ToString() + " is flying.", confirmTakeOff); Assert.AreEqual(10, planeHeightPostStartUp); Assert.AreEqual(30, planeHeightPostStartUpX); Assert.AreEqual(toy.maxAltitude, planeHeightPostStartUpMax); Assert.AreEqual(toy.maxAltitude - 10, planeHeightPostStartDown); Assert.AreEqual("This " + toy.ToString() + " has a max altitude of " + toy.maxAltitude + " ft.\n" + "It's current altitude is " + (toy.maxAltitude - 10) + " ft.\n" + toy.ToString() + "Engine is started = True", planeFlightAbout); Assert.AreEqual(toy.maxAltitude - 10, planeHeightPostStartDownMax); Assert.AreEqual(toy.maxAltitude - 25, planeHeightPostStartDownX); Assert.AreEqual(false, EngineStatusPostStop); Assert.AreEqual("This " + toy.ToString() + " has a max altitude of " + toy.maxAltitude + " ft.\n" + "It's current altitude is " + (toy.maxAltitude - 25) + " ft.\n" + toy.ToString() + "Engine is started = False", planeMidflightEngineOff); Assert.AreEqual(false, planeLand); }