public void TestAirPlaneFlyDownWhileEngineOn() { //Goal here is to make sure: ///1. the plane while the engine is on, won't be able to go lower than 0 feet which is whhat thhe current altitude is. ///2. The plane will fly up 1000ft and then descend 1000ft to make sure it descends properly. //Arrange tp = new ToyPlane(); //Act int originalAltitude = tp.CurrentAltitude; tp.WindUp(); tp.StartEngine(); tp.TakeOff(); tp.FlyDown(50);//by default is 1000ft int attemptToFlyDownWhenOnTheGround = tp.CurrentAltitude; //now will fly up 50ft tp.FlyUp(50); int flownUpFeet = tp.CurrentAltitude; //use to compare with finalDescent to make sure they aren't equal tp.FlyDown(50); int finalDescent = tp.CurrentAltitude; //final descent should be back at 0 ft. and should not equal flownUpFeet //Assert Assert.AreEqual(50, flownUpFeet); //This to make sure flyUp hasn't risen up the plane Assert.AreEqual(0, originalAltitude); //This is to make sure originalAltitude is 0ft Assert.AreEqual(attemptToFlyDownWhenOnTheGround, originalAltitude); //This is to make sure the plane can't go lower than 0 feet which is the originalAltitude Assert.AreNotEqual(finalDescent, flownUpFeet); //This is to make sure the plane has gone up and the valuue is not 0ft Assert.AreEqual(finalDescent, originalAltitude); //This is to make sure the flyDown method works properly because it was at 1000ft(due to flyUP()), and is not at 0ft }
public void ToyPlaneEngine() { //Arrange ToyPlane tp = this.ToyPlane; //Act bool defaultEngine = tp.Engine.IsStarted; //default should be off tp.StartEngine(); bool startedEngineBeforeWind = tp.Engine.IsStarted; // This should still return true because it is not wound up yet. tp.WindUp(); tp.StartEngine(); bool startedEngineAfterWind = tp.Engine.IsStarted; // This should return true because the plane has been wound. tp.StopEngine(); bool stoppedEngine = tp.Engine.IsStarted; // This should return false because the engine has been stopped. tp.UnWind(); tp.StartEngine(); bool startedEngineAfterUnwind = tp.Engine.IsStarted; // This should return false because the plane has been unwound. //Assert Assert.AreEqual(defaultEngine, false); Assert.AreEqual(startedEngineBeforeWind, false); Assert.AreEqual(startedEngineAfterWind, true); Assert.AreEqual(stoppedEngine, false); Assert.AreEqual(startedEngineAfterUnwind, false); }
public void TestAbout() { ToyPlane t = new ToyPlane(); //Default vars in about int maxAltitudeDefault = t.MaxAltitude;//this shouldn't change string windUpStringDefault = t.GetWindUpString(); int defaultCurrentAltitude = t.currentAltitude; t.WindUp(); //Vars after winding up string windUpAfterWindUp = t.GetWindUpString(); t.StartEngine();//gotta have the engine started to fly up t.TakeOff(); //vars after flying up string windUpStringAfterFly = t.GetWindUpString();//making sure these are being displayed correctly as they change int currentAltitudeAfterFly = t.currentAltitude; //Default Values Assert.AreEqual(50, maxAltitudeDefault); Assert.AreEqual("The toy plane is not wound up.", windUpStringDefault); Assert.AreEqual(0, defaultCurrentAltitude); Assert.AreEqual("The toy plane is wound up.", windUpAfterWindUp); Assert.AreEqual("The toy plane is not wound up.", windUpStringAfterFly); Assert.AreEqual(50, currentAltitudeAfterFly); }
public void ToyPlaneWindUp() { ToyPlane tp = new ToyPlane(); bool defaultToyPlaneIsWoundUp = tp.isWoundUP; tp.FlyUp(10); string unwoundToyPlaneInfo = tp.About(); string ToyPlaneInfoUnWound = String.Format("This OOPAerialVehicle has a max altitude of {0}" + "\nIt's current altitude is {1} ft." + "\n{2}", tp.MaxAltitude, tp.CurrentAltitude, tp.Engine.About()); tp.TakeOff(); string unwoundTakeOffToyPlane = tp.TakeOff(); string ToyPlaneUnwoundTakeOff = String.Format("{0} can't fly it's engine is not started.", tp.GetType()); tp.WindUp(); bool woundUpToyPlane = tp.isWoundUP; tp.TakeOff(); string woundUpTakeOffToyPlane = tp.TakeOff(); string ToyPlaneWoundUpTakeOff = String.Format("{0} is flying", tp.GetType()); Assert.IsFalse(defaultToyPlaneIsWoundUp); Assert.AreEqual(unwoundToyPlaneInfo, ToyPlaneInfoUnWound); Assert.AreEqual(unwoundTakeOffToyPlane, ToyPlaneUnwoundTakeOff); Assert.IsTrue(woundUpToyPlane); Assert.AreEqual(woundUpTakeOffToyPlane, ToyPlaneWoundUpTakeOff); }
public void TestTakeOff() { ToyPlane t = new ToyPlane(); //Defaults bool isWoundUpDefault = t.isWoundUp; //should be false upon starting without winding up string takeOffDefault = t.TakeOff(); //trying to take off without winding up should return error string //Starting wind up t.WindUp();//calling stuff needed to actually take off bool isWoundUpAfterWindUp = t.isWoundUp; //Starting engine t.StartEngine(); bool isWoundUpAfterStartEngine = t.isWoundUp; //Taking off with engine started string takeOffWithEngineStarted = t.TakeOff(); bool isWoundUpAfterTakeOff = t.isWoundUp; //Defaults //Calling take off without starting the engine Assert.AreEqual(false, isWoundUpDefault); Assert.AreEqual(t.GetType().Name + " cannot take off. It's engine is not started.", takeOffDefault); //Starting the engine Assert.AreEqual(true, isWoundUpAfterWindUp); Assert.AreEqual(true, isWoundUpAfterStartEngine); //Calling take off with engine started Assert.AreEqual(t.GetType().Name + " is flying", takeOffWithEngineStarted); Assert.AreEqual(false, isWoundUpAfterTakeOff); }
public void ToyPlaneFlyUp() { //Arrange ToyPlane tp = this.ToyPlane; //act tp.WindUp(); tp.StartEngine(); string firstTakeoff = tp.TakeOff(); int defaultHeight = tp.CurrentAltitude; tp.FlyUp(); // This should fail, because the AerialVehicle's FlyUp() goes up 1000 ft, while the ToyPlane has a maximum altitude of 50 ft. int firstAlt = tp.CurrentAltitude; tp.FlyUp(50); int secondAlt = tp.CurrentAltitude; tp.FlyUp(1); // This should fail and return the same value as the previous. int thirdAlt = tp.CurrentAltitude; //Assert Assert.AreEqual(defaultHeight, 0); Assert.AreEqual(firstAlt, 0); Assert.AreEqual(secondAlt, 50); Assert.AreEqual(thirdAlt, secondAlt); }
public void ToyPlaneFlyUpCheck() { //arrange ToyPlane tp = new ToyPlane(); //act - Engine on tp.WindUp(); tp.Engine.Start(); tp.TakeOff(); tp.FlyUp(25); //assert - check if fly up works Assert.AreEqual(tp.CurrentAltitude, 25); //act - fly to max tp.FlyUp(25); //assert - check for max altitude Assert.AreEqual(tp.CurrentAltitude, 50); //act - fly above max tp.FlyUp(25); //assert - check for max altitude Assert.AreEqual(tp.CurrentAltitude, 50); }
public void ToyPlaneDownCheck() { //arrange ToyPlane tp = new ToyPlane(); //act - Engine on tp.WindUp(); tp.Engine.Start(); tp.TakeOff(); tp.FlyUp(25); tp.FlyDown(5); //assert - check if fly down works Assert.AreEqual(tp.CurrentAltitude, 20); //act - fly to min tp.FlyDown(20); //assert - check for min altitude Assert.AreEqual(tp.CurrentAltitude, 0); //act - fly below min tp.FlyDown(25); //assert - check for min altitude Assert.AreEqual(tp.CurrentAltitude, 0); }
public void ToyPlaneFlyDown() { //Arrange ToyPlane tp = this.ToyPlane; //act tp.WindUp(); tp.StartEngine(); string firstTakeoff = tp.TakeOff(); int defaultHeight = tp.CurrentAltitude; tp.FlyDown(); //test is flying again int FlyDown = tp.CurrentAltitude; tp.TakeOff(); tp.FlyDown(1); //test is flying again tp.TakeOff(); int FlyDownOneAlreadyZero = tp.CurrentAltitude; tp.FlyUp(2); tp.FlyDown(1); int FlyDownOneAtTwo = tp.CurrentAltitude; //Assert Assert.AreEqual(defaultHeight, 0); Assert.AreEqual(FlyDown, 0); Assert.AreEqual(FlyDownOneAlreadyZero, 0); Assert.AreEqual(FlyDownOneAtTwo, 1); }
public void ToyPlaneFlyDownTest() { // Toy Plane instance to be tested ToyPlane tp = new ToyPlane(); // Setup tp.WindUp(); tp.StartEngine(); tp.FlyUp(50); int maxFlyUp = tp.CurrentAltitude; tp.FlyDown(20); int flyDown = tp.CurrentAltitude; // The value should not change as you are flying down more feet than you are up in the air tp.FlyDown(); int limitFlyDown = tp.CurrentAltitude; tp.FlyDown(30); int landFlyDown = tp.CurrentAltitude; // Assess Assert.AreEqual(maxFlyUp, 50); Assert.AreEqual(flyDown, 30); Assert.AreEqual(limitFlyDown, 30); Assert.AreEqual(landFlyDown, 0); }
public void TestAirPlaneFlyUpWhileEngineOn() { //Arrange tp = new ToyPlane(); //Act int originalAltitude = tp.CurrentAltitude; tp.WindUp(); tp.StartEngine(); tp.TakeOff(); tp.FlyUp(10); int afterFlyingUpDefault = tp.CurrentAltitude; ///Attempt To flyy up higher than max altitude tp.FlyUp(42); //this should not work becaause desired altitude is (40 + 42)82 ft which is higher than maxAltitude int attemptToFlyUpPastMaxAltitude = tp.CurrentAltitude; tp.FlyUp(40); //this should reachh 41000ft the max altitude int reachMaxAltitude = tp.CurrentAltitude; //plane should reach 50 ft reaching maxAltitude //Assert Assert.AreEqual(0, originalAltitude); //To make sure the altitude is 0 Assert.AreEqual(10, afterFlyingUpDefault); //To make sure flying up went up precisely 1000ft Assert.AreNotEqual(afterFlyingUpDefault, originalAltitude); //to make sure the plane flew up ///Attempt To flyy up higher than max altitude Assert.AreNotEqual(83, attemptToFlyUpPastMaxAltitude); Assert.AreEqual(attemptToFlyUpPastMaxAltitude, afterFlyingUpDefault); //plane should not have ascended past the defauult flyUp method ///Reaching max Altitude Assert.AreEqual(50, reachMaxAltitude); Assert.AreNotEqual(originalAltitude, reachMaxAltitude); }
public void ToyPlaneTakeOffTest() { // Toy Plane instance to be tested ToyPlane tp = new ToyPlane(); // Setup string firstTakeOff = tp.TakeOff(); tp.StartEngine(); string noWind = tp.getWindUpString(); tp.WindUp(); string woundUp = tp.getWindUpString(); tp.StartEngine(); string secondTakeOff = tp.TakeOff(); int altTakeOff = tp.CurrentAltitude; // Assess Assert.AreEqual(tp.Engine.isStarted, true); Assert.AreEqual(firstTakeOff, $"This {this.ToString()} can't fly it's engine is not started."); Assert.AreEqual(noWind, $"This {this.ToString()} has not been wound up"); Assert.AreEqual(woundUp, $"This {this.ToString()} has been wound up"); Assert.AreEqual(secondTakeOff, $"This {this.ToString()} is flying"); Assert.AreEqual(altTakeOff, 0); }
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 ToyPlaneTakeOff() { ToyPlane tp = toyPlane; bool endWoundUp; bool startWoundUp; bool startIsFlying; bool endIsFlying; bool startEngineStatus; bool endEngineStatus; startWoundUp = tp.isWoundUp; endWoundUp = true; startIsFlying = tp.IsFlying; endIsFlying = true; startEngineStatus = tp.Engine.IsStarted; endEngineStatus = true; Assert.AreEqual(startIsFlying, tp.IsFlying); Assert.AreEqual(startWoundUp, tp.isWoundUp); Assert.AreEqual(startEngineStatus, tp.Engine.IsStarted); tp.WindUp(); Assert.IsTrue(tp.isWoundUp); tp.UnWind(); Assert.IsFalse(tp.isWoundUp); tp.WindUp(); tp.TakeOff(); Assert.IsFalse(tp.IsFlying); tp.StartEngine(); Assert.IsTrue(endEngineStatus); tp.TakeOff(); Assert.AreEqual(endIsFlying, tp.IsFlying); Assert.AreEqual(endWoundUp, tp.isWoundUp); }
public void TestConstructor() { ToyPlane t = new ToyPlane(); int defaultMaxAltitude = t.MaxAltitude; Assert.AreEqual(50, defaultMaxAltitude); }
public void ToyPlane() { // Act. ToyPlane toyPlane = kernel.Get <ToyPlane>(); // Assert. Assert.IsInstanceOfType(toyPlane.Engine, typeof(RubberBandEngine)); }
public void ToyPlaneText() { ToyPlane tp = toyPlane; string pickupText; pickupText = "Obtained string to Wind up the plane to unleash flight."; Assert.AreEqual(pickupText, tp.getWindUpString()); }
public void ToyPlaneAbout() { ToyPlane tp = toyPlane; string aboutToyPlaneText; aboutToyPlaneText = $"This toy plane model currently has a current altitude of {0} feet with a max altitude of {50} feet."; Assert.AreEqual(aboutToyPlaneText, tp.About()); }
public void TestTakeOff() { //arrange t = new ToyPlane(); //assert Assert.AreEqual(t + " can't fly, it isn't wound up!", t.TakeOff()); //default string }
public void TestGetWindUpString() { //arrange t = new ToyPlane(); //assert Assert.AreEqual(t + " is not wound up.", t.getWindUpString()); }
public void WindUp() { ToyPlane plane = new ToyPlane(); plane.WindUp(); Assert.IsTrue(plane.isWoundUP); }
public void TestToyPlaneConstructor() { //arrange t = new ToyPlane(); //assert Assert.AreEqual(50, t.MaxAltitude); //toyplanes should have max alt of 50 default Assert.AreEqual(false, t.isWoundUP); }
public void Unwind() { ToyPlane plane = new ToyPlane(); plane.WindUp(); plane.UnWind(); Assert.IsFalse(plane.isWoundUP); }
public void ToyPlaneCreation() { ToyPlane tp = new ToyPlane(); int defaultToyPlaneMaxAltitude = tp.MaxAltitude; bool defaultToyPlaneWoundUp = tp.isWoundUP; Assert.AreEqual(defaultToyPlaneMaxAltitude, 50); Assert.IsFalse(defaultToyPlaneWoundUp); }
public void TestToyPlaneAbout() { //arrange t = new ToyPlane(); //assert Assert.AreEqual(t.getWindUpString() + "\n" + t.getEngineStartedString() + "\nThis " + t + " has a max altitude of " + t.MaxAltitude + "\nIt's current altitude is " + t.CurrentAltitude, t.About()); }
public void StartEngine() { ToyPlane plane = new ToyPlane(); Assert.AreEqual(plane.StartEngine(), "The toy plane has to be wound up first"); plane.WindUp(); Assert.AreEqual(plane.StartEngine(), "Sprint_0_Warm_Up.ToyPlane is flying"); }
public void ToyPlaneWindUp() { //Arrange ToyPlane tp = toyplane; //Act //Assert Assert.AreEqual(tp.woundUp, false); }
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 ToyPlaneWindUpCheck() { //arrange ToyPlane tp = new ToyPlane(); //act - wind her up tp.WindUp(); //assert - check if wound Assert.IsTrue(tp.isWoundUp); }