コード例 #1
0
        public void turn_off_a_turned_on_kettle()
        {
            Kettle      kettle      = new Kettle();
            PowerButton powerButton = new PowerButton();
            WarningLED  warning     = new WarningLED();

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

            Assert.AreEqual(false, kettle.KettelOn);
        }
コード例 #2
0
        public void cannot_turn_on_a_turned_on_kettle()
        {
            Kettle      kettle      = new Kettle();
            PowerButton powerButton = new PowerButton();
            WarningLED  warning     = new WarningLED();

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

            Assert.AreNotEqual(true, kettle.KettelOn);
        }
コード例 #3
0
        public void reset_values_when_turn_off()
        {
            Kettle      kettle  = new Kettle();
            PowerButton power   = new PowerButton();
            WarningLED  warning = new WarningLED();

            power.PressedPowerButton(kettle, warning);
            power.PressedPowerButton(kettle, warning);

            Assert.AreEqual(false, kettle.KettelOn);
            Assert.AreEqual(Color.Off, kettle.LED);
            Assert.AreEqual(null, kettle.Liquid);
        }
コード例 #4
0
        public void Red_LED_kettle_On()
        {
            Kettle      kettle  = new Kettle();
            PowerButton power   = new PowerButton();
            WarningLED  warning = new WarningLED();

            power.PressedPowerButton(kettle, warning);

            Assert.AreEqual(Color.Red, kettle.LED);
        }
コード例 #5
0
        public void kettle_turned_on()
        {
            Kettle      kettle  = new Kettle();
            PowerButton power   = new PowerButton();
            WarningLED  warning = new WarningLED();

            power.PressedPowerButton(kettle, warning);

            Assert.AreEqual(true, kettle.KettelOn);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #8
0
        public void temperature_rise_when_kettle_is_On()
        {
            Kettle      kettle = new Kettle();
            PowerButton power  = new PowerButton();

            kettle.Liquid = new LiquidButton(87);
            WarningLED warning = new WarningLED();

            power.PressedPowerButton(kettle, warning);
            kettle.Liquid.IncresedLiquidTemperature(kettle, warning);
            Assert.AreEqual(true, kettle.KettelOn);
            Assert.AreEqual(97, kettle.Liquid.Temperature);
        }
コード例 #9
0
        public void Green_LED_when_temperature_is_over_100()
        {
            Kettle      kettle = new Kettle();
            PowerButton power  = new PowerButton();

            kettle.Liquid = new LiquidButton(87);
            WarningLED warning = new WarningLED();

            power.PressedPowerButton(kettle, warning);
            kettle.Liquid.IncresedLiquidTemperature(kettle, warning);
            kettle.Liquid.IncresedLiquidTemperature(kettle, warning);
            Assert.AreEqual(true, kettle.KettelOn);
            Assert.AreEqual(107, kettle.Liquid.Temperature);
            Assert.AreEqual(Color.Green, kettle.LED);
        }
コード例 #10
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);
        }
コード例 #11
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);
        }