public async Task Handle_builds_generic_message_when_firstName_is_null() { //Arrange var request = this.CreateCommandWithInviteeName(firstName: null, lastName: "last"); var message = "New meeting scheduled! View your calendar for details."; var to = "8675309"; _config["PhoneNumber"].Returns(to); //Act await _testSubject.Handle(request, CancellationToken.None); //Assert await _smsClient.Received().Send(to, message); }
public async Task When_Message_Is_Handled_Then_Should_Send_Sms() { const string deviceId = "1"; const string sensorId = "inside"; const double currentTemp = 1.0; const double coldSpellTemp = 2.0; const double minTemp = -5.0; var enteredAtUtc = new DateTime(2015, 1, 1, 12, 0, 0); var leftAtUtc = new DateTime(2015, 1, 1, 13, 30, 10); const string from = "0123456789"; const string to = "9876543210"; _configuration.SmsFrom.Returns(from); _configuration.SmsTo.Returns(to); var msg = new ColdSpellLeftNotification(deviceId, sensorId, currentTemp, coldSpellTemp, minTemp, enteredAtUtc, leftAtUtc); await _handler.HandleAsync(msg); _smsClient.Received().Send(from, to, "13:30: Cold spell over. (Temp: 1.0C, Min: -5.0C, Duration: 1h 30m)."); }