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);
        }
Exemple #2
0
        public void GetWindUpString()
        {
            ToyPlane plane = new ToyPlane();

            plane.WindUp();

            Assert.AreEqual(plane.getWindUpString(), "The toy plane is wound up");

            plane.UnWind();

            Assert.AreEqual(plane.getWindUpString(), "The toy plane is not wound up");
        }
        public void WindUpTest()
        {
            ToyPlane toy = new ToyPlane();
            //isWoundUp = false
            string isWoundUpString = toy.getWindUpString();

            Assert.AreEqual(isWoundUpString, $"{toy} is not wound up.");
            //isWoundUp = true;
            toy.windUp();
            isWoundUpString = toy.getWindUpString();
            Assert.AreEqual(isWoundUpString, $"{toy} is wound up.");
        }
        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.");
        }
Exemple #5
0
        public void TestGetWindUpString()
        {
            //arrange
            t = new ToyPlane();

            //assert
            Assert.AreEqual(t + " is not wound up.", t.getWindUpString());
        }
Exemple #6
0
        public void ToyPlaneText()
        {
            ToyPlane tp = toyPlane;
            string   pickupText;

            pickupText = "Obtained string to Wind up the plane to unleash flight.";
            Assert.AreEqual(pickupText, tp.getWindUpString());
        }
Exemple #7
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());
        }
Exemple #8
0
        public void ToyPlaneWoundUpTest()
        {
            // Arrage
            ToyPlane toyPlane = new ToyPlane();

            Assert.IsFalse(toyPlane.isWoundUp);
            //Assert.AreEqual(toyPlane.About(), $"{toyPlane} has a max altitude of {toyPlane.MaxAltitude} ft\n It's current altitude is {toyPlane.CurrentAltitude} ft\n is not started{toyPlane} is wound up");

            toyPlane.StartEngine();

            Assert.IsTrue(toyPlane.isWoundUp);
            Assert.AreEqual(toyPlane.getWindUpString(), $"{toyPlane} is winding up");

            toyPlane.TakeOff();

            Assert.AreEqual(toyPlane.CurrentAltitude, 10f);

            toyPlane.UnWind();

            Assert.IsFalse(toyPlane.isWoundUp);
        }