public void GivenEmployeePayroll_WhenAddInTable_ThenshouldReturnExpectedResults()
        {
            bool expected = true;
            EmployeePayrollRepo employeePayrollRepo = new EmployeePayrollRepo();
            EmployeeModel       model = new EmployeeModel
            {
                EmployeeId     = 70,
                EmployeeName   = "kaajol",
                JobDescription = "sale",
                Month          = "Feb",
                EmployeeSalary = 25000,
                SalaryId       = 404,
                StartDate      = new DateTime(2015, 09, 12),
                Gender         = 'F'
            };
            bool result = employeePayrollRepo.addEmployeeToPayroll(model);

            Assert.AreEqual(expected, result);
        }
        public void GivenEmployeePayroll_WhenAddInTable_ThenshouldReturnExpectedResultss()
        {
            bool expected = true;
            EmployeePayrollRepo employeePayrollRepo = new EmployeePayrollRepo();
            EmployeeModel       model = new EmployeeModel
            {
                EmployeeId     = 92,
                EmployeeName   = "vidyadhar",
                JobDescription = "Hr",
                Month          = "may",
                EmployeeSalary = 25000,
                SalaryId       = 404,
                StartDate      = new DateTime(2015, 09, 12),
                Gender         = 'M',
                CompanyId      = 2,
                DepartmentId   = 3
            };
            bool result = employeePayrollRepo.addEmployeeToPayroll(model);

            Assert.AreEqual(expected, result);
        }
        public void GivenQuery_WhenInsert_ThenshouldPerformInsertion()
        {
            bool expected = true;
            EmployeePayrollRepo employeePayrollRepo = new EmployeePayrollRepo();
            EmployeeModel       model = new EmployeeModel
            {
                EmployeeId     = 90,
                EmployeeName   = "summet",
                JobDescription = "Hr",
                Month          = "Feb",
                EmployeeSalary = 25000,
                SalaryId       = 404,
                StartDate      = new DateTime(2015, 09, 12),
                Gender         = 'M',
                CompanyId      = 2,
                DepartmentId   = 3
            };
            bool result = employeePayrollRepo.addEmployeeToPayroll(model);

            Assert.AreEqual(expected, result);
        }
示例#4
0
        public void givenListAndDb_WhenInsertInPayrollTable_ThenCalculateExacutionTime()
        {
            List <EmployeeModel> emploeeModellist = new List <EmployeeModel>();

            emploeeModellist.Add(new EmployeeModel()
            {
                EmployeeId = 1, EmployeeName = "Dhiraj", JobDescription = "Sale", Month = "may", EmployeeSalary = 450000, SalaryId = 101, StartDate = new DateTime(2020, 01, 04), Gender = 'M', DepartmentId = 3, CompanyId = 2, isEmployeeActive = true
            });
            emploeeModellist.Add(new EmployeeModel()
            {
                EmployeeId = 2, EmployeeName = "suraj", JobDescription = "hr", Month = "nov", EmployeeSalary = 550000, SalaryId = 102, StartDate = new DateTime(2020, 02, 04), Gender = 'M', DepartmentId = 3, CompanyId = 2, isEmployeeActive = true
            });
            emploeeModellist.Add(new EmployeeModel()
            {
                EmployeeId = 8, EmployeeName = "summet", JobDescription = "sale", Month = "dec", EmployeeSalary = 650000, SalaryId = 103, StartDate = new DateTime(2022, 01, 04), Gender = 'M', DepartmentId = 2, CompanyId = 2, isEmployeeActive = true
            });
            emploeeModellist.Add(new EmployeeModel()
            {
                EmployeeId = 6, EmployeeName = "dharma", JobDescription = "Sale", Month = "oct", EmployeeSalary = 750000, SalaryId = 104, StartDate = new DateTime(2021, 01, 04), Gender = 'M', DepartmentId = 2, CompanyId = 3, isEmployeeActive = true
            });
            emploeeModellist.Add(new EmployeeModel()
            {
                EmployeeId = 9, EmployeeName = "prem", JobDescription = "hr", Month = "apr", EmployeeSalary = 850000, SalaryId = 105, StartDate = new DateTime(2018, 01, 04), Gender = 'M', DepartmentId = 3, CompanyId = 2, isEmployeeActive = true
            });

            EmployeePayrollOperation employeePayroll = new EmployeePayrollOperation();
            DateTime startTime = DateTime.Now;

            employeePayroll.addEmployeeToPayroll(emploeeModellist);
            DateTime endTime = DateTime.Now;

            Console.WriteLine("Durations without the thread = " + (endTime - startTime));
            EmployeePayrollRepo employeePayrollRepo = new EmployeePayrollRepo();
            EmployeeModel       employeeModel       = new EmployeeModel
            {
                EmployeeId       = 107,
                EmployeeName     = "dhiraj",
                JobDescription   = "Hr",
                Month            = "may",
                EmployeeSalary   = 77000,
                SalaryId         = 101,
                StartDate        = new DateTime(2019, 02, 22),
                Gender           = 'M',
                DepartmentId     = 3,
                CompanyId        = 2,
                isEmployeeActive = true
            };

            DateTime startTimesForDb = DateTime.Now;

            employeePayrollRepo.addEmployeeToPayroll(employeeModel);
            DateTime endTimesForDb = DateTime.Now;

            Console.WriteLine("Duration for insertion in payroll = " + (startTimesForDb - endTimesForDb));

            DateTime startTimeWithThread = DateTime.Now;

            employeePayroll.addEmployeeToPayrollWithThread(emploeeModellist);
            DateTime endTimeWithThread = DateTime.Now;

            Console.WriteLine("Durations with the thread = " + (startTimeWithThread - endTimeWithThread));
        }