Esempio n. 1
0
        public When_ProviderQuarterlyUpdateEmailService_Is_Called_To_Request_Provider_Quarterly_Update(ProviderQuarterlyUpdateEmailFixture testFixture)
        {
            _emailService = Substitute.For <IEmailService>();

            _messageQueueService = Substitute.For <IMessageQueueService>();

            var providerRepository = Substitute.For <IProviderRepository>();

            _backgroundProcessHistoryRepository = Substitute.For <IRepository <BackgroundProcessHistory> >();

            _backgroundProcessHistoryRepository
            .CreateAsync(Arg.Any <BackgroundProcessHistory>())
            .Returns(1);

            providerRepository
            .GetProvidersWithFundingAsync()
            .Returns(new ValidProviderWithFundingDtoListBuilder().Build());

            var providerQuarterlyUpdateEmailService = new Application.Services.ProviderQuarterlyUpdateEmailService(testFixture.Logger,
                                                                                                                   _emailService,
                                                                                                                   providerRepository, _backgroundProcessHistoryRepository,
                                                                                                                   _messageQueueService, testFixture.DateTimeProvider);

            providerQuarterlyUpdateEmailService
            .RequestProviderQuarterlyUpdateAsync("TestUser")
            .GetAwaiter().GetResult();
        }
 public PlayerInfoQueryService(
     IMessageQueueService messageQueueService,
     ICommandService <LeaveRoomCommand> leaveRoomService)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_LeaveRoomService    = leaveRoomService ?? throw new ArgumentNullException(nameof(leaveRoomService));
 }
Esempio n. 3
0
        private void HandleQueueAsync(IMessageQueueService messageQueueService, long queueId)
        {
            var queue = messageQueueService.GetSingle(queueId);

            if (queue == null)
            {
                throw new MessageQueueHandleException(queueId, $"message queue with id {queueId} not found.");
            }

            RegexHelper.CheckMobile(queue.Mobile);
            ServiceResult messageResult = ServiceResult.Success;

            if (queue.TemplateCode <= 0)
            {
                messageResult = SendRawAsync(queue);
            }

            if (messageResult.Succeeded)
            {
                messageQueueService.HandleQueueAndUpdateContent(queueId, "message send  success!");
            }
            else
            {
                messageQueueService.ErrorQueue(queueId, $"message send fail !",
                                               messageResult.ToString());
            }
        }
Esempio n. 4
0
 public NextSongController(IVotingFinisher votingFinisher, IUnitOfWork unitOfWork, IMessageQueueService messageQueueService, IRootLifetimeScopeProvider rootLifetimeScopeProvider)
 {
     _votingFinisher            = votingFinisher;
     _unitOfWork                = unitOfWork;
     _messageQueueService       = messageQueueService;
     _rootLifetimeScopeProvider = rootLifetimeScopeProvider;
 }
Esempio n. 5
0
 public DefaultMessagePublisher(
     IMessageQueueService queueService,
     IAsyncMessageQueueService asyncQueueService)
 {
     _queueService      = queueService;
     _asyncQueueService = asyncQueueService;
 }
        public async Task Then_Update_Email_History_With_Status(
            string status,
            MatchingConfiguration configuration,
            IEmailService emailService,
            IOpportunityRepository opportunityRepository,
            IMessageQueueService messageQueueService,
            ILogger <Application.Services.EmailDeliveryStatusService> logger,
            EmailDeliveryStatusPayLoad payload
            )
        {
            //Arrange
            var sut = new Application.Services.EmailDeliveryStatusService(configuration,
                                                                          emailService, opportunityRepository, messageQueueService, logger);

            payload.Status = status;
            var serializedPayLoad = JsonConvert.SerializeObject(payload);

            emailService.UpdateEmailStatus(Arg.Any <EmailDeliveryStatusPayLoad>()).Returns(1);

            //Act
            var emailCount = await sut.HandleEmailDeliveryStatusAsync(serializedPayLoad);

            //Assert
            emailCount.Should().Be(1);

            await emailService.Received(1).UpdateEmailStatus(Arg.Any <EmailDeliveryStatusPayLoad>());

            await emailService.Received(1).UpdateEmailStatus(Arg.Is <EmailDeliveryStatusPayLoad>(data => data.Status == status));
        }
Esempio n. 7
0
 public GetSessionHandler(
     IMessageQueueService messageQueueService,
     IGetService <GetPlayerBySessionIdQuery, Registration> playerService)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_PlayerService       = playerService ?? throw new ArgumentNullException(nameof(playerService));
 }
Esempio n. 8
0
 public ReadQueue(
     string queueName,
     string messageQueueHostServerName,
     IMessageQueueService messageQueueService,
     ILogger logger,
     IEnvironment environment,
     ICancellationTokenProvider cancellationTokenProvider,
     bool isTransactional    = true,
     bool auditActivity      = true,
     bool defaultRecoverable = true,
     string multicastAddress = null)
     : base(
         logger,
         environment,
         queueName,
         messageQueueHostServerName,
         multicastAddress,
         QueueMode.Recv,
         isTransactional,
         auditActivity,
         defaultRecoverable,
         messageQueueService)
 {
     this.cancellationToken = cancellationTokenProvider.CancellationToken;
 }
        public async Task Then_Add_To_Failed_Queue_If_Status_Is_Not_Delivered(
            string status,
            MatchingConfiguration configuration,
            IEmailService emailService,
            IOpportunityRepository opportunityRepository,
            IMessageQueueService messageQueueService,
            ILogger <Application.Services.EmailDeliveryStatusService> logger,
            EmailDeliveryStatusPayLoad payload
            )
        {
            //Arrange
            payload.Status = status;
            var sut = new Application.Services.EmailDeliveryStatusService(configuration,
                                                                          emailService, opportunityRepository, messageQueueService, logger);

            var serializedPayLoad = JsonConvert.SerializeObject(payload);

            //Act
            await sut.HandleEmailDeliveryStatusAsync(serializedPayLoad);

            //Assert
            await emailService.Received(1).UpdateEmailStatus(Arg.Is <EmailDeliveryStatusPayLoad>(data => data.Status == status));

            await messageQueueService.Received(1).PushEmailDeliveryStatusMessageAsync(Arg.Any <SendEmailDeliveryStatus>());
        }
        public async Task Then_Do_Not_Update_Email_History_If_PayLoad_Is_Null_Or_Empty(
            string payload,
            MatchingConfiguration configuration,
            IRepository <Domain.Models.EmailHistory> emailHistoryRepository,
            IEmailService emailService,
            IOpportunityRepository opportunityRepository,
            IMessageQueueService messageQueueService,
            ILogger <Application.Services.EmailDeliveryStatusService> logger,
            Domain.Models.EmailHistory emailHistory
            )
        {
            //Arrange
            emailHistoryRepository
            .GetFirstOrDefaultAsync(Arg.Any <Expression <Func <Domain.Models.EmailHistory, bool> > >())
            .Returns(emailHistory);

            var sut = new Application.Services.EmailDeliveryStatusService(configuration,
                                                                          emailService, opportunityRepository, messageQueueService, logger);

            //Act
            var result = await sut.HandleEmailDeliveryStatusAsync(payload);

            //Assert
            result.Should().Be(-1);

            await emailHistoryRepository.DidNotReceive().GetFirstOrDefaultAsync(Arg.Any <Expression <Func <Domain.Models.EmailHistory, bool> > >());

            await emailHistoryRepository.DidNotReceive().UpdateWithSpecifiedColumnsOnlyAsync(
                Arg.Any <Domain.Models.EmailHistory>(),
                Arg.Any <Expression <Func <Domain.Models.EmailHistory, object> >[]>());

            await messageQueueService.DidNotReceive().PushEmailDeliveryStatusMessageAsync(Arg.Any <SendEmailDeliveryStatus>());
        }
        public async Task Then_Do_Not_Update_Email_History_If_Notification_Id_Does_Not_Exists_In_Callback_PayLoad(
            string status,
            MatchingConfiguration configuration,
            IEmailService emailService,
            IOpportunityRepository opportunityRepository,
            IMessageQueueService messageQueueService,
            ILogger <Application.Services.EmailDeliveryStatusService> logger,
            EmailDeliveryStatusPayLoad payload
            )
        {
            //Arrange
            payload.Id     = Guid.Empty;
            payload.Status = status;

            var sut = new Application.Services.EmailDeliveryStatusService(configuration,
                                                                          emailService, opportunityRepository, messageQueueService, logger);

            var serializedPayLoad = JsonConvert.SerializeObject(payload);

            emailService.UpdateEmailStatus(Arg.Any <EmailDeliveryStatusPayLoad>()).Returns(-1);

            //Act
            var result = await sut.HandleEmailDeliveryStatusAsync(serializedPayLoad);

            //Assert
            result.Should().Be(-1);

            await emailService.Received(1).UpdateEmailStatus(Arg.Is <EmailDeliveryStatusPayLoad>(data => data.Status == status));

            await messageQueueService.DidNotReceive().PushEmailDeliveryStatusMessageAsync(Arg.Any <SendEmailDeliveryStatus>());
        }
Esempio n. 12
0
 public GetRoomBySessionIdHandler(
     IMessageQueueService messageQueueService,
     IGetService <GetRoomBySessionIdQuery, string?> getRoomService)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_GetRoomService      = getRoomService ?? throw new ArgumentNullException(nameof(getRoomService));
 }
Esempio n. 13
0
 internal ImgTaskService(IImgRepository imgRepository, IMessageQueueService messageQueueService, IImgTaskProgressRepository imgTaskProgressRepository, IImgTaskResultRepository imgTaskResultRepository)
 {
     _imgRepository             = imgRepository;
     _messageQueueService       = messageQueueService;
     _imgTaskProgressRepository = imgTaskProgressRepository;
     _imgTaskResultRepository   = imgTaskResultRepository;
 }
        public When_Employer_Service_Is_Called_To_Handle_Valid_Employer_Created_Event_For_New_Employer()
        {
            var config = new MapperConfiguration(c => c.AddMaps(typeof(EmployerMapper).Assembly));
            var mapper = new Mapper(config);

            _employerRepository = Substitute.For <IRepository <Domain.Models.Employer> >();
            var opportunityRepository = Substitute.For <IOpportunityRepository>();

            _employerRepository.GetSingleOrDefaultAsync(Arg.Any <Expression <Func <Domain.Models.Employer, bool> > >())
            .Returns((Domain.Models.Employer)null);

            _messageQueueService = Substitute.For <IMessageQueueService>();

            var employerService = new EmployerService(_employerRepository, opportunityRepository, mapper, new CrmEmployerEventDataValidator(),
                                                      _messageQueueService);

            _employerEventBase = new CrmEmployerEventBaseBuilder()
                                 .WithValidAupaStatus().Build();

            var data = JsonConvert.SerializeObject(_employerEventBase, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore, MissingMemberHandling = MissingMemberHandling.Ignore
            });

            employerService.HandleEmployerCreatedAsync(data).GetAwaiter().GetResult();
        }
Esempio n. 15
0
 public MessageSenderService(IMessageNotificationValidator messageNotificationValidator, IMessageQueueService messageQueue, IMessageSender messageSender, IOptions <AppConfig> config, ILogger <MessageSenderService> logger)
 {
     this.messageNotificationValidator = messageNotificationValidator;
     this.messageQueueService          = messageQueue;
     this.messageSender = messageSender;
     this.config        = config;
     this.logger        = logger;
 }
Esempio n. 16
0
 public CashierServiceController(ICashierService service,
                                 IMessageQueueService messageQueueService,
                                 IOptions <ApplicationSettings> settings)
 {
     _settings     = settings;
     _service      = service;
     _messageQueue = messageQueueService;
 }
Esempio n. 17
0
 public NotificationController(IMessageQueueService notificationService, IOptions <ElasticConfig> config, ILoggerFactory loggerFactory,
                               IElasticConnectionClient elasticConnectionClient, SynkerDbContext context, IHubContext <NotificationHub> notifcationHubContext, IOptions <VapidKeysOptions> vapidKeysOptions)
     : base(config, loggerFactory, elasticConnectionClient, context)
 {
     _notificationService   = notificationService ?? throw new ArgumentNullException(nameof(notificationService));
     _vapidKeysConfig       = vapidKeysOptions.Value;
     _notifcationHubContext = notifcationHubContext;
 }
Esempio n. 18
0
 public DiskDriveService(IOptions <AppConfig> config, IDiskDriveConfigValidator diskDriveConfigValidator, IMessageConverter messageConverter, IDiskDriveInfo diskDriveInfo, IMessageQueueService messageQueueService, ILogger <DiskDriveService> logger)
 {
     this.config = config;
     this.diskDriveConfigValidator = diskDriveConfigValidator;
     this.messageConverter         = messageConverter;
     this.diskDriveInfo            = diskDriveInfo;
     this.messageQueueService      = messageQueueService;
     this.logger = logger;
 }
Esempio n. 19
0
 public ReferralService(
     IMessageQueueService messageQueueService,
     IRepository <OpportunityItem> opportunityItemRepository,
     IRepository <BackgroundProcessHistory> backgroundProcessHistoryRepository)
 {
     _messageQueueService                = messageQueueService;
     _opportunityItemRepository          = opportunityItemRepository;
     _backgroundProcessHistoryRepository = backgroundProcessHistoryRepository;
 }
Esempio n. 20
0
 public RoomListHandler(
     IMessageQueueService messageQueueService,
     IQueryService <RoomListQuery, RoomInfo> listRoomService,
     ILogger <RoomListHandler> logger)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_ListRoomService     = listRoomService ?? throw new ArgumentNullException(nameof(listRoomService));
     m_Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public UnregisterSessionHandler(
     IMessageQueueService messageQueueService,
     ICommandService <UnregisterSessionCommand> unregisterSessionService,
     ILogger <UnregisterSessionHandler> logger)
 {
     m_MessageQueueService      = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_UnregisterSessionService = unregisterSessionService ?? throw new ArgumentNullException(nameof(unregisterSessionService));
     m_Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 22
0
 public MemoryService(IOptions <AppConfig> config, IMemoryConfigValidator memoryConfigValidator, IMessageConverter messageConverter, IMemoryInfo memoryInfo, IMessageQueueService messageQueue, ILogger <MemoryService> logger)
 {
     this.config = config;
     this.memoryConfigValidator = memoryConfigValidator;
     this.messageConverter      = messageConverter;
     this.memoryInfo            = memoryInfo;
     this.messageQueue          = messageQueue;
     this.logger = logger;
 }
 public RegisterSessionHandler(
     IMessageQueueService messageQueueService,
     ICommandService <RegisterCommand> registerService,
     ILogger <RegisterSessionHandler> logger)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_RegisterService     = registerService ?? throw new ArgumentNullException(nameof(registerService));
     m_Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 24
0
 public ProductListService(
     IUnitOfWork unit,
     ILogger logger,
     IMessageQueueService messageQueueService)
 {
     _unit   = unit;
     _logger = logger;
     _messageQueueService = messageQueueService;
 }
Esempio n. 25
0
 public QuerySessionsByRoomHandler(
     IMessageQueueService messageQueueService,
     IQueryService <RoomSessionsQuery, string> roomSessionsService,
     IQueryService <PlayerInfoQuery, PlayerInfo> playerInfoService)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_RoomSessionsService = roomSessionsService ?? throw new ArgumentNullException(nameof(roomSessionsService));
     m_PlayerInfoService   = playerInfoService ?? throw new ArgumentNullException(nameof(playerInfoService));
 }
 public VotingController(IVotingCandidateRepository votingCandidateRepository, IUnitOfWork unitOfWork, IPrimitiveUserIdentificationService primitiveUserIdentificationService, IVoteService voteService, IMessageQueueService messageQueueService, IMapper mapper)
 {
     _votingCandidateRepository = votingCandidateRepository;
     _unitOfWork = unitOfWork;
     _primitiveUserIdentificationService = primitiveUserIdentificationService;
     _voteService         = voteService;
     _messageQueueService = messageQueueService;
     _mapper = mapper;
 }
        public InventoryItemsController(IInventoryRepository repository, IMessageQueueService messagingService,
			IInventoryTakeMessageCache messageCache, INotificationService notificationService, ILog logger)
        {
            _repository = repository;
            _messageCache = messageCache;
            _notificationService = notificationService;
            _logger = logger;
            _messagingService = messagingService;
        }
 public CommentController(CoreSettings coreSettings, ICommentService commentService, IModerationQueueService moderationQueueService, IMessageQueueService messageQueueService, IPermissionService permissionService, ITabHelper tabHelper, IWorkContext workContext)
 {
     _coreSettings = coreSettings;
     _commentService = commentService;
     _messageQueueService = messageQueueService;
     _moderationQueueService = moderationQueueService;
     _permissionService = permissionService;
     _tabHelper = tabHelper;
     _workContext = workContext;
 }
Esempio n. 29
0
 public JudgeService(WebHostDbContext dbContext,
                     IProblemService problemService,
                     ILanguageService languageService,
                     IMessageQueueService messageQueueService)
 {
     this.dbContext           = dbContext;
     this.problemService      = problemService;
     this.languageService     = languageService;
     this.messageQueueService = messageQueueService;
 }
 public UserController(IAuthenticationService authenticationService, IMessageQueueService messageQueueService, IProjectService projectService, IUserService userService, IWebHelper webHelper, IWorkContext workContext, IApiAuthenticationService apiAuthenticationService)
 {
     _authenticationService = authenticationService;
     _apiAuthenticationService = apiAuthenticationService;
     _messageQueueService = messageQueueService;
     _projectService = projectService;
     _userService = userService;
     _webHelper = webHelper;
     _workContext = workContext;
 }
 public ProjectService(ICacheManager cacheManager, IGeolocationService geolocationService, IMessageQueueService messageQueueService, IRepository<Project> projectRepository, IRepository<ProjectLocation> projectLocationRepository, IRepository<ProjectUserHistory> projectUserHistoryRepository, IWebHelper webHelper, IWorkContext workContext)
 {
     _cacheManager = cacheManager;
     _geolocationService = geolocationService;
     _messageQueueService = messageQueueService;
     _projectRepository = projectRepository;
     _projectLocationRepository = projectLocationRepository;
     _projectUserHistoryRepository = projectUserHistoryRepository;
     _webHelper = webHelper;
     _workContext = workContext;
 }
 public LeaveRoomHandler(
     IMessageQueueService messageQueueService,
     ICommandService <LeaveRoomCommand> leaveRoomService,
     IQueryService <RoomSessionsQuery, string> listRoomSessionsService,
     ILogger <LeaveRoomHandler> logger)
 {
     m_MessageQueueService     = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_LeaveRoomService        = leaveRoomService ?? throw new ArgumentNullException(nameof(leaveRoomService));
     m_ListRoomSessionsService = listRoomSessionsService ?? throw new ArgumentNullException(nameof(listRoomSessionsService));
     m_Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public MessageQueueBackground(
     IMessageQueueService messageQueueService,
     IServiceProvider serviceProvider,
     IEnumerable <ISubscribeRegistration> subscribes,
     ILogger <MessageQueueBackground> logger)
 {
     m_MessageQueueService = messageQueueService ?? throw new ArgumentNullException(nameof(messageQueueService));
     m_ServiceProvider     = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     m_Subscribes          = subscribes ?? throw new ArgumentNullException(nameof(subscribes));
     m_Logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 34
0
        public async Task Then_Do_Not_Update_Email_History_If_PayLoad_Notification_Id_Is_Null(
            string status,
            MatchingDbContext dbContext,
            [Frozen] Domain.Models.Opportunity opportunity,
            [Frozen] Domain.Models.Provider provider,
            [Frozen] Domain.Models.ProviderVenue venue,
            [Frozen] EmailHistory emailHistory,
            [Frozen] BackgroundProcessHistory backgroundProcessHistory,
            IMessageQueueService messageQueueService,
            EmailDeliveryStatusPayLoad payload,
            MatchingConfiguration configuration,
            ILogger <OpportunityRepository> opportunityRepoLogger,
            ILogger <GenericRepository <EmailTemplate> > emailTemplateLogger,
            ILogger <GenericRepository <EmailHistory> > emailHistoryLogger,
            ILogger <GenericRepository <FunctionLog> > functionLogLogger,
            ILogger <Application.Services.EmailDeliveryStatusService> emailDeliveryServiceStatusLogger,
            ILogger <EmailService> emailServiceLogger,
            IAsyncNotificationClient notificationClient
            )
        {
            //Arrange
            await DataBuilder.SetTestData(dbContext, provider, venue, opportunity, backgroundProcessHistory);

            dbContext.Add(emailHistory);
            await dbContext.SaveChangesAsync();

            payload.Status = status;
            payload.Id     = Guid.Empty;

            var sut = SutSetUp(dbContext, opportunityRepoLogger, emailTemplateLogger, emailHistoryLogger, functionLogLogger,
                               emailDeliveryServiceStatusLogger, emailServiceLogger, notificationClient, configuration, messageQueueService);

            var serializedPayLoad = JsonConvert.SerializeObject(payload);

            //Act
            await sut.HandleEmailDeliveryStatusAsync(serializedPayLoad);

            //Assert
            var data = dbContext.EmailHistory.FirstOrDefault(em => em.NotificationId == payload.Id);

            data.Should().BeNull();

            var existingData = dbContext.EmailHistory.Where(history => history.OpportunityId == opportunity.Id).ToList();

            existingData.Select(history => history.ModifiedBy).Should().Equal(new List <string> {
                null, null
            });
            existingData.Select(history => history.ModifiedOn).Should().Equal(new List <string> {
                null, null
            });

            await messageQueueService.DidNotReceive().PushEmailDeliveryStatusMessageAsync(Arg.Any <SendEmailDeliveryStatus>());
        }
 public ProjectController(CoreSettings coreSettings, ICategoryService categoryService, IModerationQueueService moderationQueueService, IPermissionService permissionService, IProjectService projectService, ITabHelper tabHelper, IUserService userService, IMessageQueueService messageQueueService, IWebHelper webHelper, IWorkContext workContext)
 {
     _coreSettings = coreSettings;
     _categoryService = categoryService;
     _moderationQueueService = moderationQueueService;
     _messageQueueService = messageQueueService;
     _permissionService = permissionService;
     _projectService = projectService;
     _tabHelper = tabHelper;
     _userService = userService;
     _webHelper = webHelper;
     _workContext = workContext;
 }
 public ContactController(IMessageQueueService messageQueueService, SiteSettings siteSettings, IUserService userService)
 {
     _messageQueueService = messageQueueService;
     _siteSettings = siteSettings;
     _userService = userService;
 }