コード例 #1
0
            public async Task When_Moisture_Remains_Above_Min_Then_Should_Not_Send_Irrigate_Command()
            {
                GivenTheMoistureMinIs(10);

                var telemetry = MoistureTelemetry.Create(DeviceId, SensorId, 11);

                await Handler.HandleAsync(telemetry);

                CommandService.DidNotReceive().RaiseAsync(Arg.Any <IrrigateCommand>());
            }
コード例 #2
0
            public async Task When_Moisture_Drops_Below_Min_Then_Should_Send_Irrigate_Command()
            {
                GivenTheMoistureMinIs(10);
                GivenTheIrrigationDurationIs(TimeSpan.FromMinutes(5));

                var telemetry = MoistureTelemetry.Create(DeviceId, SensorId, 10);

                await Handler.HandleAsync(telemetry);

                var command = (IrrigateCommand)_capturedCommand;

                command.DeviceId.Should().Be(DeviceId);
                command.SensorId.Should().Be(SensorId);
                command.Duration.Should().Be(300000);
            }