Esempio n. 1
0
        /// <summary>
        /// Gets the action buttons.
        /// </summary>
        /// <param name="actions">The actions.</param>
        /// <returns></returns>
        public static List <LiquidButton> GetActionButtons(string actions)
        {
            var buttonList = new List <LiquidButton>();

            foreach (var actionButton in actions.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries))
            {
                var button  = new LiquidButton();
                var details = actionButton.Split(new char[] { '^' });
                if (details.Length > 0)
                {
                    button.Name = details[0];

                    if (details.Length > 1)
                    {
                        var definedValue = DefinedValueCache.Get(details[1].AsGuid());
                        if (definedValue != null)
                        {
                            button.Html      = definedValue.GetAttributeValue("ButtonHTML");
                            button.EmailHtml = definedValue.GetAttributeValue("ButtonEmailHTML");
                        }
                    }
                }

                buttonList.Add(button);
            }

            return(buttonList);
        }
Esempio n. 2
0
        public void differents_liquids_can_have_different_temperatures()
        {
            LiquidButton liquid1 = new LiquidButton(15);
            LiquidButton liquid2 = new LiquidButton(30);

            Assert.AreNotEqual(liquid1.Temperature, liquid2.Temperature);
        }
Esempio n. 3
0
        public void temperature_cannot_rise_if_kettle_is_Off()
        {
            Kettle kettle = new Kettle();

            Assert.AreEqual(15, kettle.Temperature);

            LiquidButton liquidButton = new LiquidButton();
            WarningLED   warning      = new WarningLED();

            liquidButton.IncresedLiquidTemperature(warning, kettle);

            Assert.AreEqual(15, kettle.Temperature);
        }
Esempio n. 4
0
        public void temperature_cannot_rise_if_there_is_no_liquid_in_the_kettle()
        {
            Kettle      kettle = new Kettle();
            PowerButton power  = new PowerButton();

            kettle.Liquid = null;
            LiquidButton liquid  = new LiquidButton(85);
            WarningLED   warning = new WarningLED();


            power.PressedPowerButton(kettle, warning);
            kettle.Liquid.IncresedLiquidTemperature(kettle, warning);
        }
Esempio n. 5
0
        public void one_kettle_can_have_only_one_liquid()
        {
            Kettle       kettle  = new Kettle();
            LiquidButton liquid1 = new LiquidButton(15);
            LiquidButton liquid2 = new LiquidButton(30);

            kettle.Liquid = liquid1;
            Assert.AreEqual(liquid1, kettle.Liquid);

            kettle.Liquid = liquid2;
            Assert.AreNotSame(liquid1, liquid2);
            Assert.AreEqual(liquid2, kettle.Liquid);
            Assert.AreNotEqual(liquid1, kettle.Liquid);
        }
Esempio n. 6
0
        public void Green_LED_when_temperature_is_over_100()
        {
            Kettle       kettle       = new Kettle();
            PowerButton  powerButton  = new PowerButton();
            LiquidButton liquidButton = new LiquidButton();
            WarningLED   warning      = new WarningLED();

            powerButton.PressedPowerButton(warning, kettle);

            for (int i = 0; i < 9; i++)
            {
                liquidButton.IncresedLiquidTemperature(warning, kettle);
            }

            Assert.AreEqual(Color.Green, kettle.LED);
        }
Esempio n. 7
0
        public void temperature_rise_when_kettle_is_On()
        {
            Kettle       kettle       = new Kettle();
            PowerButton  powerButton  = new PowerButton();
            LiquidButton liquidButton = new LiquidButton();
            WarningLED   warning      = new WarningLED();

            powerButton.PressedPowerButton(warning, kettle);
            liquidButton.IncresedLiquidTemperature(warning, kettle);

            Assert.AreEqual(true, kettle.KettelOn);
            Assert.AreEqual(25, kettle.Temperature);

            liquidButton.IncresedLiquidTemperature(warning, kettle);

            Assert.AreEqual(35, kettle.Temperature);
        }
Esempio n. 8
0
        public void reset_values_when_turn_off()
        {
            Kettle       kettle       = new Kettle();
            PowerButton  powerButton  = new PowerButton();
            LiquidButton liquidButton = new LiquidButton();
            WarningLED   warning      = new WarningLED();

            powerButton.PressedPowerButton(warning, kettle);

            for (int i = 0; i < 9; i++)
            {
                liquidButton.IncresedLiquidTemperature(warning, kettle);
            }

            powerButton.PressedPowerButton(warning, kettle);

            Assert.AreEqual(false, kettle.KettelOn);
            Assert.AreEqual(Color.Off, kettle.LED);
            Assert.AreEqual(15, kettle.Temperature);
        }