Beispiel #1
0
        static void BuilderPatternTest()
        {
            LunchOrder.Builder builder = new LunchOrder.Builder();
            builder.AddBread("Taba Nan").AddDressing("Some Dressing").AddMeat("Hourse Meat");
            LunchOrder lunchOrder = new LunchOrder(builder);

            Console.WriteLine(lunchOrder.GetBread());
            Console.WriteLine(lunchOrder.GetDressing());
            Console.WriteLine(lunchOrder.GetMeat());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var builder = new LunchOrder.Builder();

            LunchOrder order =
                builder.Bread("Wheat")
                .Dressing("Mayo")
                .Meat("Turkey")
                .GetLunchOrder();

            Console.WriteLine(order);
        }
Beispiel #3
0
        public void GetLunchOrderTest()
        {
            // arrange
            LunchOrder.Builder builder = new LunchOrder.Builder();

            // act
            LunchOrder order =
                builder.Bread("Wheat")
                .Dressing("Mayo")
                .Meat("Turkey")
                .GetLunchOrder();

            // assert
            Assert.AreEqual(order.Bread, "Wheat");
            Assert.AreEqual(order.Condiments, null);
            Assert.AreEqual(order.Dressing, "Mayo");
            Assert.AreEqual(order.Meat, "Turkey");
        }