public async Task NotQueueAnythingIfTheRequestCannotBeFound() { var notification = new RequestStatusChangedNotification { RequestId = Guid.NewGuid(), NewStatus = RequestStatus.Completed }; var backgroundJobClient = new Mock <IBackgroundJobClient>(); var sut = new SendRequestStatusToGetASmokeAlarmHandler(Context, backgroundJobClient.Object); await sut.Handle(notification); backgroundJobClient.Verify(x => x.Create(It.IsAny <Job>(), It.IsAny <EnqueuedState>()), Times.Never); }
public async Task EnqueueAJobIfTheNewStatusIsASupportedStatus(RequestStatus newStatus) { var notification = new RequestStatusChangedNotification { RequestId = requestId, NewStatus = newStatus }; var backgroundJobClient = new Mock <IBackgroundJobClient>(); var sut = new SendRequestStatusToGetASmokeAlarmHandler(Context, backgroundJobClient.Object); await sut.Handle(notification); backgroundJobClient.Verify(x => x.Create(It.IsAny <Job>(), It.IsAny <EnqueuedState>()), Times.Once); }
public async Task NotQueueUpAnythingIfTheRequestStatusIsNotASupportedStatus() { var notification = new RequestStatusChangedNotification { RequestId = requestId, NewStatus = RequestStatus.PendingConfirmation }; var backgroundJobClient = new Mock <IBackgroundJobClient>(); var sut = new SendRequestStatusToGetASmokeAlarmHandler(Context, backgroundJobClient.Object); await sut.Handle(notification); backgroundJobClient.Verify(x => x.Create(It.IsAny <Job>(), It.IsAny <EnqueuedState>()), Times.Never); }
public async Task MapValuesCorrectlyToGasaValues(RequestStatus newStatus, string expectedGasaStatus, bool expectedAcceptance) { var notification = new RequestStatusChangedNotification { RequestId = requestId, NewStatus = newStatus }; var backgroundJobClient = new Mock <IBackgroundJobClient>(); var sut = new SendRequestStatusToGetASmokeAlarmHandler(Context, backgroundJobClient.Object); await sut.Handle(notification); backgroundJobClient.Verify(x => x.Create(It.Is <Job>( job => job.Method.Name == nameof(SendRequestStatusToGetASmokeAlarm.Send) && (string)job.Args[0] == providerRequestId && (string)job.Args[1] == expectedGasaStatus && (bool)job.Args[2] == expectedAcceptance), It.IsAny <EnqueuedState>()), Times.Once); }