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);
        }
Esempio n. 2
0
        public void TestToyPlaneGetWindUpString()
        {
            //Arrange
            tp = new ToyPlane();
            //Act
            string defaultToyPlaneWindUpString = tp.GetWindUpString();

            tp.WindUp();
            string afterWindUpString = tp.GetWindUpString();

            //Assert
            Assert.AreEqual("ToyPlane is wound up", afterWindUpString);
            Assert.AreEqual("ToyPlane not wound up", defaultToyPlaneWindUpString);
        }
        public void TestGetWindUpString()
        {
            ToyPlane t = new ToyPlane();

            //test when isWound = false
            bool   defaultIsWound   = t.isWoundUp;
            string defaultGetWindUp = t.GetWindUpString();

            t.WindUp();

            //test when isWound = true
            bool   isWoundUpAfterWindUp = t.isWoundUp;
            string GetWindUpAfterWindUp = t.GetWindUpString();

            Assert.AreEqual(false, defaultIsWound);
            Assert.AreEqual("The toy plane is not wound up.", defaultGetWindUp);
            Assert.AreEqual(true, isWoundUpAfterWindUp);
            Assert.AreEqual("The toy plane is wound up.", GetWindUpAfterWindUp);
        }