private void loginButton_Click(object sender, EventArgs e)
        {
            UserRepository userRepository = new UserRepository();
            User user = userRepository.GetByUsername(loginUserControl.Username());

            CompanyRepository companyRepository = new CompanyRepository();
            Company company = companyRepository.GetByCompanyName(companyName);

            if (user != null && user.WorksForCompanies.Contains(company) && user.Password.Equals(loginUserControl.Password()))
            {
                // Add payroll time range to session.
                PayrollRepository payrollRepository = new PayrollRepository();
                Payroll payroll = payrollRepository.GetByCompany(company);
                DateTime payrollStartDate = getCurrentPayrollStartDate(payroll);
                int numberOfDaysInPayroll = payroll.PayrollNumberOfWeeks * NUMBER_OF_DAYS_IN_A_WEEK;
                // TimeSpan constructor specifies: days, hours, minutes, seconds,
                // and milliseconds. The TimeSpan returned has those values.
                TimeSpan oneMillisecondSpan = new TimeSpan(0, 0, 0, 0, 1);
                DateTime payrollEndDate = payrollStartDate.AddDays(numberOfDaysInPayroll).Subtract(oneMillisecondSpan);

                // Create a new session.
                // Associate user and her or his company with session.
                session = new Session(user, company, payrollStartDate, payrollEndDate);

                // Initialize the dashboard user control since we have successfully logged in.
                dashboardUserControl = new DashboardUserControl(session);

                // Remove the login user control/screen.
                this.Controls.Clear();

                // Add the dashboard user control.
                this.Controls.Add(dashboardUserControl);

                this.toolStrip1 = new System.Windows.Forms.ToolStrip();
                this.toolStrip1.SuspendLayout();
                //
                // toolStrip1
                //
                this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                    this.logoutToolStripButton,
                    this.welcomeToolStripLabel});
                this.toolStrip1.Location = new System.Drawing.Point(0, 0);
                this.toolStrip1.Name = "toolStrip1";
                this.toolStrip1.Size = new System.Drawing.Size(649, 25);
                this.toolStrip1.TabIndex = 0;
                this.toolStrip1.Text = "Payroll Tracker Tool Strip";

                welcomeToolStripLabel.Text = "Welcome " + user.FirstName + "!";
                this.Controls.Add(this.toolStrip1);
                this.toolStrip1.ResumeLayout(false);
                this.toolStrip1.PerformLayout();

                this.logoutToolStripButton.Click +=new EventHandler(logoutToolStripButton_Click);
            }
            else
            {
                MessageBox.Show("Incorrect username and password combination");
            }
        }
        public void Can_get_existing_payroll_by_company()
        {
            IPayrollRepository repository = new PayrollRepository();
            Payroll payroll = repository.GetByCompany(_payrolls[1].Company);

            Assert.IsNotNull(payroll);
        }