Example #1
0
 /// <summary>Routine of test drive</summary>
 /// <param name="car">Reference to car object</param>
 static void testDrive1(Automobile car)
 {
     driveAndPrint(car, 0, "Start of circuit, ");
     car.fillUp(10.0f);
     driveAndPrint(car, 0, "After filling up, ");
     driveAndPrint(car, 14.7f);
     driveAndPrint(car, 60.7f);
     driveAndPrint(car, 33.7f);
 }
Example #2
0
 // Bug : VS Comment web report does not pick these comments
 /// <summary>Drive a certain distance and print car status</summary>
 /// <param name="car">Reference to car object</param>
 /// <param name="numMiles">Distance to drive</param>
 /// <param name="msg">Message to display</param>
 static void driveAndPrint(Automobile car, miles numMiles, string msg)
 {
     if (car.drive(numMiles) > 0.0)
     {
         car.dump(msg);
     }
     else
     {
         car.dump(msg + "did not finish drive of " + numMiles + " miles, ");
     }
 }
Example #3
0
 static void testDrive1(Automobile car)
 {
     driveAndPrint(car, 0, "Start of circuit, ");
     Assert.AreEqual("Start of circuit Car:rx7 Tank:0", car.dumpStr("Start of circuit"), "Start of circuit");
     car.fillUp(10.0f);
     Assert.AreEqual("After filling up Car:rx7 Tank:10", car.dumpStr("After filling up"), "After filling up");
     driveAndPrint(car, 0, "After filling up, ");
     driveAndPrint(car, 14.7f);
     driveAndPrint(car, 60.7f);
     driveAndPrint(car, 33.7f);
 }
Example #4
0
 /// <summary>Main entry point, serves to catch all unanticipated exceptions</summary>
 static void Main(string[] args)
 {
     try{
         Console.WriteLine("Running Automobile");
         Automobile rx7 = new Automobile("rx7", 10.0f);
         testDrive1(rx7);
     }catch (Exception e) {
         Console.WriteLine("Unhandled System.Exception! " + e.Message);
     }catch {
         Console.WriteLine("non-CLSCompliant exception!");
     }
 }
Example #5
0
 /// <summary>Drive a certain distance</summary>
 /// <param name="car">Reference to car object</param>
 /// <param name="numMiles">Distance to drive</param>
 static void driveAndPrint(Automobile car, miles numMiles)
 {
     driveAndPrint(car, numMiles, "After driving " + numMiles + " miles, ");
 }