コード例 #1
0
        public void AirplaneDescendsProperly(int alt)
        {
            Airplane a = new Airplane();

            a.Ascend(alt);
            a.Descend(alt / 2);
            Assert.AreEqual(alt / 2, a.Altitude);
        }
コード例 #2
0
        public void CantHaveANegativeAltitude()
        {
            Airplane a = new Airplane(200, 100, "JetsRUs");

            a.Ascend(200);
            a.Descend(800);
            Assert.AreEqual(0, a.Altitude);
        }
コード例 #3
0
        public void AirplaneWillDescend(int altitude, int expected)
        {
            Airplane airplane = new Airplane(200, "KLM", 700, 200);

            airplane.Ascend(4000);
            airplane.Descend(altitude);

            Assert.AreEqual(expected, airplane.Altitude);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Airplane a = new Airplane(200, 100, "JetsRUs")
            {
                NumPassengers = 150
            };

            a.Ascend(500);
            Console.WriteLine(a.Move(3));
            Console.WriteLine(a);
            a.Descend(200);
            Console.WriteLine(a.Move());
            a.Move();
            Console.WriteLine(a);
        }