Ejemplo n.º 1
0
        public static void FacadeUsage()
        {
            var carFacade = new CarFacade();
            var car       = carFacade.Build <StripesStrategy>(EngineType.Diesel, Color.Black, 60);
            var car2      = carFacade.Create();

            carFacade.AddWeapon(car, Weapon.Axe);
            carFacade.AddDefense(car, Defense.Gloves);
        }
Ejemplo n.º 2
0
        public void CarFacadeTest()
        {
            var carFacade = new CarFacade();
            var car       = carFacade.Build <StripesStrategy>(EngineType.Diesel, Color.Black, 60);

            Assert.AreEqual(Color.Black, car.Color);
            Assert.AreEqual(60, car.MaxSpeed);
            Assert.AreEqual(EngineType.Diesel, car.EngineType);

            var car2 = carFacade.Create();

            Assert.IsInstanceOfType(car2, typeof(Car));
        }