コード例 #1
0
ファイル: Coffee.cs プロジェクト: benichka/EventManagement
 /// <summary>
 /// Complete constructor.
 /// </summary>
 /// <param name="name">Name of the coffee to create.</param>
 /// <param name="bean">Bean of the coffee to create. The type of bean can not be changed afterward.</param>
 /// <param name="countryOfOrigin">Country of origin of the coffee to create.The country of origin can not be changed afterward.</param>
 /// <param name="strength">Strength of the coffee to create. The strength of the coffee can not be changed afterward.</param>
 public Coffee(string name, string bean, string countryOfOrigin, CoffeeStrength strength)
 {
     Name            = name;
     Bean            = bean;
     CountryOfOrigin = countryOfOrigin;
     Strength        = strength;
 }
コード例 #2
0
 public CoffeeSettings(string coffeeName, float waterUsed, float coffeeSeedsUsed, CoffeeStrength coffeeStrength, CoffeeSize coffeeSize)
 {
     this.coffeeName      = coffeeName;
     this.waterUsed       = waterUsed;
     this.coffeeSeedsUsed = coffeeSeedsUsed;
     this.coffeeSize      = coffeeSize;
     this.coffeeStrength  = coffeeStrength;
 }
コード例 #3
0
    public void ChangeCoffeeType(CoffeeStrength coffeeStrength)
    {
        if (!machineEnabled)
        {
            return;
        }

        selectedCoffeeStrength = coffeeStrength;
    }
コード例 #4
0
        // TODO: What if we have 10 coffee settings? Also maybe move it into separate class like ControlPanel.
        public void ChangeCoffeeStrength()
        {
            if (!Operational)
            {
                return;
            }

            coffeeStrength         = NextSetting <CoffeeStrength>(coffeeStrength, sizeToWaterAmount.Count - 1);
            currentCoffee.strength = coffeeStrength;

            display.DisplayTimedMsg(DisplayMessage.SetCoffeeStrength, coffeeStrength.ToString());
        }
コード例 #5
0
    public Coffee GetSpecificCoffee(CoffeeStrength coffeeStrength, CoffeeSize coffeeSize)
    {
        foreach (var coffeeSettings in possibleCoffees)
        {
            if (coffeeSettings.CoffeeSize == coffeeSize && coffeeSettings.CoffeeStrength == coffeeStrength)
            {
                return(coffeeSettings.GetCoffeeFromThisSettings());
            }
        }

        Debug.LogError($"[{this}] Couldn't find settings for that type of coffee: {coffeeSize}, {coffeeStrength}");
        return(null);
    }
コード例 #6
0
        public void Load(string baseId)
        {
            CoffeeMachineState state = SaveLoadSystem.Load <CoffeeMachineState>(baseId, "CoffeeMachine");

            if (state == null)
            {
                state = new CoffeeMachineState();
            }

            currentCoffee        = state.currentCoffee;
            coffeeSetFromOutside = state.coffeeSetFromOutside;
            coffeeStrength       = state.coffeeStrength;
            coffeeSize           = state.coffeeSize;

            if (state.status == Status.Idle || state.status == Status.Busy)
            {
                TurnOn();
            }

            MyLog.TryLog(this, $"Loaded", debug);
            MyLog.TryLog(this, JsonConvert.SerializeObject(state), debug);
        }
コード例 #7
0
 public void SetStrength(CoffeeStrength strength)
 {
     ReturnStatus result = sendCommand(0x35, new byte[1] {
         (byte)strength
     });
 }
コード例 #8
0
    public void EstimateCoffeeStrength_Returns_Expected_CoffeeStrength_For_Button_Pressed_1_2_or_3(int buttonPressed,
                                                                                                   CoffeeStrength expectedCoffeeStrength)
    {
        // Act
        var coffeeStrength = _estimator.EstimateCoffeeStrength(buttonPressed);

        // Assert
        Assert.AreEqual(expectedCoffeeStrength, coffeeStrength);
    }