public void AddWeapon(Vehicle car, Weapon weapon) { var carDecorator = new VehicleDecorator(car); switch (weapon) { case Weapon.Axe: carDecorator = new AxeDecorator(carDecorator); break; case Weapon.Bow: carDecorator = new BowDecorator(carDecorator); break; case Weapon.Gun: carDecorator = new GunDecorator(carDecorator); break; case Weapon.Knife: carDecorator = new KnifeDecorator(carDecorator); break; case Weapon.Sword: carDecorator = new SwordDecorator(carDecorator); break; } Console.WriteLine($"Att: {carDecorator.GetAtt()}"); }
public void ArmorAxeDecoratorTest() { VehicleDecorator boatDecorator = new ArmorDecorator(new Boat()); boatDecorator = new AxeDecorator(boatDecorator); Assert.AreEqual(10, boatDecorator.GetDef()); Assert.AreEqual(7, boatDecorator.GetAtt()); }