Beispiel #1
0
 public static JobAdExportPostEventEntity Map(this JobAdExportPostEvent evt)
 {
     return(new JobAdExportPostEventEntity
     {
         id = evt.Id,
         JobAdIntegrationEventEntity = ((JobAdIntegrationEvent)evt).Map(),
         failed = evt.Failed,
         posted = evt.Posted,
         updated = evt.Updated,
     });
 }
Beispiel #2
0
        public void TestCreateExportPostEvent()
        {
            var integratorUserId = Guid.NewGuid();
            var evt = new JobAdExportPostEvent {
                IntegratorUserId = integratorUserId, Success = true, JobAds = 5, Failed = 2, Posted = 3, Updated = 4
            };

            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt);

            var report = _jobAdIntegrationReportsQuery.GetJobAdIntegrationReports(DayRange.Today);

            Assert.AreEqual(1, report.Count);
            Assert.IsTrue(report.ContainsKey(integratorUserId));
            var integratorReport = report[integratorUserId];

            Assert.AreEqual(1, integratorReport.ExportPostReport.Events);
            Assert.AreEqual(1, integratorReport.ExportPostReport.Successes);
            Assert.AreEqual(evt.JobAds, integratorReport.ExportPostReport.JobAds);
            Assert.AreEqual(evt.Failed, integratorReport.ExportPostReport.Failed);
            Assert.AreEqual(evt.Posted, integratorReport.ExportPostReport.Posted);
            Assert.AreEqual(evt.Updated, integratorReport.ExportPostReport.Updated);
        }
Beispiel #3
0
        public void TestMultipleIntegratorsMultipleEvents()
        {
            var integratorUserId1 = Guid.NewGuid();
            var integratorUserId2 = Guid.NewGuid();

            // JobAdExportFeedEvent

            JobAdIntegrationEvent evt1 = new JobAdExportFeedEvent {
                IntegratorUserId = integratorUserId1, JobAds = 3
            };

            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt1);

            JobAdIntegrationEvent evt2 = new JobAdExportFeedEvent {
                IntegratorUserId = integratorUserId2, JobAds = 6
            };

            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt2);

            // JobAdExportFeedId

            evt1 = new JobAdExportFeedIdEvent {
                IntegratorUserId = integratorUserId1, JobAds = 3
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt1);

            evt2 = new JobAdExportFeedIdEvent {
                IntegratorUserId = integratorUserId2, JobAds = 6
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt2);

            // JobAdExportPost

            evt1 = new JobAdExportPostEvent {
                IntegratorUserId = integratorUserId1, JobAds = 3
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt1);

            evt2 = new JobAdExportPostEvent {
                IntegratorUserId = integratorUserId2, JobAds = 6
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt2);

            // JobAdExportClose

            evt1 = new JobAdExportCloseEvent {
                IntegratorUserId = integratorUserId1, JobAds = 3
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt1);

            evt2 = new JobAdExportCloseEvent {
                IntegratorUserId = integratorUserId2, JobAds = 6
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt2);

            // JobAdImportPost

            evt1 = new JobAdImportPostEvent {
                IntegratorUserId = integratorUserId1, JobAds = 3
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt1);

            evt2 = new JobAdImportPostEvent {
                IntegratorUserId = integratorUserId2, JobAds = 6
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt2);

            // JobAdImportCLose

            evt1 = new JobAdImportCloseEvent {
                IntegratorUserId = integratorUserId1, JobAds = 3
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt1);

            evt2 = new JobAdImportCloseEvent {
                IntegratorUserId = integratorUserId2, JobAds = 6
            };
            _jobAdIntegrationReportsCommand.CreateJobAdIntegrationEvent(evt2);

            var report = _jobAdIntegrationReportsQuery.GetJobAdIntegrationReports(DayRange.Today);

            Assert.AreEqual(2, report.Count);

            Assert.IsTrue(report.ContainsKey(integratorUserId1));
            var integratorReport = report[integratorUserId1];

            Assert.AreEqual(1, integratorReport.ExportFeedReport.Events);
            Assert.AreEqual(1, integratorReport.ExportFeedIdReport.Events);
            Assert.AreEqual(1, integratorReport.ExportPostReport.Events);
            Assert.AreEqual(1, integratorReport.ExportCloseReport.Events);
            Assert.AreEqual(1, integratorReport.ImportPostReport.Events);
            Assert.AreEqual(1, integratorReport.ImportCloseReport.Events);

            Assert.IsTrue(report.ContainsKey(integratorUserId2));
            integratorReport = report[integratorUserId2];
            Assert.AreEqual(1, integratorReport.ExportFeedReport.Events);
            Assert.AreEqual(1, integratorReport.ExportFeedIdReport.Events);
            Assert.AreEqual(1, integratorReport.ExportPostReport.Events);
            Assert.AreEqual(1, integratorReport.ExportCloseReport.Events);
            Assert.AreEqual(1, integratorReport.ImportPostReport.Events);
            Assert.AreEqual(1, integratorReport.ImportCloseReport.Events);
        }