public void ToyPlaneAbout()
        {
            //Arrange
            string afterAbout;

            //Act
            afterAbout = toyplane.About();

            //Assert
            Assert.IsNotNull(toyplane);
            Assert.AreEqual(afterAbout, toyplane.About());
            Assert.AreNotEqual(afterAbout, string.Empty);
        }
        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.");
        }
Ejemplo n.º 3
0
        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 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.");
        }
Ejemplo n.º 5
0
        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 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.");
        }
Ejemplo n.º 7
0
        public void TestToyPlaneAabout()
        {
            //Arrange
            tp = new ToyPlane();
            //Act
            string originalToyplaneAboutString = tp.About();

            tp.WindUp();
            tp.StartEngine();
            string engineStartToyPlaneString = tp.About();

            tp.StopEngine();
            tp.UnWind();
            string engineStopToyPlaneString = tp.About();

            //Assert
            Assert.AreEqual(originalToyplaneAboutString, engineStopToyPlaneString);
            Assert.AreNotEqual(originalToyplaneAboutString, engineStartToyPlaneString);
        }
        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.");
        }
Ejemplo n.º 9
0
        public void About()
        {
            ToyPlane plane = new ToyPlane();

            string result = "This Sprint_0_Warm_Up.ToyPlane has a max altitude of 50 ft." + "\n";

            result += "It's current altitude is 0 ft. \n";
            result += "Sprint_0_Warm_Up.Engine is not started.";
            result += "\n" + "The toy plane is not wound up";

            Assert.AreEqual(plane.About(), result);
        }
Ejemplo n.º 10
0
        public void About()
        {
            // The toy plane, unwound by default should state in its
            // final about string that it is unwound.
            // Arrange.
            toyPlane = new ToyPlane(new Engine());
            // Act.
            string[] messages = toyPlane.About().Split(Environment.NewLine);
            // Assert.
            Assert.AreEqual("It's unwound.", messages[messages.Length - 1]);

            // Final about message should reflect wound state.
            // Arrange.
            toyPlane = new ToyPlane(new Engine());
            // Act.
            toyPlane.WindUp();
            messages = toyPlane.About().Split(Environment.NewLine);
            // Assert.
            Assert.AreEqual("It's wound up.", messages[messages.Length - 1]);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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());
        }