/// <summary> /// Constructs a Vending item, given the individual properties /// </summary> /// <param name="slot">The item's slot</param> /// <param name="name">The item's name</param> /// <param name="price">The item's price</param> /// <param name="type">The item's type</param> public VendingItem(string slot, string name, decimal price, SnackType type) { this.Slot = slot; this.Name = name; this.Price = price; this.Type = type; }
/// <summary> /// Constructs a Vending Item from a string from file input /// </summary> /// <param name="input">The standard string formating from the stocking file</param> public VendingItem(string input) { string[] temp = input.Split('|'); this.Slot = temp[0]; this.Name = temp[1]; this.Price = decimal.Parse(temp[2]); this.Type = (SnackType)Enum.Parse(typeof(SnackType), temp[3]); }
public static IDisposable ASnack(string message, int durationInMs = 4, SnackType type = SnackType.Info) { Color bgColor = Color.White; Color textColor = Color.White; switch (type) { case SnackType.Info: bgColor = Color.FromHex("#98c6dd"); textColor = Color.FromHex("#31708f"); break; case SnackType.Error: bgColor = Color.FromHex("#FFBABA"); textColor = Color.FromHex("#D8000C"); break; case SnackType.Success: bgColor = Color.FromHex("#DFF2BF"); textColor = Color.FromHex("#4F8A10"); break; case SnackType.Warning: bgColor = Color.FromHex("#FEEFB3"); textColor = Color.FromHex("#9F6000"); break; default: break; } return(UserDialogs.Instance.Toast(new ToastConfig(message) { Duration = TimeSpan.FromSeconds(durationInMs), BackgroundColor = bgColor, MessageTextColor = textColor, Position = ToastPosition.Bottom })); }
public void Constructor_From_Multiple_Inputs_Works(string slot, string name, double price, SnackType type) { VendingItem vendingItem = new VendingItem(slot, name, (decimal)price, type); Assert.AreEqual(slot, vendingItem.Slot); Assert.AreEqual(name, vendingItem.Name); Assert.AreEqual((decimal)price, vendingItem.Price); Assert.AreEqual(type, vendingItem.Type); }