示例#1
0
        public void CompileReportWithParamTest()
        {
            //Arrange
            var interval = new Interval();

            var additionalReport = new DomainReport();
            var report1          = new DomainReport();
            var report2          = new DomainReport();

            var reports = new List <DomainReport>()
            {
                report1, report2
            };

            var reportAccumulator     = new Mock <IReportAccumulator>();
            var standartReportService = new Mock <IStandardReportService>();

            var compiler = new ReportsCompiler(reportAccumulator.Object, standartReportService.Object, interval);

            standartReportService.Setup(m => m.GetDayReports(interval)).Returns(reports);

            //Act
            var report = compiler.CompileReport(additionalReport);

            //Assert
            reportAccumulator.Verify(m => m.Accumulate(report1, report), Times.Once());
            reportAccumulator.Verify(m => m.Accumulate(report2, report), Times.Once());
            reportAccumulator.Verify(m => m.Accumulate(additionalReport, report), Times.Once());
        }
示例#2
0
        public DomainReport CompileReport(DomainReport additionalReport = null)
        {
            var domainReport = new DomainReport {
                Interval = _interval.Days.ToString(CultureInfo.InvariantCulture)
            };
            IEnumerable <DomainStatWatching>         watchings     = _statisticsService.GetWatchings(_interval);
            IEnumerable <DomainStatUserRegistration> registrations = _statisticsService.GetUserRegistrations(_interval);
            IEnumerable <DomainStatProjectUploading> uploadings    = _statisticsService.GetProjectUploadings(_interval);
            IEnumerable <DomainStatProjectDeletion>  deletions     = _statisticsService.GetProjectDeletions(_interval);

            foreach (DomainStatWatching domainStatWatching in watchings)
            {
                _filtersManager.FilterStatWatching(domainStatWatching, domainReport);
            }
            foreach (DomainStatUserRegistration domainStatUserRegistration in registrations)
            {
                _filtersManager.FilterStatUserRegistration(domainStatUserRegistration, domainReport);
            }
            foreach (DomainStatProjectUploading domainStatProjectUploading in uploadings)
            {
                DomainStatProjectState domainStatProjectState = _statisticsService.GetProjectState(domainStatProjectUploading.ProjectId);
                _filtersManager.FilterStatProjectUploading(domainStatProjectState, domainReport);
            }
            foreach (DomainStatProjectDeletion domainStatProjectDeletion in deletions)
            {
                DomainStatProjectState domainStatProjectState = _statisticsService.GetProjectState(domainStatProjectDeletion.ProjectId);
                _filtersManager.FilterStatProjectDeletion(domainStatProjectState, domainReport);
                _filtersManager.FilterStatProjectCancellation(domainStatProjectState, domainReport);
            }

            return(domainReport);
        }
        public void CallTest()
        {
            //Arrange
            var domainStatProjectState1 = new DomainStatProjectState()
            {
                Producer = ProductName.TaggerAndroid, IsSuccessfulUpload = true
            };
            var domainStatProjectState2 = new DomainStatProjectState()
            {
                Producer = ProductName.TaggerAndroid, IsSuccessfulUpload = false
            };
            var domainStatProjectState3 = new DomainStatProjectState()
            {
                Producer = "ProductName", IsSuccessfulUpload = true
            };

            var domainReport = new DomainReport();

            var statProjectUploadingFilter = new Mock <IStatProjectUploadingFilter>();

            var taggerAndroidUploadsFilter = new TaggerAndroidUploadsFilter();

            taggerAndroidUploadsFilter.Set(statProjectUploadingFilter.Object);

            //Act
            taggerAndroidUploadsFilter.Call(domainStatProjectState1, domainReport);
            taggerAndroidUploadsFilter.Call(domainStatProjectState2, domainReport);
            taggerAndroidUploadsFilter.Call(domainStatProjectState3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.TaggerAndroidSuccessfulUploads);
            statProjectUploadingFilter.Verify(m => m.Call(domainStatProjectState1, domainReport), Times.Once());
            statProjectUploadingFilter.Verify(m => m.Call(domainStatProjectState2, domainReport), Times.Once());
            statProjectUploadingFilter.Verify(m => m.Call(domainStatProjectState3, domainReport), Times.Once());
        }
示例#4
0
        public void CallTest()
        {
            //Arrange
            var domainStatUserRegistration1 = new DomainStatUserRegistration()
            {
                ProductName = ProductName.CicMac
            };
            var domainStatUserRegistration2 = new DomainStatUserRegistration()
            {
                ProductName = "ProductName"
            };
            var domainStatUserRegistration3 = new DomainStatUserRegistration();

            var domainReport = new DomainReport();

            var statUserRegistrationFilter = new Mock <IStatUserRegistrationFilter>();

            var cicMacRegistrationsFilter = new CicMacRegistrationsFilter();

            cicMacRegistrationsFilter.Set(statUserRegistrationFilter.Object);

            //Act
            cicMacRegistrationsFilter.Call(domainStatUserRegistration1, domainReport);
            cicMacRegistrationsFilter.Call(domainStatUserRegistration2, domainReport);
            cicMacRegistrationsFilter.Call(domainStatUserRegistration3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.CicMacRegistrations);
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration1, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration2, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration3, domainReport), Times.Once());
        }
        public async Task GetLastAllDaysReportTest()
        {
            //Arrange
            var domainReport    = new DomainReport();
            var reportEntityAll = new StandardReportV3Entity()
            {
                Interval = "All"
            };
            var repository = new Mock <IRepository <StandardReportV3Entity> >();

            var repositoryFactory = new Mock <IRepositoryFactory>();
            var valueConverter    = new Mock <ITableValueConverter>();
            var mapper            = new Mock <IReportMapper>();

            repositoryFactory.Setup(m => m.Create <StandardReportV3Entity>(Tables.StandardReportV3)).Returns(repository.Object);
            repository.Setup(m => m.GetLastReport(It.Is <ReportQueryObject>(p => p.Interval == "All"))).Returns(async() => reportEntityAll);
            mapper.Setup(m => m.ReportEntityToDomain(reportEntityAll)).Returns(domainReport);

            var standardReportService = new StandardReportService(repositoryFactory.Object, valueConverter.Object, mapper.Object);

            //Act
            var report = await standardReportService.GetLastAllDaysReport();

            //Assert
            Assert.AreEqual(domainReport, report);
        }
        public void CallTest()
        {
            //Arrange
            const string portalUrl = "portalUrl";

            var domainReport        = new DomainReport();
            var domainStatWatching1 = new DomainStatWatching();
            var domainStatWatching2 = new DomainStatWatching()
            {
                UrlReferrer = "UrlReferrer"
            };
            var domainStatWatching3 = new DomainStatWatching()
            {
                UrlReferrer = portalUrl
            };

            var statWatchingFilter = new Mock <IStatWatchingFilter>();

            var embedViewsFilter = new EmbeddedViewsFilter(portalUrl);

            embedViewsFilter.Set(statWatchingFilter.Object);

            //Act
            embedViewsFilter.Call(domainStatWatching1, domainReport);
            embedViewsFilter.Call(domainStatWatching2, domainReport);
            embedViewsFilter.Call(domainStatWatching3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.EmbeddedViews);
            statWatchingFilter.Verify(m => m.Call(domainStatWatching1, domainReport), Times.Once());
            statWatchingFilter.Verify(m => m.Call(domainStatWatching2, domainReport), Times.Once());
            statWatchingFilter.Verify(m => m.Call(domainStatWatching3, domainReport), Times.Once());
        }
示例#7
0
        public void CallTest()
        {
            //Arrange
            var domainStatUserRegistration1 = new DomainStatUserRegistration()
            {
                IdentityProvider = IdentityType.Google.ToString()
            };
            var domainStatUserRegistration2 = new DomainStatUserRegistration()
            {
                IdentityProvider = "IdentityProvider"
            };
            var domainStatUserRegistration3 = new DomainStatUserRegistration();

            var domainReport = new DomainReport();

            var statUserRegistrationFilter = new Mock <IStatUserRegistrationFilter>();

            var googleRegistrationsFilter = new GoogleRegistrationsFilter();

            googleRegistrationsFilter.Set(statUserRegistrationFilter.Object);

            //Act
            googleRegistrationsFilter.Call(domainStatUserRegistration1, domainReport);
            googleRegistrationsFilter.Call(domainStatUserRegistration2, domainReport);
            googleRegistrationsFilter.Call(domainStatUserRegistration3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.GoogleRegistrations);
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration1, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration2, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration3, domainReport), Times.Once());
        }
示例#8
0
        public void CallTest()
        {
            //Arrange
            var domainStatProjectState1 = new DomainStatProjectState()
            {
                Producer = ProductName.CicIPad, IsSuccessfulUpload = true
            };
            var domainStatProjectState2 = new DomainStatProjectState()
            {
                Producer = ProductName.CicIPad, IsSuccessfulUpload = false
            };
            var domainStatProjectState3 = new DomainStatProjectState()
            {
                Producer = "ProductName", IsSuccessfulUpload = true
            };

            var domainReport = new DomainReport();

            var statProjectDeletionFilter = new Mock <IStatProjectDeletionFilter>();

            var cicIPadDeletionsFilter = new CicIPadDeletionsFilter();

            cicIPadDeletionsFilter.Set(statProjectDeletionFilter.Object);

            //Act
            cicIPadDeletionsFilter.Call(domainStatProjectState1, domainReport);
            cicIPadDeletionsFilter.Call(domainStatProjectState2, domainReport);
            cicIPadDeletionsFilter.Call(domainStatProjectState3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.CicIPadDeletions);
            statProjectDeletionFilter.Verify(m => m.Call(domainStatProjectState1, domainReport), Times.Once());
            statProjectDeletionFilter.Verify(m => m.Call(domainStatProjectState2, domainReport), Times.Once());
            statProjectDeletionFilter.Verify(m => m.Call(domainStatProjectState3, domainReport), Times.Once());
        }
示例#9
0
        public List <DomainReport> BuildReports(DateTime dateTime)
        {
            Interval dayInterval   = _intervalHelper.GetLastDay(dateTime);
            Interval weekInterval  = _intervalHelper.GetLastWeek(dateTime);
            Interval monthInterval = _intervalHelper.GetLastMonth(dateTime);

            ICompiler dayReportCompiler    = _compilerFactory.Create(dayInterval);
            ICompiler weekReportCompiler   = _compilerFactory.Create(weekInterval);
            ICompiler monthReportCompiler  = _compilerFactory.Create(monthInterval);
            ICompiler allDaysReortCompiler = _compilerFactory.Create(null);

            DomainReport dayReport     = dayReportCompiler.CompileReport();
            DomainReport weekReport    = weekReportCompiler.CompileReport(dayReport);
            DomainReport monthReport   = monthReportCompiler.CompileReport(dayReport);
            DomainReport allDaysReport = allDaysReortCompiler.CompileReport(dayReport);

            var reports = new List <DomainReport>
            {
                dayReport,
                weekReport,
                monthReport,
                allDaysReport
            };

            return(reports);
        }
示例#10
0
        public async Task <StandardReport> BuildReport(DateTime dateTime)
        {
            List <DomainReport> reports = await _standardReportService.GetReports(dateTime);

            DomainReport dayDomainReport     = reports.FirstOrDefault(p => p.Interval == "1");
            DomainReport weekDomainReport    = reports.FirstOrDefault(p => p.Interval == "7");
            DomainReport monthDomainReport   = reports.FirstOrDefault(p => p.Interval == "30");
            DomainReport allDaysDomainReport = reports.FirstOrDefault(p => p.Interval == "All");
            Interval     dayInterval         = _intervalHelper.GetLastDay(dateTime);
            Interval     weekInterval        = _intervalHelper.GetLastWeek(dateTime);
            Interval     monthInterval       = _intervalHelper.GetLastMonth(dateTime);
            Interval     allInterval         = _intervalHelper.GetAllDays(dateTime);

            Report dayReport     = _reportMapper.DomainReportToDto(dayDomainReport, dayInterval);
            Report weekReport    = _reportMapper.DomainReportToDto(weekDomainReport, weekInterval);
            Report monthReport   = _reportMapper.DomainReportToDto(monthDomainReport, monthInterval);
            Report allDaysReport = _reportMapper.DomainReportToDto(allDaysDomainReport, allInterval);

            return(new StandardReport
            {
                DateTime = dateTime,
                LastDay = dayReport,
                LastWeek = weekReport,
                LastMonth = monthReport,
                AllDays = allDaysReport
            });
        }
示例#11
0
        public void CompileReportTest()
        {
            //Arrange
            const int days       = 12;
            var       startDate  = new DateTime(3452345234);
            var       finishDate = startDate.Add(TimeSpan.FromDays(days));
            var       interval   = new Interval()
            {
                Start = startDate, Finish = finishDate
            };

            var report1 = new DomainReport();
            var report2 = new DomainReport();

            var reports = new List <DomainReport>()
            {
                report1, report2
            };

            var reportAccumulator     = new Mock <IReportAccumulator>();
            var standartReportService = new Mock <IStandardReportService>();

            var compiler = new ReportsCompiler(reportAccumulator.Object, standartReportService.Object, interval);

            standartReportService.Setup(m => m.GetDayReports(interval)).Returns(reports);

            //Act
            var report = compiler.CompileReport();

            //Assert
            Assert.AreEqual(days.ToString(CultureInfo.InvariantCulture), report.Interval);
            reportAccumulator.Verify(m => m.Accumulate(report1, report), Times.Once());
            reportAccumulator.Verify(m => m.Accumulate(report2, report), Times.Once());
            reportAccumulator.Verify(m => m.Accumulate(null, report), Times.Never());
        }
        public async Task GetDomainReportUnknownDomain()
        {
            IgnoreMissingJson(" / Alexa category", " / Alexa domain info", " / Alexa rank", " / BitDefender category", " / BitDefender domain info", " / Categories", " / detected_communicating_samples", " / detected_downloaded_samples", " / detected_referrer_samples", " / detected_urls", " / domain_siblings", " / Dr.Web category", " / Opera domain info", " / Pcaps", " / Resolutions", " / subdomains", " / TrendMicro category", " / undetected_communicating_samples", " / undetected_downloaded_samples", " / undetected_referrer_samples", " / Websense ThreatSeeker category", " / Webutation domain info", " / whois", " / whois_timestamp", " / WOT domain info");

            DomainReport report = await VirusTotal.GetDomainReport(Guid.NewGuid() + ".com");

            Assert.Equal(ReportResponseCode.NotPresent, report.ResponseCode);
        }
        public void GetDomainReportInvalidDomain()
        {
            //This test should pass, but VT have added "." as a domain, which should not happen.
            //It therefore fails, which is to be expcted until VT team fixes this bug.
            DomainReport report = _virusTotal.GetDomainReport(".");

            Assert.AreEqual(ReportResponseCode.Error, report.ResponseCode);
        }
示例#14
0
        public void InvalidateDomainReport(DomainReport domainReport)
        {
            SubItems[2].Text = domainReport.Available.ToString();

            if (domainReport.Available)
            {
                SubItems[3].Text = domainReport.Price.ToString(CultureInfo.InvariantCulture);
            }
        }
示例#15
0
        public async Task GetDomainReportUnknownDomain()
        {
            //Reports don't contain all these fields when it is unknown
            IgnoreMissingJson(" / undetected_urls", " / Alexa category", " / Alexa domain info", " / Alexa rank", " / BitDefender category", " / BitDefender domain info", " / Categories", " / detected_communicating_samples", " / detected_downloaded_samples", " / detected_referrer_samples", " / detected_urls", " / domain_siblings", " / Dr.Web category", " / Forcepoint ThreatSeeker category", " / Opera domain info", " / Pcaps", " / Resolutions", " / subdomains", " / TrendMicro category", " / undetected_communicating_samples", " / undetected_downloaded_samples", " / undetected_referrer_samples", " / Websense ThreatSeeker category", " / Webutation domain info", " / whois", " / whois_timestamp", " / WOT domain info");

            DomainReport report = await VirusTotal.GetDomainReportAsync(TestData.GetUnknownDomains(1).First());

            Assert.Equal(DomainResponseCode.NotPresent, report.ResponseCode);
        }
示例#16
0
        public void Call(DomainStatUserRegistration domainStatUserRegistration, DomainReport domainReport)
        {
            domainReport.AllRegistrations++;

            if (Filter != null)
            {
                Filter.Call(domainStatUserRegistration, domainReport);
            }
        }
示例#17
0
 public void Accumulate(DomainReport dayReport, DomainReport accumulator)
 {
     accumulator.AllRegistrations            += dayReport.AllRegistrations;
     accumulator.CicIPadDeletions            += dayReport.CicIPadDeletions;
     accumulator.CicIPadRegistrations        += dayReport.CicIPadRegistrations;
     accumulator.CicIPadSuccessfulUploads    += dayReport.CicIPadSuccessfulUploads;
     accumulator.CicIPadUploadCancels        += dayReport.CicIPadUploadCancels;
     accumulator.CicMacDeletions             += dayReport.CicMacDeletions;
     accumulator.CicMacRegistrations         += dayReport.CicMacRegistrations;
     accumulator.CicMacSuccessfulUploads     += dayReport.CicMacSuccessfulUploads;
     accumulator.CicMacUploadCancels         += dayReport.CicMacUploadCancels;
     accumulator.CicPcDeletions              += dayReport.CicPcDeletions;
     accumulator.CicPcRegistrations          += dayReport.CicPcRegistrations;
     accumulator.CicPcSuccessfulUploads      += dayReport.CicPcSuccessfulUploads;
     accumulator.CicPcUploadCancels          += dayReport.CicPcUploadCancels;
     accumulator.EmailRegistrations          += dayReport.EmailRegistrations;
     accumulator.EmbeddedViews               += dayReport.EmbeddedViews;
     accumulator.FacebookRegistrations       += dayReport.FacebookRegistrations;
     accumulator.GoogleRegistrations         += dayReport.GoogleRegistrations;
     accumulator.ImageShackDeletions         += dayReport.ImageShackDeletions;
     accumulator.ImageShackRegistrations     += dayReport.ImageShackRegistrations;
     accumulator.ImageShackSuccessfulUploads += dayReport.ImageShackSuccessfulUploads;
     accumulator.ImageShackUploadCancels     += dayReport.ImageShackUploadCancels;
     accumulator.TaggerIPhoneDeletions       += dayReport.TaggerIPhoneDeletions;
     accumulator.TaggerIPhoneRegistrations   += dayReport.TaggerIPhoneRegistrations;
     accumulator.TaggerIPhoneUploads         += dayReport.TaggerIPhoneUploads;
     accumulator.TaggerIPhoneUploadCancels   += dayReport.TaggerIPhoneUploadCancels;
     accumulator.TotalViews += dayReport.TotalViews;
     accumulator.WindowsLiveRegistrations       += dayReport.WindowsLiveRegistrations;
     accumulator.YahooRegistrations             += dayReport.YahooRegistrations;
     accumulator.TwitterRegistrations           += dayReport.TwitterRegistrations;
     accumulator.OdnoklassnikiRegistrations     += dayReport.OdnoklassnikiRegistrations;
     accumulator.BrowserRegistrations           += dayReport.BrowserRegistrations;
     accumulator.OtherRegistrations             += dayReport.OtherRegistrations;
     accumulator.PlayerDeletions                += dayReport.PlayerDeletions;
     accumulator.PlayerRegistrations            += dayReport.PlayerRegistrations;
     accumulator.PlayerSuccessfulUploads        += dayReport.PlayerSuccessfulUploads;
     accumulator.PlayerUploadCancels            += dayReport.PlayerUploadCancels;
     accumulator.StandaloneDeletions            += dayReport.StandaloneDeletions;
     accumulator.StandaloneRegistrations        += dayReport.StandaloneRegistrations;
     accumulator.StandaloneSuccessfulUploads    += dayReport.StandaloneSuccessfulUploads;
     accumulator.StandaloneUploadCancels        += dayReport.StandaloneUploadCancels;
     accumulator.TaggerAndroidDeletions         += dayReport.TaggerAndroidDeletions;
     accumulator.TaggerAndroidRegistrations     += dayReport.TaggerAndroidRegistrations;
     accumulator.TaggerAndroidSuccessfulUploads += dayReport.TaggerAndroidSuccessfulUploads;
     accumulator.TaggerAndroidUploadCancels     += dayReport.TaggerAndroidUploadCancels;
     accumulator.DailyMotionDeletions           += dayReport.DailyMotionDeletions;
     accumulator.DailyMotionRegistrations       += dayReport.DailyMotionRegistrations;
     accumulator.DailyMotionSuccessfulUploads   += dayReport.DailyMotionSuccessfulUploads;
     accumulator.DailyMotionUploadCancels       += dayReport.DailyMotionUploadCancels;
     accumulator.VkRegistrations                += dayReport.VkRegistrations;
     accumulator.JwPlayerDeletions              += dayReport.JwPlayerDeletions;
     accumulator.JwPlayerRegistrations          += dayReport.JwPlayerRegistrations;
     accumulator.JwPlayerSuccessfulUploads      += dayReport.JwPlayerSuccessfulUploads;
     accumulator.JwPlayerUploadCancels          += dayReport.JwPlayerUploadCancels;
 }
        public void BuildReportsTest()
        {
            //Arrange
            var start    = new DateTime(2013, 8, 1);
            var end      = new DateTime(2013, 8, 12);
            var interval = new Interval()
            {
                Start = start, Finish = end
            };

            var reportService  = new Mock <IStandardReportService>();
            var mapper         = new Mock <IReportMapper>();
            var intervalHelper = new Mock <IIntervalHelper>();
            var interval1      = new Interval();
            var interval2      = new Interval();
            var interval3      = new Interval();
            var domainReport1  = new DomainReport()
            {
                Tick = new DateTime(2013, 8, 1)
            };
            var domainReport2 = new DomainReport()
            {
                Tick = new DateTime(2013, 8, 2)
            };
            var domainReport3 = new DomainReport()
            {
                Tick = new DateTime(2013, 8, 4)
            };
            var report1       = new Report();
            var report2       = new Report();
            var report3       = new Report();
            var domainReports = new List <DomainReport>()
            {
                domainReport1, domainReport2, domainReport3
            };

            var builder = new StandardReportBuilder(reportService.Object, mapper.Object, intervalHelper.Object);

            intervalHelper.Setup(m => m.GetInterval(start, end)).Returns(interval);
            intervalHelper.Setup(m => m.GetInterval(domainReport1.Tick, domainReport1.Tick)).Returns(interval1);
            intervalHelper.Setup(m => m.GetInterval(domainReport2.Tick, domainReport2.Tick)).Returns(interval2);
            intervalHelper.Setup(m => m.GetInterval(domainReport3.Tick, domainReport3.Tick)).Returns(interval3);
            reportService.Setup(m => m.GetDayReports(interval)).Returns(domainReports);
            mapper.Setup(m => m.DomainReportToDto(domainReport1, interval1)).Returns(report1);
            mapper.Setup(m => m.DomainReportToDto(domainReport2, interval2)).Returns(report2);
            mapper.Setup(m => m.DomainReportToDto(domainReport3, interval3)).Returns(report3);

            //Act
            var reports = builder.BuildReports(start, end).ToList();

            //Assert
            Assert.AreEqual(3, reports.Count);
            CollectionAssert.Contains(reports, report1);
            CollectionAssert.Contains(reports, report2);
            CollectionAssert.Contains(reports, report3);
        }
        public void GetDayReportsTest()
        {
            //Arrange
            var startDate  = new DateTime(123214);
            var finishDate = new DateTime(234567);
            var interval   = new Interval()
            {
                Start = startDate, Finish = finishDate
            };

            var repositoryFactory   = new Mock <IRepositoryFactory>();
            var tableValueConverter = new Mock <ITableValueConverter>();
            var mapper = new Mock <IReportMapper>();

            var reportEntity1_1 = new StandardReportV3Entity()
            {
                Tick = Tick1, Interval = "1"
            };
            var reportEntity2_1 = new StandardReportV3Entity()
            {
                Tick = Tick2, Interval = "1"
            };

            var domainReport1 = new DomainReport();
            var domainReport2 = new DomainReport();

            var reportEntities = new List <StandardReportV3Entity>()
            {
                reportEntity1_1,
                reportEntity2_1,
            };

            var repository = new Mock <IRepository <StandardReportV3Entity> >();

            repository.Setup(m => m.GetReportEntities(It.Is <ReportQueryObject>(p => p.StartInterval == Tick2 &&
                                                                                p.EndInterval == Tick1 &&
                                                                                p.IsStartInclude == true &&
                                                                                p.IsEndInclude == false &&
                                                                                p.Interval == "1")))
            .Returns(reportEntities);
            tableValueConverter.Setup(m => m.DateTimeToTick(startDate)).Returns(Tick2);
            tableValueConverter.Setup(m => m.DateTimeToTick(finishDate)).Returns(Tick1);
            repositoryFactory.Setup(m => m.Create <StandardReportV3Entity>(Tables.StandardReportV3)).Returns(repository.Object);
            mapper.Setup(m => m.ReportEntityToDomain(reportEntity1_1)).Returns(domainReport1);
            mapper.Setup(m => m.ReportEntityToDomain(reportEntity2_1)).Returns(domainReport2);

            var reportService = new StandardReportService(repositoryFactory.Object, tableValueConverter.Object, mapper.Object);

            //Act
            var reports = reportService.GetDayReports(interval).ToList();

            //Assert
            Assert.AreEqual(2, reports.Count);
            CollectionAssert.Contains(reports, domainReport1);
            CollectionAssert.Contains(reports, domainReport2);
        }
示例#20
0
 public void Call(DomainStatWatching domainStatWatching, DomainReport domainReport)
 {
     if (!string.IsNullOrEmpty(domainStatWatching.UrlReferrer) && !new Uri(domainStatWatching.UrlReferrer).Host.Equals(_portalUrl, StringComparison.OrdinalIgnoreCase))
     {
         domainReport.EmbeddedViews++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatWatching, domainReport);
     }
 }
 public void Call(DomainStatUserRegistration domainStatUserRegistration, DomainReport domainReport)
 {
     if (domainStatUserRegistration.ProductName == ProductName.CicPc)
     {
         domainReport.CicPcRegistrations++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatUserRegistration, domainReport);
     }
 }
 public void Call(DomainStatUserRegistration domainStatUserRegistration, DomainReport domainReport)
 {
     if (domainStatUserRegistration.IdentityProvider == "Email")
     {
         domainReport.EmailRegistrations++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatUserRegistration, domainReport);
     }
 }
示例#23
0
 public void Call(DomainStatWatching domainStatWatching, DomainReport domainReport)
 {
     if (!String.IsNullOrEmpty(domainStatWatching.UserAgent) && RegularClient.IsMatch(domainStatWatching.UserAgent))
     {
         domainReport.TotalViews++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatWatching, domainReport);
     }
 }
 public void Call(DomainStatUserRegistration domainStatUserRegistration, DomainReport domainReport)
 {
     if (domainStatUserRegistration.IdentityProvider == ProviderType.Yahoo.ToString())
     {
         domainReport.YahooRegistrations++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatUserRegistration, domainReport);
     }
 }
 public void Call(DomainStatProjectState domainStatProjectState, DomainReport domainReport)
 {
     if (!domainStatProjectState.IsSuccessfulUpload &&
         domainStatProjectState.Producer == ProductName.TaggerIPhone)
     {
         domainReport.TaggerIPhoneUploadCancels++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatProjectState, domainReport);
     }
 }
        public DomainReport CompileReport(DomainReport additionalReport = null)
        {
            DomainReport lastAllDaysReport = _standardReportService.GetLastAllDaysReport().Result;
            var          domainReport      = new DomainReport {
                Interval = "All"
            };

            _reportAccumulator.Accumulate(lastAllDaysReport, domainReport);
            _reportAccumulator.Accumulate(additionalReport, domainReport);

            return(domainReport);
        }
示例#27
0
 public void Call(DomainStatProjectState domainStatProjectState, DomainReport domainReport)
 {
     if (domainStatProjectState.IsSuccessfulUpload &&
         domainStatProjectState.Producer == ProductName.Standalone)
     {
         domainReport.StandaloneSuccessfulUploads++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatProjectState, domainReport);
     }
 }
示例#28
0
 public void Call(DomainStatProjectState domainStatProjectState, DomainReport domainReport)
 {
     if (domainStatProjectState.IsSuccessfulUpload &&
         domainStatProjectState.Producer == ProductName.CicPc)
     {
         domainReport.CicPcDeletions++;
     }
     if (Filter != null)
     {
         Filter.Call(domainStatProjectState, domainReport);
     }
 }
        public async Task <DomainReport> GetLastAllDaysReport()
        {
            var queryObject = new ReportQueryObject
            {
                Interval = "All"
            };

            StandardReportV3Entity entity = await _repository.GetLastReport(queryObject);

            DomainReport domain = entity == null ? new DomainReport() : _reportMapper.ReportEntityToDomain(entity);

            return(domain);
        }
示例#30
0
        public void CallWhenNotSetFelterTest()
        {
            //Arrange
            var domainStatUserRegistration = new DomainStatUserRegistration();
            var domainReport = new DomainReport();

            var allRegistrationsFilter = new AllRegistrationsFilter();

            //Act
            allRegistrationsFilter.Call(domainStatUserRegistration, domainReport);
            allRegistrationsFilter.Call(domainStatUserRegistration, domainReport);

            //Assert
            Assert.AreEqual(2, domainReport.AllRegistrations);
        }