Example #1
0
        public void VehicleManagerTest()
        {
            //given
            VehicleManager manager = new VehicleManager();

            //when
            IVehicle saloon1 = manager.CreateSaloon();
            IVehicle pickup  = manager.CreatePickup();

            //then
            Assert.AreEqual(saloon1.GetType(), typeof(Saloon));
            Assert.AreEqual(pickup.GetType(), typeof(Pickup));
        }
Example #2
0
        static void Main()
        {
            VehicleManager vManager = new VehicleManager();
            IVehicle       vSaloon1 = vManager.CreateSaloon();
            IVehicle       vSaloon2 = vManager.CreateSaloon();
            IVehicle       vPickup1 = vManager.CreatePickup();

            WriteLine(vSaloon1);
            WriteLine(vSaloon2);
            WriteLine(vPickup1);

            VehicleManagerLazy vManagerLazy = new VehicleManagerLazy();
            IVehicle           vSaloon3     = vManagerLazy.CreateSaloon();
            IVehicle           vSaloon4     = vManagerLazy.CreateSaloon();
            IVehicle           vPickup3     = vManagerLazy.CreatePickup();

            WriteLine(vSaloon3);
            WriteLine(vSaloon4);
            WriteLine(vPickup3);

            ReadKey();
        }