Ejemplo n.º 1
0
        private void AssertLogIns(int members, int employers, int administrators, int custodians)
        {
            var dateRange = new DateTimeRange(DateTime.Today, DateTime.Today.AddDays(1));

            Assert.AreEqual(members, _accountReportsQuery.GetLogIns(UserType.Member, dateRange));
            Assert.AreEqual(employers, _accountReportsQuery.GetLogIns(UserType.Employer, dateRange));
            Assert.AreEqual(administrators, _accountReportsQuery.GetLogIns(UserType.Administrator, dateRange));
            Assert.AreEqual(custodians, _accountReportsQuery.GetLogIns(UserType.Custodian, dateRange));
        }
Ejemplo n.º 2
0
        public void TestUniqueLoginsCount()
        {
            foreach (var user in _users)
            {
                //Login random times each,
                //where count of logins is in between LoginMin and LoginMax

                int loginCnt = new Random(Seed).Next(LoginMin, LoginMax);
                for (int i = 0; i < loginCnt; i++)
                {
                    LogIn(user);
                    LogOut();
                }
            }

            Assert.AreEqual(_users.Count, 7);

            //Only Member logins
            var logins = _accountReportsQuery.GetLogIns(UserType.Member, new DateTimeRange(DateTime.Now.Date, GetEndOfToday()));

            Assert.AreEqual(3, logins);

            //Only Employer logins
            logins = _accountReportsQuery.GetLogIns(UserType.Employer, new DateTimeRange(DateTime.Now.Date, GetEndOfToday()));
            Assert.AreEqual(3, logins);

            //Only Admin logins
            logins = _accountReportsQuery.GetLogIns(UserType.Administrator, new DateTimeRange(DateTime.Now.Date, GetEndOfToday()));
            Assert.AreEqual(1, logins);

            //No logins yesterday
            logins = _accountReportsQuery.GetLogIns(UserType.Member, new DateTimeRange(DateTime.Now.Date.AddDays(-1), GetEndOfYesterday()));
            Assert.AreEqual(0, logins);
            logins = _accountReportsQuery.GetLogIns(UserType.Employer, new DateTimeRange(DateTime.Now.Date.AddDays(-1), GetEndOfYesterday()));
            Assert.AreEqual(0, logins);
            logins = _accountReportsQuery.GetLogIns(UserType.Administrator, new DateTimeRange(DateTime.Now.Date.AddDays(-1), GetEndOfYesterday()));
            Assert.AreEqual(0, logins);

            //No logins tommorow
            logins = _accountReportsQuery.GetLogIns(UserType.Member, new DateTimeRange(DateTime.Now.Date.AddDays(1), GetEndOfYesterday()));
            Assert.AreEqual(0, logins);
            logins = _accountReportsQuery.GetLogIns(UserType.Employer, new DateTimeRange(DateTime.Now.Date.AddDays(1), GetEndOfYesterday()));
            Assert.AreEqual(0, logins);
            logins = _accountReportsQuery.GetLogIns(UserType.Administrator, new DateTimeRange(DateTime.Now.Date.AddDays(1), GetEndOfYesterday()));
            Assert.AreEqual(0, logins);
        }
Ejemplo n.º 3
0
        DailyReport IDailyReportsQuery.GetDailyReport(DayRange day)
        {
            var week  = new DateTimeRange(day.Start.Value.AddDays(-7), day.End.Value);
            var month = new DateTimeRange(day.Start.Value.AddMonths(-1), day.End.Value);

            var web      = _channelsQuery.GetChannel("Web");
            var api      = _channelsQuery.GetChannel("API");
            var channels = new[] { web, api };

            var userTypes = new[] { UserType.Member, UserType.Employer, UserType.Administrator, UserType.Custodian };

            return(new DailyReport
            {
                Day = day,
                OpenJobAds = _jobAdReportsQuery.GetOpenJobAds(),
                ResumeSearchAlerts = _memberSearchReportsQuery.GetMemberSearchAlerts(),
                JobSearchAlerts = _jobAdSearchReportsQuery.GetJobAdSearchAlerts(),
                JobSearches = _jobAdSearchReportsQuery.GetJobAdSearches(day),
                InternalJobApplications = _jobAdReportsQuery.GetInternalApplications(day),
                ExternalJobApplications = _jobAdReportsQuery.GetExternalApplications(day),
                InvitationsSent = _networkingReportsQuery.GetInvitationsSent(day),
                InvitationsAccepted = _networkingReportsQuery.GetInvitationsAccepted(day),
                AcceptanceRateLast48Hours = (int)_networkingReportsQuery.Get48HourInvitationAcceptancePercent(),
                AcceptanceRatePreviousMonth = (int)_networkingReportsQuery.GetMonthlyInvitationAcceptancePercent(),

                MemberReport = new MemberReport
                {
                    Total = _accountReportsQuery.GetUsers(UserType.Member, day.End.Value),
                    Enabled = _accountReportsQuery.GetEnabledUsers(UserType.Member, day.End.Value),
                    Active = _accountReportsQuery.GetActiveUsers(UserType.Member, day.End.Value),
                    New = _accountReportsQuery.GetNewUsers(UserType.Member, day),
                },

                ResumeReport = new ResumeReport
                {
                    Total = _resumeReportsQuery.GetResumes(day.End.Value),
                    Searchable = _resumeReportsQuery.GetSearchableResumes(day.End.Value),
                    New = _resumeReportsQuery.GetNewResumes(day),
                    Uploaded = _resumeReportsQuery.GetUploadedResumes(day),
                    Reloaded = _resumeReportsQuery.GetReloadedResumes(day),
                    Edited = _resumeReportsQuery.GetEditedResumes(day),
                    Updated = _resumeReportsQuery.GetUpdatedResumes(day),
                },

                // Logins.

                DailyLogIns = (from u in userTypes select new { UserType = u, LogIns = _accountReportsQuery.GetLogIns(u, day) }).ToDictionary(x => x.UserType, x => x.LogIns),
                WeeklyLogIns = (from u in userTypes select new { UserType = u, LogIns = _accountReportsQuery.GetLogIns(u, week) }).ToDictionary(x => x.UserType, x => x.LogIns),
                MonthlyLogIns = (from u in userTypes select new { UserType = u, LogIns = _accountReportsQuery.GetLogIns(u, month) }).ToDictionary(x => x.UserType, x => x.LogIns),

                // Member search reports.

                MemberSearchReports = (from c in channels
                                       select new
                {
                    c.Name,
                    Report = new MemberSearchReport
                    {
                        TotalSearches = _memberSearchReportsQuery.GetMemberSearches(c, day),
                        FilterSearches = _memberSearchReportsQuery.GetFilterMemberSearches(c, day),
                        SavedSearches = _memberSearchReportsQuery.GetSavedMemberSearches(c, day),
                        AnonymousSearches = _memberSearchReportsQuery.GetAnonymousMemberSearches(c, day),
                    }
                }).ToDictionary(x => x.Name, x => x.Report),

                MemberViewingReports = (from c in channels
                                        select new
                {
                    c.Name,
                    Report = _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(c, day),
                }).ToDictionary(x => x.Name, x => x.Report),

                MemberAccessReports = (from c in channels
                                       select new
                {
                    c.Name,
                    Report = _employerMemberAccessReportsQuery.GetEmployerMemberAccessReport(c, day),
                }).ToDictionary(x => x.Name, x => x.Report),

                // Others.

                OrderReports = _orderReportsQuery.GetOrderReports(day),
                CommunciationReports = GetCommunicationReports(day),
                PromotionCodeReports = _registrationReportsQuery.GetPromotionCodeReports(day).ToDictionary(x => x.Key, x => x.Value),
                JobAdIntegrationReports = GetJobAdIntegrationReports(day),
            });
        }