public void BuildUp() { var maker = new VehicleMaker(); maker.Builder = new CarBuilder(); maker.Construct(); Assert.AreEqual <int>(4, maker.Vehicle.Wheels.Count()); Assert.AreEqual <int>(4, maker.Vehicle.Lights.Count()); maker.Builder = new BicycleBuilder(); maker.Construct(); Assert.AreEqual <int>(2, maker.Vehicle.Wheels.Count()); Assert.IsNull(maker.Vehicle.Lights); }
public void TestBuilder() { var maker1 = new VehicleMaker(); maker1.Builder = new CarBuilder(); maker1.Construct(); Assert.AreEqual(4, maker1.Vehicle.Wheels.Count()); Assert.AreEqual(4, maker1.Vehicle.Lights.Count()); var maker2 = new VehicleMaker(); maker2.Builder = new BicycleBuilder(); maker2.Construct(); Assert.AreEqual(2, maker2.Vehicle.Wheels.Count()); Assert.IsNull(maker2.Vehicle.Lights); }