public void AirplaneAboutTest()
        {
            // Airplane Instance to be Tested
            Airplane a = new Airplane();

            Assert.AreEqual(a.About(), $"This {a.ToString()} has a max altitude of 41000 ft. \nIt's current altitude is 0 ft. \nThis{a.Engine.ToString()}'s engine is not started.");
        }
Example #2
0
        public void TestAirPlaneAabout()
        {
            //Arrange
            ap = new Airplane();
            //Act
            string originalAirplaneAboutString = ap.About();

            ap.StartEngine();
            string engineStartAirPlaneString = ap.About();

            ap.StopEngine();
            string engineStopAirPlaneString = ap.About();

            //Assert
            Assert.AreEqual(originalAirplaneAboutString, engineStopAirPlaneString);
            Assert.AreNotEqual(originalAirplaneAboutString, engineStartAirPlaneString);
        }
Example #3
0
        public void TestMethod1()
        {
            //Set-up
            Airplane plane = new Airplane();

            // Test about method, Plane is in the ground.
            Assert.AreEqual(plane.About(), plane.Engine.About() + " and Current altitude is " + plane.CurrentAltitude + " ft");
        }
Example #4
0
        public void AirplaneAbout()
        {
            Airplane ap = airplane;
            string   aboutText;

            aboutText = $"This model airplane has a max altitude of {41000} feet while it's current altitude is at {0}";

            Assert.AreEqual(aboutText, ap.About());
        }
Example #5
0
        public void AirplaneInfo()
        {
            Airplane ap = new Airplane();


            string defaultAirplaneInfo         = ap.About();
            string AirplaneExpectedInfoDefault = string.Format("This OOPAerialVehicle has a max altitude of {0}" +
                                                               "\nIt's current altitude is {1} ft." +
                                                               "\n{2}", ap.MaxAltitude, ap.CurrentAltitude, ap.Engine.About());

            ap.StartEngine();
            ap.TakeOff();
            ap.FlyUp();
            string flyUpAirplaneInfo         = ap.About();
            string AirplaneExpectedInfoflyUp = string.Format("This OOPAerialVehicle has a max altitude of {0}" +
                                                             "\nIt's current altitude is {1} ft." +
                                                             "\n{2}", ap.MaxAltitude, ap.CurrentAltitude, ap.Engine.About());

            ap.FlyDown();
            string flyDownAirplaneInfo         = ap.About();
            string AirplaneExpectedInfoflyDown = string.Format("This OOPAerialVehicle has a max altitude of {0}" +
                                                               "\nIt's current altitude is {1} ft." +
                                                               "\n{2}", ap.MaxAltitude, ap.CurrentAltitude, ap.Engine.About());

            int amountOfFeet = 2000;

            ap.FlyUp(amountOfFeet);
            string flyUpNumAirplaneInfo         = ap.About();
            string AirplaneExpectedInfoflyUpNum = string.Format("This OOPAerialVehicle has a max altitude of {0}" +
                                                                "\nIt's current altitude is {1} ft." +
                                                                "\n{2}", ap.MaxAltitude, ap.CurrentAltitude, ap.Engine.About());

            ap.FlyDown(amountOfFeet);
            string flyDownNumAirplaneInfo         = ap.About();
            string AirplaneExpectedInfoflyDownNum = string.Format("This OOPAerialVehicle has a max altitude of {0}" +
                                                                  "\nIt's current altitude is {1} ft." +
                                                                  "\n{2}", ap.MaxAltitude, ap.CurrentAltitude, ap.Engine.About());

            Assert.AreEqual(defaultAirplaneInfo, AirplaneExpectedInfoDefault);
            Assert.AreEqual(flyUpAirplaneInfo, AirplaneExpectedInfoflyUp);
            Assert.AreEqual(flyDownAirplaneInfo, AirplaneExpectedInfoflyDown);
            Assert.AreEqual(flyUpNumAirplaneInfo, AirplaneExpectedInfoflyUpNum);
            Assert.AreEqual(flyDownNumAirplaneInfo, AirplaneExpectedInfoflyDownNum);
        }
        public void AirplaneAbout()
        {
            //Arrange
            Airplane ap = this.Airplane;

            //Act
            // Nothing to act on here.
            //Assert
            Assert.AreEqual(ap.About(), $"This {ap.ToString()} has a max altitude of 41000 ft.\nIts current altitude is 0 ft.\n{ap.Engine.ToString()} is not started.");
        }
        public void AirplaneAboutCheck()
        {
            //arrange
            Airplane airplane = new Airplane();

            //act

            //assert
            Assert.AreEqual(airplane.About(), "This" + "Sprint0_OOP2.Airplane" + " has a max altitude of " + airplane.MaxAltitude + "ft \n" + "It's current altitude is " + airplane.CurrentAltitude + " ft \n" + airplane.Engine.About());
        }
Example #8
0
        public void About()
        {
            Airplane ap = new Airplane();

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

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

            Assert.AreEqual(ap.About(), result);
        }
Example #9
0
        public void About()
        {
            // Confirm about message formatting.
            // Arrange.
            airplane = new Airplane(new Engine());
            // Act.
            string about = airplane.About();

            // Assert.
            Assert.AreEqual(
                $"This {airplane} has a max altitude of 41000 ft." +
                $"{Environment.NewLine}Its current altitude is 0 ft." +
                $"{Environment.NewLine}{airplane.Engine} is not started.",
                about);
        }
Example #10
0
        public void TestMethod1()
        {
            Airplane A = new Airplane();

            Assert.IsNotNull(A);
            Assert.AreEqual(A.Name, "OOPFlying.Airplane");
            Assert.AreEqual(A.Isflying, false);
            Assert.AreEqual(A.MaxAltitude, 41000);
            Assert.AreEqual(A.CurrentAltitude, 0);

            A.TakeOff();
            A.ToString();
            A.StartEngine();
            A.StopEngine();
            A.About();
            A.FlyUp(100);
            A.FlyDown(100);
        }
        public void TestAirplane()
        {
            // Arrange
            boeing = new Airplane();
            int testHeight = 7;

            // Act
            string initialAbout = boeing.About();

            int planeGroundHeight = boeing.currentAltitude; // 0 ft

            // Test before starting engine
            boeing.FlyUp();
            int planeHeightPreStartUp = boeing.currentAltitude; // 0 ft

            boeing.FlyDown();
            int planeHeightPreStartDown = boeing.currentAltitude; // 0 ft

            bool   EngineStatusPreStart = boeing.engine.isStarted;
            string TakeoffPreStart      = boeing.TakeOff();

            boeing.StartEngine();
            bool EngineStatusPostStart = boeing.engine.isStarted;

            // Test after starting engine but before taking off

            boeing.FlyUp();
            int planeHeightPreTakeoffUp = boeing.currentAltitude; // 0 ft

            boeing.FlyDown();
            int planeHeightPreTakeOffDown = boeing.currentAltitude; // 0 ft

            // Test after starting engine and after taking off
            string confirmTakeOff = boeing.TakeOff();

            boeing.FlyUp();
            int planeHeightPostStartUp = boeing.currentAltitude; // 1000 ft

            boeing.FlyUp(35000);
            int planeHeightPostStartUpX = boeing.currentAltitude; // 36000 ft

            boeing.FlyUp(50000);
            int planeHeightPostStartUpMax = boeing.currentAltitude; // maxAltitude

            boeing.FlyDown();
            int planeHeightPostStartDown = boeing.currentAltitude; // maxAltitude - 1000 ft

            string planeFlightAbout = boeing.About();

            boeing.FlyDown(50000);
            int planeHeightPostStartDownMax = boeing.currentAltitude; // same as above

            boeing.FlyDown(5000);
            int planeHeightPostStartDownX = boeing.currentAltitude; // maxAltitude - 6000 ft

            boeing.StopEngine();
            bool EngineStatusPostStop = boeing.engine.isStarted;

            string planeMidflightEngineOff = boeing.About();

            boeing.FlyDown(boeing.currentAltitude);
            bool planeLand = boeing.isFlying;

            // Assert
            Assert.AreEqual("This " + boeing.ToString() + " has a max altitude of " + boeing.maxAltitude + " ft.\n" +
                            "It's current altitude is " + "0 ft.\n" +
                            boeing.ToString() + "Engine is started = False", initialAbout);

            Assert.AreEqual(0, planeGroundHeight);
            Assert.AreEqual(0, planeHeightPreStartUp);
            Assert.AreEqual(0, planeHeightPreStartDown);
            Assert.AreEqual(false, EngineStatusPreStart);
            Assert.AreEqual(boeing.ToString() + " cannot fly, its' engine is not started.", TakeoffPreStart);
            Assert.AreEqual(true, EngineStatusPostStart);

            Assert.AreEqual(0, planeHeightPreTakeoffUp);
            Assert.AreEqual(0, planeHeightPreTakeOffDown);

            Assert.AreEqual(boeing.ToString() + " is flying.", confirmTakeOff);
            Assert.AreEqual(1000, planeHeightPostStartUp);
            Assert.AreEqual(36000, planeHeightPostStartUpX);
            Assert.AreEqual(boeing.maxAltitude, planeHeightPostStartUpMax);
            Assert.AreEqual(boeing.maxAltitude - 1000, planeHeightPostStartDown);

            Assert.AreEqual("This " + boeing.ToString() + " has a max altitude of " + boeing.maxAltitude + " ft.\n" +
                            "It's current altitude is " + (boeing.maxAltitude - 1000) + " ft.\n" +
                            boeing.ToString() + "Engine is started = True", planeFlightAbout);

            Assert.AreEqual(boeing.maxAltitude - 1000, planeHeightPostStartDownMax);
            Assert.AreEqual(boeing.maxAltitude - 6000, planeHeightPostStartDownX);
            Assert.AreEqual(false, EngineStatusPostStop);
            Assert.AreEqual("This " + boeing.ToString() + " has a max altitude of " + boeing.maxAltitude + " ft.\n" +
                            "It's current altitude is " + (boeing.maxAltitude - 6000) + " ft.\n" +
                            boeing.ToString() + "Engine is started = False", planeMidflightEngineOff);

            Assert.AreEqual(false, planeLand);
        }