//init
 public SqlEventSettingsQueries(ISenderDbContextFactory dbContextFactory, INotificationsMapperFactory mapperFactory
                                , IDispatchTemplateQueries <long> dispatchTemplateQueries)
 {
     _dbContextFactory        = dbContextFactory;
     _mapper                  = mapperFactory.GetMapper();
     _dispatchTemplateQueries = dispatchTemplateQueries;
 }
Beispiel #2
0
 //init
 public SqlSignalDispatchQueries(SqlConnectionSettings connectionSettings
                                 , ISenderDbContextFactory dbContextFactory, INotificationsMapperFactory mapperFactory)
 {
     _connectionSettings = connectionSettings;
     _dbContextFactory   = dbContextFactory;
     _mapper             = mapperFactory.GetMapper();
 }
            public void then_dispatch_templates_updated_are_found_using_ef()
            {
                List <long> templateIds = _insertedTemplates.Select(x => x.DispatchTemplateId).ToList();
                List <DispatchTemplateLong> actualList = DbContext.DispatchTemplates
                                                         .Where(x => templateIds.Contains(x.DispatchTemplateId))
                                                         .OrderBy(x => x.EventSettingsId)
                                                         .ThenBy(x => x.DispatchTemplateId)
                                                         .ToList();

                actualList.Should().NotBeEmpty();
                actualList.Count.Should().Be(_insertedTemplates.Count);


                INotificationsMapperFactory mapperFactory = Mocker.GetServiceInstance <INotificationsMapperFactory>();
                IMapper mapper = mapperFactory.GetMapper();

                for (int i = 0; i < _insertedSettings.Count; i++)
                {
                    DispatchTemplateLong    actualItem       = actualList[i];
                    DispatchTemplate <long> mappedActualItem = mapper.Map <DispatchTemplate <long> >(actualItem);
                    DispatchTemplate <long> expectedItem     = _insertedTemplates[i];

                    mappedActualItem.Should().BeEquivalentTo(expectedItem);
                }
            }
            public void then_dispatch_templates_inserted_are_found_using_ef()
            {
                INotificationsMapperFactory mapperFactory = Mocker.GetServiceInstance <INotificationsMapperFactory>();
                IMapper mapper = mapperFactory.GetMapper();

                List <DispatchTemplateLong> actual = DbContext.DispatchTemplates
                                                     .OrderBy(x => x.EventSettingsId)
                                                     .ThenBy(x => x.DispatchTemplateId)
                                                     .ToList();

                List <DispatchTemplate <long> > expected = _insertedData
                                                           .SelectMany(x => x.Templates)
                                                           .ToList();

                actual.Should().NotBeEmpty();
                int expectedCount = _insertedData.Sum(x => x.Templates.Count);

                actual.Count.Should().Be(expectedCount);

                for (int i = 0; i < _insertedData.Count; i++)
                {
                    DispatchTemplateLong    actualItem       = actual[i];
                    DispatchTemplate <long> mappedActualItem = mapper.Map <DispatchTemplate <long> >(actualItem);
                    DispatchTemplate <long> expectedItem     = expected[i];

                    expectedItem.EventSettingsId    = mappedActualItem.EventSettingsId;
                    expectedItem.DispatchTemplateId = mappedActualItem.DispatchTemplateId;

                    mappedActualItem.Should().BeEquivalentTo(expectedItem);
                }
            }
Beispiel #5
0
 //init
 public SqlSignalBounceQueries(ISenderDbContextFactory dbContextFactory
                               , INotificationsMapperFactory mapperFactory)
 {
     _dbContextFactory = dbContextFactory;
     _mapper           = mapperFactory.GetMapper();
 }
Beispiel #6
0
 //init
 public SqlDispatchTemplateQueries(ISenderDbContextFactory dbContextFactory, INotificationsMapperFactory mapperFactory)
 {
     _dbContextFactory = dbContextFactory;
     _mapper           = mapperFactory.GetMapper();
 }
 //init
 public SqlConsolidationLockQueries(ISenderDbContextFactory dbContextFactory
                                    , INotificationsMapperFactory mapperFactory)
 {
     _dbContextFactory = dbContextFactory;
     _mapper           = mapperFactory.GetMapper();
 }
 //init
 public SqlSubscriberScheduleSettingsQueries(ISenderDbContextFactory dbContextFactory
                                             , INotificationsMapperFactory mapperFactory)
 {
     _dbContextFactory = dbContextFactory;
     _mapper           = mapperFactory.GetMapper();
 }