예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }