示例#1
0
    static void Main(string[] args)
    {
        var director = new Director();
        var builder  = new ChocoTartarosBuilder();

        director.Builder = builder;

        Console.WriteLine("Simple ice cream:");
        director.BuildSimpleIceCream();
        Console.WriteLine(builder.GetProduct().ListIngredients());

        Console.WriteLine("Full featured ice cream:");
        director.BuildFullFeaturedIceCream();
        Console.WriteLine(builder.GetProduct().ListIngredients());
    }
示例#2
0
        public void Test_ChocoTartarosBuilder_BuildTopping()
        {
            string expected = "Ice cream ingredients: chocolate chip\n";
            var    result   = new ChocoTartarosBuilder();

            result.BuildTopping();
            Assert.AreEqual(expected, result.GetProduct().ListIngredients());
        }
示例#3
0
        public void Test_ChocoTartarosBuilder_BuildCup()
        {
            string expected = "Ice cream ingredients: bubble waffle\n";
            var    result   = new ChocoTartarosBuilder();

            result.BuildCup();
            Assert.AreEqual(expected, result.GetProduct().ListIngredients());
        }
示例#4
0
        public void Test_Director_ChocoTartaros_BuildFullFeaturedIceCream()
        {
            var director = new Director();
            var result   = new ChocoTartarosBuilder();

            director.Builder = result;
            string expected = "Ice cream ingredients: bubble waffle, dark chocolate ball, chocolate chip\n";

            director.BuildFullFeaturedIceCream();
            Assert.AreEqual(expected, result.GetProduct().ListIngredients());
        }