示例#1
0
 public JobBoardActivityReportRunner(ICreditReportsQuery creditReportsQuery, IJobAdReportsQuery jobAdReportsQuery, IRecruitersQuery recruitersQuery, IOrganisationsQuery organisationsQuery, JobBoardActivityReport report, bool includeCredits, IOrganisation organisation, IAdministrator accountManager, DateRange dateRange)
     : base(organisation, accountManager, dateRange)
 {
     _creditReportsQuery = creditReportsQuery;
     _jobAdReportsQuery  = jobAdReportsQuery;
     _recruitersQuery    = recruitersQuery;
     _organisationsQuery = organisationsQuery;
     _report             = report;
     _includeCredits     = includeCredits;
 }
示例#2
0
        private void TestMultipleReports(Func <IEmployer, bool> createClientActvity, Func <IEmployer, bool> createJobBoardActivity, bool sendToAccountManager)
        {
            // Create everyone.

            var administrator = CreateAdministrator();
            var organisation  = CreateOrganisation(administrator.Id);

            organisation.ContactDetails = new ContactDetails {
                FirstName = ClientFirstName, LastName = ClientLastName, EmailAddress = ClientEmail
            };
            _organisationsCommand.UpdateOrganisation(organisation);
            var employer = CreateEmployer(organisation);

            // Define the reports.

            var resumeSearchActivityReport = new ResumeSearchActivityReport
            {
                ClientId             = organisation.Id,
                SendToAccountManager = sendToAccountManager,
                SendToClient         = true,
            };

            _reportsCommand.CreateReport(resumeSearchActivityReport);

            var jobBoardActivityReport = new JobBoardActivityReport
            {
                ClientId             = organisation.Id,
                SendToAccountManager = sendToAccountManager,
                SendToClient         = true,
            };

            _reportsCommand.CreateReport(jobBoardActivityReport);

            // Create activity to report on.

            var isResumeSearchActivity = createClientActvity(employer);
            var isJobBoardActivity     = createJobBoardActivity(employer);
            var clientStatus           = new ReportStatus(resumeSearchActivityReport, isResumeSearchActivity);
            var jobBoardStatus         = new ReportStatus(jobBoardActivityReport, isJobBoardActivity);

            // Run the reports.

            Execute();

            if (sendToAccountManager)
            {
                if ((isResumeSearchActivity && isJobBoardActivity) || (!isResumeSearchActivity && !isJobBoardActivity))
                {
                    var emails = _emailServer.AssertEmailsSent(2);
                    AssertAdministratorEmail(emails[0], administrator, organisation, clientStatus, jobBoardStatus);
                    AssertClientEmail(emails[1], administrator, organisation, clientStatus, jobBoardStatus);
                }
                else
                {
                    var emails = _emailServer.AssertEmailsSent(3);
                    AssertAdministratorEmail(emails[0], administrator, organisation, jobBoardStatus);
                    AssertClientEmail(emails[1], administrator, organisation, clientStatus, jobBoardStatus);
                    AssertAdministratorEmail(emails[2], administrator, organisation, clientStatus);
                }
            }
            else
            {
                var emails = _emailServer.AssertEmailsSent(1);
                AssertClientEmail(emails[0], administrator, organisation, clientStatus, jobBoardStatus);
            }
        }