public void SetStateTest() { Action act = () => OvenManager.SetState(this.Maker, 220, OvenState.Heating); act.Should().NotThrow(); this.Maker.FirstOven.State.Should().Be(OvenState.Heating); }
public void HandleSiwtchOnTest() { Action act = () => OvenManager.HandleSwitchOn(null, new OnSwitchOnEventArgs { Maker = this.Maker }); act.Should().NotThrow(); this.Maker.FirstOven.State.Should().Be(OvenState.Heating); }
public void HandleClockTickTest() { var arg = new OnClockTickEventArgs { Maker = this.Maker }; Action act = () => OvenManager.HandleClockTick(null, arg); act.Should().NotThrow(); this.Maker.FirstOven.State.Should().Be(OvenState.Off); this.Maker.FirstOven.CurrentTemperature.Should().Be(22); }
public void HandleHeatingBorderTickTest() { OvenManager.SetState(this.Maker, 232, OvenState.Heating); Switcher.SetSwitch(this.Maker, SwitchState.On); var arg = new OnClockTickEventArgs { Maker = this.Maker }; Action act = () => OvenManager.HandleClockTick(null, arg); act.Should().NotThrow(); this.Maker.FirstOven.State.Should().Be(OvenState.Cooling); this.Maker.FirstOven.CurrentTemperature.Should().Be(240); }
public void HandleOffBiscuitHeatingTickTest() { this.Maker.FirstConveyor.Belt.Add(Biscuit.Create(true, true, false)); OvenManager.SetState(this.Maker, 235, OvenState.Heating); Switcher.SetSwitch(this.Maker, SwitchState.Off); var arg = new OnClockTickEventArgs { Maker = this.Maker }; Action act = () => OvenManager.HandleClockTick(null, arg); act.Should().NotThrow(); this.Maker.FirstOven.State.Should().Be(OvenState.Cooling); this.Maker.FirstOven.CurrentTemperature.Should().Be(240); }
public void HandleFirstClockTickTest() { Switcher.SetSwitch(this.Maker, SwitchState.On); OvenManager.SetState(this.Maker, 220, OvenState.Heating); var hasPulsed = false; var motor = new Motor(); motor.RaisePulse += (s, e) => hasPulsed = true; Action act = () => motor.HandleClockTick(null, new OnClockTickEventArgs { Maker = this.Maker }); act.Should().NotThrow(); hasPulsed.Should().BeTrue(); }
public void HandleOffWithBiscuitClockTickTest() { Switcher.SetSwitch(this.Maker, SwitchState.Off); OvenManager.SetState(this.Maker, 220, OvenState.Heating); this.Maker.FirstConveyor.Belt.Add(Biscuit.Create(true, true, false)); var hasPulsed = false; var motor = new Motor(); var arg = new OnClockTickEventArgs { Maker = this.Maker }; motor.RaisePulse += (s, e) => hasPulsed = true; Action act = () => motor.HandleClockTick(null, arg); act.Should().NotThrow(); hasPulsed.Should().BeTrue(); }