示例#1
0
        public void TestCarBuilder()
        {
            IBuilder builder = new CarBuilder();

            builder.InitVehicule();
            builder.AddBody();
            builder.AddEngine();
            for (int i = 0; i < Car.MAX_WHEELS; ++i)
            {
                builder.AddWheel();
            }
            IVehicule     car            = builder.GetVehicule();
            string        carDescription = car.GetVehiculeDescription();
            StringBuilder strBuilder     = new StringBuilder();

            strBuilder.Append("Car vehicule").AppendLine()
            .Append("Wheels: 4 car wheel.s").AppendLine()
            .Append("Engine: Car engine").AppendLine()
            .Append("Body: Car body").AppendLine();
            Assert.AreEqual(strBuilder.ToString(), carDescription);
        }