public async Task When_Notification_Is_Handled_Then_Should_Send_Sms() { const double currentTemp = 1.5; const double coldSpellTemp = 2.0; var enteredAtUtc = new DateTime(2015, 1, 1, 12, 0, 0, DateTimeKind.Utc); var notification = CreateNotification(currentTemp, coldSpellTemp, enteredAtUtc); await Handler.HandleAsync(notification); SmsClient.Received().Send(From, To, "12:00: Entered cold spell. (Temp: 1.5C)."); ColdSpellRepository.Received().SaveAsync(Arg.Is <ColdSpell>(cs => cs.AlertedAt == _utcNow)); }
public async Task When_Notification_Is_Handled_Then_Should_Add_Entity_To_Repository() { const double currentTemp = 1.5; const double coldSpellTemp = 2.0; var enteredAtUtc = new DateTime(2015, 1, 1, 12, 0, 0, DateTimeKind.Utc); var notification = CreateNotification(currentTemp, coldSpellTemp, enteredAtUtc); await Handler.HandleAsync(notification); ColdSpellRepository.Received().SaveAsync(Arg.Is <ColdSpell>(cs => cs.AlertedAt == _utcNow && cs.DeviceId == DeviceId && cs.SensorId == SensorId)); }