示例#1
0
        private void ShouldEnqueueConsentNotificationAndReturnAccepted()
        {
            const string consentMangerId     = "consentMangerId";
            var          notification        = TestBuilder.Notification();
            var          faker               = new Faker();
            var          consentNotification = new ConsentArtefactRepresentation(notification,
                                                                                 DateTime.Now,
                                                                                 faker.Random.Hash());

            consentRepository.Setup(x => x.AddAsync(
                                        new Consent(notification.ConsentDetail.ConsentId,
                                                    notification.ConsentDetail,
                                                    notification.Signature,
                                                    ConsentStatus.GRANTED,
                                                    consentMangerId)));
            var correlationId = Uuid.Generate().ToString();

            var result = consentNotificationController.ConsentNotification(correlationId, consentNotification);

            backgroundJobClient.Verify(client => client.Create(
                                           It.Is <Job>(job => job.Method.Name == "StoreConsent" && job.Args[0] == consentNotification),
                                           It.IsAny <EnqueuedState>()));
            consentRepository.Verify();
            result.StatusCode.Should().Be(StatusCodes.Status202Accepted);
        }
示例#2
0
        private void ShouldEnqueueConsentNotificationAndReturnAccepted()
        {
            var result = consentNotificationController.ConsentNotification(consentNotification);

            backgroundJobClient.Verify(client => client.Create(
                                           It.Is <Job>(job => job.Method.Name == "StoreConsent" && job.Args[0] == consentNotification),
                                           It.IsAny <EnqueuedState>()));
            consentRepository.Verify();
            result.StatusCode.Should().Be(StatusCodes.Status202Accepted);
        }