示例#1
0
        public void TestHasViewed()
        {
            var employer = CreateEmployer();

            LogIn(employer);

            const int count   = 4;
            var       members = new Member[count];

            for (var index = 0; index < count; ++index)
            {
                members[index] = CreateMember(index);
            }

            // Have not viewed anyone yet.

            TestHasViewed(new Member[0], members);

            // View them now.

            _employerMemberViewsCommand.ViewMember(_app, employer, members[1]);
            TestHasViewed(new[] { members[1] }, new[] { members[0], members[2], members[3] });

            _employerMemberViewsCommand.ViewMember(_app, employer, members[3]);
            TestHasViewed(new[] { members[1], members[3] }, new[] { members[0], members[2] });

            _employerMemberViewsCommand.ViewMember(_app, employer, members[2]);
            TestHasViewed(new[] { members[1], members[2], members[3] }, new[] { members[0] });

            _employerMemberViewsCommand.ViewMember(_app, employer, members[0]);
            TestHasViewed(new[] { members[0], members[1], members[2], members[3] }, new Member[0]);
        }
示例#2
0
        public void TestMemberViewsWithLinkMe()
        {
            // It used to be the case that we filtered out LinkMe employers from these reports but given the
            // changes in the company etc we will include them from now on because it makes things a whole lot
            // easier, and stats from LinkMe should not be significant now.

            var organisation = _organisationsCommand.CreateTestVerifiedOrganisation("LinkMe");
            var employer1    = _employersCommand.CreateTestEmployer(0, organisation);

            var employer2 = _employersCommand.CreateTestEmployer(2, _organisationsCommand.CreateTestOrganisation(2));
            var member1   = _membersCommand.CreateTestMember(1);
            var member2   = _membersCommand.CreateTestMember(2);
            var member3   = _membersCommand.CreateTestMember(3);

            // Make some viewings.

            var channel = _channelsQuery.GetChannel("Web");
            var app     = _channelsQuery.GetChannelApp(channel.Id, "Web");

            _employerMemberViewsCommand.ViewMember(app, employer1, member1);
            Assert.AreEqual(1, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member1);
            Assert.AreEqual(2, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer1, member2);
            Assert.AreEqual(3, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member3);
            Assert.AreEqual(4, _dailyReportsQuery.GetDailyReport(DayRange.Today).MemberViewingReports["Web"].TotalViewings);
        }
示例#3
0
        public void TestResumeSearchActivityXlsCredits()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var organisation  = CreateVerifiedOrganisation(administrator.Id);
            var employer      = _employerAccountsCommand.CreateTestEmployer(1, organisation);
            var member        = _memberAccountsCommand.CreateTestMember(1);

            // Assign some credits.

            _allocationsCommand.CreateAllocation(new Allocation
            {
                CreatedTime     = DateTime.Now.AddDays(-60),
                CreditId        = _creditsQuery.GetCredit <ContactCredit>().Id,
                InitialQuantity = 100,
                OwnerId         = organisation.Id,
            });

            for (var index = 2; index < 20; ++index)
            {
                _employerMemberViewsCommand.AccessMember(_app, employer, _employerMemberViewsQuery.GetProfessionalView(employer, _memberAccountsCommand.CreateTestMember(index)), MemberAccessReason.PhoneNumberViewed);
            }

            _employerMemberViewsCommand.ViewMember(_app, employer, member);
            var report = _employerReportsCommand.CreateReportTemplate <ResumeSearchActivityReport>(organisation.Id);

            TestResults(administrator, organisation, report, ".xls", "application/vnd.ms-excel", _downloadButton);
        }
示例#4
0
        public void TestGetMemberViews()
        {
            var channel = _channelsQuery.GetChannel("Web");
            var app     = _channelsQuery.GetChannelApp(channel.Id, "Web");

            Assert.AreEqual(0, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            // Make some viewings.

            var employer1 = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1));
            var employer2 = _employersCommand.CreateTestEmployer(2, _organisationsCommand.CreateTestOrganisation(2));
            var member1   = _membersCommand.CreateTestMember(1);
            var member2   = _membersCommand.CreateTestMember(2);
            var member3   = _membersCommand.CreateTestMember(3);

            _employerMemberViewsCommand.ViewMember(app, employer1, member1);
            Assert.AreEqual(1, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer1, member2);
            Assert.AreEqual(2, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member1);
            Assert.AreEqual(3, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);

            _employerMemberViewsCommand.ViewMember(app, employer2, member3);
            Assert.AreEqual(4, _employerMemberAccessReportsQuery.GetEmployerMemberViewingReport(channel, DayRange.Today).TotalViewings);
        }
示例#5
0
        public void TestViewMember()
        {
            var member   = CreateMember(1);
            var employer = CreateEmployer(1);

            _employerMemberViewsCommand.ViewMember(_app, employer, member);
            AssertViewings(employer, new[] { member }, new IMember[0]);
        }
示例#6
0
        public void TestFilterHasViewed()
        {
            var member1  = CreateMember(1);
            var member2  = CreateMember(2);
            var employer = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1));

            // Member1 has been viewed.

            _employerMemberViewsCommand.ViewMember(_app, employer, member1);

            // Filter.

            TestFilter(employer, CreateHasViewedCriteria, new[] { member1.Id, member2.Id }, new[] { member1.Id }, new[] { member2.Id });
        }
示例#7
0
        public ActionResult PartialResume(Guid candidateId)
        {
            var employer = CurrentEmployer;
            var view     = _employerMemberViewsQuery.GetEmployerMemberView(employer, candidateId);

            var currentCandidate = GetCurrentCandidate(candidateId, view);

            // Mark them as viewed.

            _employerMemberViewsCommand.ViewMember(ActivityContext.Channel.App, employer, currentCandidate.View);

            return(PartialView("Resume", new ViewCandidatesModel
            {
                LastUpdatedTimes = GetLastUpdatedTimes(view),
                CurrentCandidate = currentCandidate,
                CurrentCandidates = EmployerContext.CurrentCandidates,
            }));
        }
示例#8
0
        public void TestFilterBlockHasViewed()
        {
            var member   = CreateJobAd(1);
            var employer = _employersCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(1));

            // Member has been viewed.

            _employerMemberViewsCommand.ViewMember(employer, member);

            // Filter.

            TestFilter(new[] { member.Id }, employer, CreateHasViewedCriteria(true));

            // Block.

            _candidateListsCommand.AddCandidateToBlockList(employer, _candidateBlockListsQuery.GetTemporaryCandidateBlockList(employer), member.Id);
            TestFilter(new Guid[0], employer, CreateHasViewedCriteria(true));
        }
示例#9
0
        public void TestChannelApp()
        {
            var member1  = CreateMember(1);
            var member2  = CreateMember(2);
            var member3  = CreateMember(3);
            var employer = CreateEmployer(1);

            var channelApp1 = _channelsQuery.GetChannelApp(_channelsQuery.GetChannel("Web").Id, "Web");
            var channelApp2 = _channelsQuery.GetChannelApp(_channelsQuery.GetChannel("API").Id, "iOS");

            _employerMemberViewsCommand.ViewMember(channelApp1, employer, member1);
            _employerMemberViewsCommand.ViewMember(channelApp2, employer, member1);
            _employerMemberViewsCommand.ViewMember(channelApp2, employer, member2);
            _employerMemberViewsCommand.ViewMember(channelApp2, employer, member3);

            AssertMemberViewings(employer.Id, member1.Id, channelApp1, channelApp2);
            AssertMemberViewings(employer.Id, member2.Id, channelApp2);
            AssertMemberViewings(employer.Id, member3.Id, channelApp2);
        }
        public void TestHasBeenViewed()
        {
            var employer0 = CreateEmployer(0);
            var employer1 = CreateEmployer(1, employer0.Organisation);

            var member = CreateMember(0);

            _employerMemberViewsCommand.ViewMember(_app, employer0, member);

            TestFlag(employer0, member.Id, true, v => v.HasBeenViewed);
            TestFlag(employer1, member.Id, false, v => v.HasBeenViewed);
        }
示例#11
0
        public ActionResult Candidate(Guid candidateId)
        {
            try
            {
                var employer = CurrentEmployer;
                var view     = _employerMemberViewsQuery.GetEmployerMemberView(employer, candidateId);
                if (view == null)
                {
                    return(JsonNotFound("candidate", JsonRequestBehavior.AllowGet));
                }

                // Mark them as viewed.

                _employerMemberViewsCommand.ViewMember(ActivityContext.Channel.App, employer, view);

                // unbadge them

                if (employer != null)
                {
                    _memberSearchAlertsCommand.MarkAsViewed(employer.Id, candidateId);
                }

                // Re-get so the correct flags are set.
                view = _employerMemberViewsQuery.GetEmployerMemberView(employer, candidateId);

                return(Json(new CandidateResponseModel {
                    Candidate = GetCandidateModel(view)
                }, JsonRequestBehavior.AllowGet));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel(), JsonRequestBehavior.AllowGet));
        }