Пример #1
0
 public void Bake(BreadBuilder breadBuilder)
 {
     breadBuilder.SetRyeFlour();
     breadBuilder.SetWheatFlour();
     breadBuilder.SetSalt();
     breadBuilder.SetAddictives();
 }
Пример #2
0
    public static void Main()
    {
        var director = new Director();
        var builder  = new ConcreteBuilder();

        director.Builder = builder;

        Console.WriteLine("Standard basic product:");
        director.BuildMinimalViableProduct();
        Console.WriteLine(builder.GetProduct().ListParts());

        Console.WriteLine("Standard full featured product:");
        director.BuildFullFeaturedProduct();
        Console.WriteLine(builder.GetProduct().ListParts());

        var breadBuilder = new BreadBuilder();

        director.Builder = breadBuilder;
        Console.WriteLine("Standard basic product:");
        director.BuildMinimalViableProduct();
        Console.WriteLine(breadBuilder.GetProduct().ListParts());

        Console.WriteLine("Standard full featured product:");
        director.BuildFullFeaturedProduct();
        Console.WriteLine(breadBuilder.GetProduct().ListParts());

        Console.WriteLine("Custom product:");
        builder.BuildPartA();
        builder.BuildPartC();
        Console.Write(builder.GetProduct().ListParts());
        Console.ReadKey();
    }
Пример #3
0
        private void Bake(BreadBuilder builder)
        {
            var baker = new Baker(builder);

            baker.Bake();
            Console.WriteLine(builder.Bread.ToString());
        }
Пример #4
0
 public static Bread Bake(BreadBuilder breadBuilder)
 {
     breadBuilder.CreateBread();
     breadBuilder.SetFlour();
     breadBuilder.SetSalt();
     breadBuilder.SetAdditives();
     return(breadBuilder.Bread);
 }
Пример #5
0
 public Bread Bake(BreadBuilder builder)
 {
     builder.Bread = new Bread();
     builder.SetFlour();
     builder.SetSalt();
     builder.SetAdditive();
     return(builder.Bread);
 }
        public Bread Bake(BreadBuilder breadBuilder)
        {
            breadBuilder.StartBake();
            breadBuilder.AddFlour();
            breadBuilder.AddYeast();
            breadBuilder.AddAdditionals();

            return(breadBuilder.Bread);
        }
Пример #7
0
 public Baker(BreadBuilder builder)
 {
     _builder = builder;
 }