Esempio n. 1
0
        public void StopIcedTeaWithMilkOrder()
        {
            DrinkBuilder drinkBuilder = new DrinkBuilder();
            Barista      helen        = new Barista(drinkBuilder);
            var          tea          = new DrinkType("Tea", 1.5);
            var          icedTea      = new DrinkType("Iced Tea", 1.5);

            var milk  = new Topping("Milk", 0.5);
            var sugar = new Topping("Sugar", 0.5);

            var jonsToppings = new List <Topping>()
            {
                milk, sugar
            };
            var jonsDrinkTea = helen.OrderDrink(tea, jonsToppings);

            var robisToppings = new List <Topping>()
            {
                milk
            };
            var robisDrinkIcedTea = helen.OrderDrink(icedTea, robisToppings);

            helen.PrepareDrink(jonsDrinkTea);
            helen.PrepareDrink(robisDrinkIcedTea);

            helen.StopOrder(robisDrinkIcedTea);

            var completeDrinks = helen.ServeDrinkOrders();


            Assert.IsFalse(completeDrinks.Contains(robisDrinkIcedTea));
        }
Esempio n. 2
0
        public Drink(DrinkType type)
        {
            this.type = type;
            switch (type)
            {
            case DrinkType.FlatWater:
                this.price = 2.50;
                this.name  = "Flat Water";
                break;

            case DrinkType.SparklingWater:
                this.price = 2.50;
                this.name  = "Sparkling Water";
                break;

            case DrinkType.Cola:
                this.price = 2.75;
                this.name  = "Cola";
                break;

            case DrinkType.IceTea:
                this.name  = "Ice Tea";
                this.price = 2.75;
                break;

            case DrinkType.EnergyDrink:
                this.name  = "Energy Drink";
                this.price = 3.75;
                break;

            default:
                break;
            }
        }
Esempio n. 3
0
        private Glass GetFullFlass(DrinkType drinkType)
        {
            var fillLevel = 100;

            this.WriteLine($"<Robot> Filled a new glass of {drinkType} to {fillLevel}% level");
            return(new Glass(drinkType, fillLevel));
        }
Esempio n. 4
0
        /// <summary>
        /// 点酒
        /// </summary>
        public virtual void PointMenu()
        {
            string    name     = Attributes.FindChild("name").GetValue <string>();
            DrinkType winetype = Attributes.FindChild("winetype").GetValue <DrinkType>();

            GameEventMachine.SendEvent(GameEventID.Event_Drinker_PointMenu, name, winetype);
        }
Esempio n. 5
0
 public Junior(DrinkType drink, SideType side, SizeType size, double price)
 {
     _drink = drink;
     _side  = side;
     _size  = size;
     _price = price;
 }
        public static Attachment ChooseDrinkSubTypeCard(DrinkType drinkType)
        {
            HeroCard whatCanYouDoCard = new HeroCard();
            var      data             = new List <string> {
                "红茶", "绿茶", "猫屎咖啡", "黑糖玛奇朵咖啡", "酸奶", "纯牛奶"
            };
            int    drinkTypeNum    = Convert.ToInt32(drinkType);
            string drinkTupeString = drinkType.ToString();

            whatCanYouDoCard.Title   = "Please choose the sub type of drink you want.";
            whatCanYouDoCard.Buttons = new List <CardAction>()
            {
                new CardAction
                {
                    Type  = ActionTypes.ImBack,
                    Value = data[drinkTypeNum],
                    Title = data[drinkTypeNum]
                },
                new CardAction
                {
                    Type  = ActionTypes.ImBack,
                    Value = data[drinkTypeNum + 1],
                    Title = data[drinkTypeNum + 1]
                },
            };

            return(whatCanYouDoCard.ToAttachment());
        }
        public void ShouldGetDrinksWithType(DrinkType drinkType)
        {
            var inventory = new MockInventory()
            {
                Drinks = new List <Drink>()
                {
                    new Drink()
                    {
                        Name = "MockDrink", Type = drinkType
                    },
                    new Drink()
                    {
                        Name = "Another", Type = drinkType
                    },
                    new Drink()
                    {
                        Name = "NotThisOne", Type = DrinkType.Unknown
                    }
                }
            };

            var drinks = inventory.GetDrinks(drinkType);

            Assert.Collection(drinks, drink => Assert.Equal("MockDrink", drink.Name),
                              drink => Assert.Equal("Another", drink.Name));
        }
Esempio n. 8
0
 public static Image GetDrinksButtonImage(Size size, Color backColor, DrinkType type)
 {
     _dImage.Initialize((int)type);
     _dImage.Size      = size;
     _dImage.BackColor = backColor;
     return(_dImage.GetImage());
 }
Esempio n. 9
0
        public override void MakeDecision(DrinkType chosenDrink)
        {
            switch (chosenDrink)
            {
            case DrinkType.Water:
                PourWater();
                break;

            case DrinkType.Espresso:
                MakeEspresso();
                break;

            case DrinkType.Latte:
                MakeLatte();
                break;

            case DrinkType.BlackTea:
                MakeBlackTea();
                break;

            case DrinkType.Americano:
                MakeAmericano();
                break;

            default:
                Console.WriteLine("Invalid Input.");
                break;
            }
            base.MakeDecision(0);
        }
        public bool HandleUserDrinkOptionInput(string input)
        {
            DrinkType drinkType = new DrinkType();
            int enumlen = Enum.GetNames(typeof(DrinkType)).Length;
            int passesDrinkType;
            if (int.TryParse((string)input, out passesDrinkType)) // value passed is an int * menu option
            {
                if (enumlen < passesDrinkType || passesDrinkType == 0)
                {
                    return false;
                }
                else
                {
                    return true;
                }
            }
            else
            {
                try
                {
                    drinkType = (DrinkType)Enum.Parse(typeof(DrinkType), input);
                }
                catch (ArgumentException)
                {
                    return false;
                    //EnterDrinkOption(false);
                }

            }
            return true;
        }
        public override void MakeDecision(DrinkType chosenDrink)
        {
            switch (chosenDrink)
            {
            case DrinkType.Water:
                PourWater();
                break;

            case DrinkType.Espresso:
                MakeEspresso();
                break;

            case DrinkType.DoubleEspresso:
                MakeDoubleEspresso();
                break;

            case DrinkType.Cappuccino:
                MakeCappuccino();
                break;

            case DrinkType.GreenTea:
                MakeGreenTea();
                break;

            case DrinkType.Mocachino:
                MakeMocachino();
                break;

            default:
                Console.WriteLine("Invalid Input.");
                break;
            }
            base.MakeDecision(0);
        }
Esempio n. 12
0
        public override IDictionary <string, EntityProperty> WriteEntity(OperationContext operationContext)
        {
            var properties = base.WriteEntity(operationContext);

            properties.Add(nameof(DrinkType), new EntityProperty(DrinkType.ToString()));
            return(properties);
        }
Esempio n. 13
0
        public override DrinkType GiveMenu()
        {
            base.GiveMenu();
            Console.WriteLine("1. Water");
            Console.WriteLine("2. Espresso");
            Console.WriteLine("3. Latte");
            Console.WriteLine("4. BlackTea");
            Console.WriteLine("5. Americano");
            int       chosenDrinkNum = int.Parse(Console.ReadLine());
            DrinkType chosenDrink    = DrinkType.Water;

            if (chosenDrinkNum == 1)
            {
                chosenDrink = DrinkType.Water;
            }
            else if (chosenDrinkNum == 2)
            {
                chosenDrink = DrinkType.Espresso;
            }
            else if (chosenDrinkNum == 3)
            {
                chosenDrink = DrinkType.Latte;
            }
            else if (chosenDrinkNum == 4)
            {
                chosenDrink = DrinkType.BlackTea;
            }
            else if (chosenDrinkNum == 5)
            {
                chosenDrink = DrinkType.Americano;
            }

            return(chosenDrink);
        }
Esempio n. 14
0
 public Drink(DrinkType type, int numberOfSugars, bool isExtraHot)
 {
     this.type           = type;
     this.numberOfSugars = numberOfSugars;
     this.isExtraHot     = isExtraHot;
     hasStick            = numberOfSugars > 0;
 }
Esempio n. 15
0
        public void ShouldGetRandomDrinkWithType(DrinkType drinkType)
        {
            var inventory = new MockInventory()
            {
                Drinks = new List <Drink>()
                {
                    new Drink()
                    {
                        Name = "MockDrink", Type = drinkType
                    },
                    new Drink()
                    {
                        Name = "NotThisDrink", Type = DrinkType.Unknown
                    }
                }
            };

            for (var i = 0; i < 10000; i++)
            {
                var drink = inventory.GetRandomDrink(drinkType);

                Assert.Equal("MockDrink", drink.Name);
                Assert.Equal(drinkType, drink.Type);
            }
        }
Esempio n. 16
0
 public DrinkDTO(string id, DrinkType drinkType, string name, double?alcPrc, double?volume)
 {
     this.Id        = id ?? throw new ArgumentNullException(nameof(id));
     this.DrinkType = drinkType;
     this.Name      = name ?? throw new ArgumentNullException(nameof(name));
     this.AlcPrc    = alcPrc;
     this.Volume    = volume;
 }
Esempio n. 17
0
 public void EquipDrink(DrinkType drink)
 {
     foreach (var item in drinks)
     {
         item.SetActive(false);
     }
     drinks[(int)drink].SetActive(true);
 }
Esempio n. 18
0
 public static string GetHotDrinksDisplayName(DrinkType hotDrinksName)
 {
     if (DisplayHotDrinkNameDictionary.ContainsKey(hotDrinksName))
     {
         return(DisplayHotDrinkNameDictionary[hotDrinksName]);
     }
     return("Not in Dictionary Yet");
 }
Esempio n. 19
0
 public static string GetWhiteWineDisplayName(DrinkType whiteWineName)
 {
     if (DisplayWhiteWineNameDictionary.ContainsKey(whiteWineName))
     {
         return(DisplayWhiteWineNameDictionary[whiteWineName]);
     }
     return("Not in Dictionary Yet");
 }
Esempio n. 20
0
 public static string GetRedWineDisplayName(DrinkType redWineName)
 {
     if (DisplayRedWineNameDictionary.ContainsKey(redWineName))
     {
         return(DisplayRedWineNameDictionary[redWineName]);
     }
     return("Not in Dictionary Yet");
 }
Esempio n. 21
0
 public Burger(DrinkType drink, SideType side, MainDishType main, SizeType size, double price)
 {
     _drink = drink;
     _side  = side;
     _main  = main;
     _size  = size;
     _price = price;
 }
Esempio n. 22
0
 public static string GetDraftBeerDisplayName(DrinkType draftBeerName)
 {
     if (DisplayDraftBeerNameDictionary.ContainsKey(draftBeerName))
     {
         return(DisplayDraftBeerNameDictionary[draftBeerName][0]);
     }
     return("Not in Dictionary Yet");
 }
Esempio n. 23
0
 public static decimal GetDbItemId(DrinkType drinkType)
 {
     if (DrinkTypeDbIdDictionary.ContainsKey(drinkType))
     {
         return(DrinkTypeDbIdDictionary[drinkType]);
     }
     return(0);
 }
Esempio n. 24
0
 public static string GetBottledBeerDisplayName(DrinkType bottledBeerName)
 {
     if (DisplayBottledBeerNameDictionary.ContainsKey(bottledBeerName))
     {
         return(DisplayBottledBeerNameDictionary[bottledBeerName][0]);
     }
     return("Not in Dictionary Yet");
 }
Esempio n. 25
0
        public void DetermineNotEnoughMoneyForDrinkOrder(DrinkType drinkOrder, decimal amountPaid)
        {
            var moneyModule = new MoneyModule {
                DrinkOrder = drinkOrder, AmountPaid = amountPaid
            };

            Assert.False(moneyModule.IsOrderPaid());
        }
Esempio n. 26
0
 public DrinkActivityInfo(DrinkType drinkType, string drinkId, string drinkName, double?drinkAlcPrc, double?drinkVolume)
 {
     this.DrinkType   = drinkType;
     this.DrinkId     = drinkId ?? throw new ArgumentNullException(nameof(drinkId));
     this.DrinkName   = drinkName ?? throw new ArgumentNullException(nameof(drinkName));
     this.DrinkAlcPrc = drinkAlcPrc;
     this.DrinkVolume = drinkVolume;
 }
        public void TranslateOrder_ShouldReturnInstructionObject(string drinkName, double drinkCost, int sugarQuantity)
        {
            var   drinkType = new DrinkType(drinkName, drinkCost);
            Order order     = new Order(drinkType, sugarQuantity);
            var   result    = DrinkMakerProtocol.TranslateOrder(order);

            Assert.IsType <Instruction>(result);
        }
        public void TranslateOrder_ShouldReturnCorrectString_FromOrderObject(string expected, string drinkName, double drinkCost, int sugarQuantity)
        {
            var   drinkType    = new DrinkType(drinkName, drinkCost);
            Order order        = new Order(drinkType, sugarQuantity);
            var   actualResult = DrinkMakerProtocol.TranslateOrder(order);

            Assert.Equal(expected, actualResult.InstructionMessage);
        }
Esempio n. 29
0
 public Drink(string drinkName, DrinkType drinkType, string manufacturer, int kkalQty, int price)
 {
     DrinkName    = drinkName;
     DrinkType    = drinkType;
     Manufacturer = manufacturer;
     KkalQty      = kkalQty;
     Price        = price;
 }
 public static string GetImageName(DrinkType kind)
 {
     if (!_namePairsCache.ContainsKey(kind))
     {
         object resourceImage = Resources.ResourceManager.GetObject(kind == DrinkType.Tea ? "TeaImageName" : kind == DrinkType.Coffee ? "CoffeeImageName" : kind == DrinkType.Juice ? "JuiceImageName" : "ProgressImageName");
         _namePairsCache.Add(kind, (resourceImage != null) && (resourceImage is string) ? resourceImage as string : string.Empty);
     }
     return(_namePairsCache[kind] as string);
 }
Esempio n. 31
0
 public ActionResult <HotDrink> GetDrink(DrinkType type)
 {
     return(type switch
     {
         DrinkType.Coffee => new Coffee(),
         DrinkType.Chocolate => new Chocolate(),
         DrinkType.LemonTea => new LemonTea(),
         _ => throw new InvalidDrinkTypeException(type + " is not a valid drink type.")
     });
Esempio n. 32
0
 public static Drink Create(DrinkType type)
 {
     switch (type)
     {
         case DrinkType.Coffee:
             return new Coffee();
         case DrinkType.RedBull:
             return new RedBull();
         case DrinkType.Water:
             return new Water();
         case DrinkType.StarburstSmoothie:
             return new StarburstSmoothie();
         case DrinkType.OrangeJuice:
             return new OrangeJuice();
         default:
             return new NullDrink();
     }
 }
Esempio n. 33
0
 public decimal GetValue(DrinkType type)
 {
     return _drinkCosts[type];
 }
Esempio n. 34
0
 public void SetDrinkType(DrinkType drinkType)
 {
     _drink = drinkType;
 }