Beispiel #1
0
        public void CanCreateMotorbike()
        {
            var x = new Motorbike("green", 20);

            Assert.IsTrue(x.Color == "green");
            Assert.IsTrue(x.Tank == 20);
        }
Beispiel #2
0
 public void CannotCreateMotorbikeWithNullTank()
 {
     Assert.Catch(() =>
     {
         var x = new Motorbike("blue", 0);
     });
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            Car a = new Car(true, "blue", 50);
            Car b = new Car(false, "red", 40);
            Car c = new Car(false, "red", 20);
            Motorbike d = new Motorbike("green", 60);

            vehicle [] v= new vehicle[] {a,b,c,d};
            for (var i = 0; i < 4; i++)
            {
               Console.WriteLine(v[i].Look);
            }

            Serialization.Run(v);

            Console.WriteLine("Tankgrösse Auto a:"+ a.Tank);
            Console.WriteLine("Farbe von Auto a:"+ a.Color);
            Console.WriteLine("Trebstoffart von Auto b:" + b.Fuel);
            Console.WriteLine("Farbe von Auto b:"+ b.Color);

            Console.WriteLine("Farbe von Auto c:"+ (c.Color = "yellow"));
            Console.WriteLine("tanken von Auto a, Kosten:"+ a.FillUp(true,50));

            Console.WriteLine("Tankgrösse Auto c:" + c.Tank);
            c.ChangeTank(55);
            Console.WriteLine("Neue Tankgrösse Auto c:" + c.Tank);

            Console.WriteLine(a.Look);

            Console.WriteLine("Farbe " + d.Color);
            Console.WriteLine("Tank " + d.Tank);
        }
Beispiel #4
0
 public void CannotUpdateMotorbikeWithNegativeTank()
 {
     Assert.Catch(() =>
     {
         var x = new Motorbike("blue", 20);
         x.ChangeTank(-20);
     });
 }