Esempio n. 1
0
        public void HotDrinkMachine_ShouldMakeAvailableDrink(string drinkType)
        {
            var drink = _machine.MakeDrink(drinkType, 1);

            Assert.That(drink, Is.Not.Null);
            Assert.That(drink.GetType().Name, Is.EqualTo(drinkType));
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        HotDrinkMachine machine = new HotDrinkMachine();

        IHotDrink drink  = machine.MakeDrink(HotDrinkMachine.AvailableDrink.Tea, 120);
        IHotDrink drink2 = machine.MakeDrink(HotDrinkMachine.AvailableDrink.Coffee, 500);

        drink.Consume();

        drink2.Consume();

        Debug.Log(Enum.GetName(typeof(HotDrinkMachine.AvailableDrink), 0));
        Debug.Log(Enum.GetName(typeof(HotDrinkMachine.AvailableDrink), 1));
    }
Esempio n. 3
0
        private static void AbstractFactoryTest()
        {
            var machine = new HotDrinkMachine();
            var drink   = machine.MakeDrink(AvaliableDrink.Coffee, 100);

            drink.Consume();
        }
Esempio n. 4
0
        public void MakeDrink_MakeCoffee_ReturnValueIsNotNull()
        {
            var hotDrinkMachine = new HotDrinkMachine();
            var drink           = hotDrinkMachine.MakeDrink(AvailableDrink.Coffee, 100);

            Assert.That(drink, Is.Not.Null);
        }
        public void Run()
        {
            var machine = new HotDrinkMachine();
            var drink   = machine.MakeDrink(HotDrinkMachine.AvaliableDrink.Coffee, 5);

            drink.Consume();
        }
Esempio n. 6
0
        static void Run()
        {
            var       machine = new HotDrinkMachine();
            IHotDrink drink   = machine.MakeDrink();

            drink.Consume();
        }
Esempio n. 7
0
        public AbstractFactoryDemo2()
        {
            var       machine = new HotDrinkMachine();
            IHotDrink drink   = machine.MakeDrink();

            drink.Consume();
        }
Esempio n. 8
0
            public static void Run()
            {
                var mc = new HotDrinkMachine();
                var d  = mc.MakeDrink(HotDrinkMachine.AvailableDrink.Coffee, 200);

                d.Consume();
            }
Esempio n. 9
0
        private static void Main(string[] args)
        {
            var machine = new HotDrinkMachine();
            //var drink = machine.MakeDrink(HotDrinkMachine.AvailableDrink.Tea, 300);
            //drink.Consume();

            var drink = machine.MakeDrink();

            drink.Consume();
        }
        public void Run()
        {
            var point = Point.Factory.NewPolarPoint(1.0, Math.PI / 2);

            Console.WriteLine(point);

            //var hotDrinkMachine = new HotDrinkMachineThatBreaksOpenClosedPrinciple();
            var hotDrinkMachine = new HotDrinkMachine();
            var coffee          = hotDrinkMachine.MakeDrink();

            coffee.Consume();
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            //p1
            //var machine = new HotDrinkMachine();
            //var drink = machine.MakeDrink(HotDrinkMachine.AvaliableDrink.Tea, 100);
            //drink.Consume();


            //p2
            var machine = new HotDrinkMachine();

            machine.MakeDrink();
        }
Esempio n. 12
0
        static void Main(string[] args)
        {
            //var point = Point.NewPolarPoint(1.0, Math.PI / 2);
            //Console.WriteLine(point);

            //var test = new AsyncFactoryMethod();
            //await test.InitAsync();

            //var point = Point.Factory.NewPolarPoint(1.0, Math.PI / 2);
            //Console.WriteLine(point);

            //var x = await AsyncFactoryMethod.CreateAsync();

            var machine = new HotDrinkMachine();
            //var drink = machine.MakeDrink(HotDrinkMachine.AvailbleDrink.Tea, 100);
            //drink.Consume();
            var drink = machine.MakeDrink();

            drink.Consume();
        }