public static void Main(string[] args) { #region Case One var decafWithCaramel = new Caramel(new Decaf()); Console.WriteLine(decafWithCaramel.Describe()); var espressoWithSoyAndCaramel = new Caramel(new Soy(new Decaf())); Console.WriteLine(espressoWithSoyAndCaramel.Describe()); #endregion #region Case Two var windowWithBorderAndVerticalScrollBar = new VerticalScrollBarDecorator(new BorderDecorator(new Window { Width = 12, Height = 32 })); windowWithBorderAndVerticalScrollBar.Draw(); var windowWithVerticalAndHorizontalBar = new HorizontalScrollBarDecorator( new VerticalScrollBarDecorator(new Window { Width = 11, Height = 22 })); windowWithVerticalAndHorizontalBar.Draw(); #endregion }
public void Run() { var decaf = new Decaf(); Console.WriteLine($"{decaf.Description()} cost is ${decaf.Cost()}"); var decafWithCaramel = new Caramel(decaf); Console.WriteLine($"{decafWithCaramel.Description()} cost is ${decafWithCaramel.Cost()}"); var decafWithCaramelPlusSoyMilk = new SoyMilk(decafWithCaramel); Console.WriteLine($"{decafWithCaramelPlusSoyMilk.Description()} cost is ${decafWithCaramelPlusSoyMilk.Cost()}"); var decafWithSoy = new SoyMilk(decaf); Console.WriteLine($"{decafWithSoy.Description()} cost is ${decafWithSoy.Cost()}"); var espresso = new Espresso(); Console.WriteLine($"{espresso.Description()} cost is ${espresso.Cost()}"); var doubleEspresso = new ExtraEspresso(espresso); Console.WriteLine($"{doubleEspresso.Description()} cost is ${doubleEspresso.Cost()}"); }
static void Main(string[] args) { var espresso = new Espresso(); var espressoSoy = new Soy(espresso); System.Console.WriteLine("The cost of a esspresso with soy is {0} dollars", espressoSoy.Cost()); var decaf = new Decaf(); var decafCaramel = new Caramel(decaf); System.Console.WriteLine("The cost of a decaf with caramel is {0} dollars", decafCaramel.Cost()); }
static void Main(string[] args) { Expresso cafeExpresso = new Expresso(); Caramel cafeExpressoWithCaramel = new Caramel(cafeExpresso); Milk cafeExpressoWithCaramelAndMilk = new Milk(cafeExpressoWithCaramel); Console.WriteLine("Expresso: " + cafeExpresso.Cost()); Console.WriteLine("Expresso Caramel: " + cafeExpressoWithCaramel.Cost()); Console.WriteLine("Expresso Caramel And Milk: " + cafeExpressoWithCaramelAndMilk.Cost()); Console.ReadKey(); }
static void Main(string[] args) { ICoffee latte = new Latte(); latte = new WhippedCream(latte); latte = new Caramel(latte); latte = new SoyMilk(latte); Console.WriteLine(latte.ShowInfo()); Console.WriteLine(); ICoffee espresso = new Espresso(); Console.WriteLine(espresso.ShowInfo()); Console.WriteLine(); ICoffee cappuccino = new Cappuccino(); cappuccino = new SoyMilk(cappuccino); cappuccino = new Caramel(cappuccino); Console.WriteLine(cappuccino.ShowInfo()); }