public void Run()
        {
            Console.WriteLine("Creating sandwich builder...");
            var builder = new SandwichBuilder();

            Console.WriteLine("Done.");

            Console.WriteLine();

            Console.WriteLine("Creating sandwich 1...");
            var sandwich1 =
                builder
                .AddBread("Rye")
                .AddMeat("Chicken")
                .AddMeat("Turkey")
                .AddSauce("Mayo")
                .GetSandwich();

            Console.WriteLine("Done.");

            DisplaySandwich(sandwich1);

            Console.WriteLine();

            Console.WriteLine("Creating sandwich 2...");
            var sandwich2 =
                builder
                .Reset()
                .AddCondiment("Tomato")
                .AddMeat("Salami")
                .AddCondiment("Lettuce")
                .AddBread("Sourdough")
                .AddCondiment("Onion")
                .GetSandwich();

            Console.WriteLine("Done.");

            DisplaySandwich(sandwich2);
        }
Beispiel #2
0
 public SandwichAssembly(SandwichBuilder sandwichBuilder)
 {
     _sandwichBuilder = sandwichBuilder;
 }