Esempio n. 1
0
        public void Heater_AtStartUp_IsTurnedOn()
        {
            FireTimersWithPeriod(1000u, 1000);

            BoilerDataType model = GetBoilerModel();

            BoilerHeaterStateType state       = model.HeaterState;
            BoilerTemperatureType temperature = model.Temperature;
            int pressure = model.Pressure;

            state.Should().Be(BoilerHeaterStateType.On, "heater should start in 'on' state");
            pressure.Should().BeGreaterThan(10_000, "pressure should start at 10k and get higher");

            temperature.Top.Should().Be(pressure - 100_005, "top is always 100,005 less than pressure. Pressure: {0}", pressure);
            temperature.Bottom.Should().Be(pressure - 100_000, "bottom is always 100,000 less than pressure. Pressure: {0}", pressure);
        }
Esempio n. 2
0
        public void Heater_CanBeTurnedOff()
        {
            // let heater run for a few seconds to make temperature rise
            FireTimersWithPeriod(1000u, 1000);

            TurnHeaterOff();

            FireTimersWithPeriod(1000u, 1000);

            BoilerDataType model = GetBoilerModel();

            BoilerHeaterStateType state       = model.HeaterState;
            BoilerTemperatureType temperature = model.Temperature;
            int pressure = model.Pressure;

            state.Should().Be(BoilerHeaterStateType.Off, "heater should have been turned off");
            pressure.Should().BeGreaterThan(10_000, "pressure should start at 10k and get higher");

            temperature.Top.Should().Be(pressure - 100_005, "top is always 100,005 less than pressure. Pressure: {0}", pressure);
            temperature.Bottom.Should().Be(pressure - 100_000, "btoom is always 100,000 less than pressure. Pressure: {0}", pressure);
        }