public async Task ShouldStopConveyorMovementWhenPaused()
        {
            //Arrange
            var motorMovementsBeforePause = 0;
            var motorMovementsAfterPause  = 0;
            var isPaused        = false;
            var eventDispatcher = new EventDispatcherService();

            eventDispatcher.RegisterHandler <MotorActivatedEvent>(async e =>
            {
                if (!isPaused)
                {
                    motorMovementsBeforePause++;
                }
                else
                {
                    motorMovementsAfterPause++;
                }
                await Task.Delay(0);
            });

            BiscuitMachine machine = CreateBiscuitMachine(eventDispatcher, 5, 15, 2, 2);

            //Act
            await machine.TurnOn();

            await HeatOven(eventDispatcher);

            await Task.Delay(2000);

            await machine.Pause();

            isPaused = true;
            await Task.Delay(2000);

            await machine.TurnOff();

            //Assert
            Assert.True(isPaused);
            Assert.True(motorMovementsBeforePause > 0);
            Assert.Equal(0, motorMovementsAfterPause);
        }
        public async Task ShouldMaintainOvenTemperatureWhenPaused()
        {
            //Arrange
            const int minOvenTemperature = 5;
            const int maxOvenTemperature = 15;

            var            eventDispatcher = new EventDispatcherService();
            BiscuitMachine machine         = CreateBiscuitMachine(eventDispatcher, minOvenTemperature, maxOvenTemperature, 2, 2);

            //Act
            await machine.TurnOn();

            await HeatOven(eventDispatcher);

            await machine.Pause();

            var temperatureLog = await LogOvenTemperatureChanges(eventDispatcher, 20);

            await machine.TurnOff();

            //Assert
            Assert.True(temperatureLog.TrueForAll(x => x >= minOvenTemperature && x <= maxOvenTemperature));
        }