public void TestMethod1() { List <EmployeeModel> employeeDetails = new List <EmployeeModel>(); employeeDetails.Add(new EmployeeModel(1, "Bruce", 'M', "Capgemini", "HR", "9879090799", "Hyderabad", DateTime.Now, 100000)); employeeDetails.Add(new EmployeeModel(2, "Banner", 'M', "Microsoft", "HR", "8976528393", "Hyderabad", DateTime.Now, 100000)); employeeDetails.Add(new EmployeeModel(3, "clark", 'M', "Microsoft", "HR", "9564728292", "Hyderabad", DateTime.Now, 100000)); employeeDetails.Add(new EmployeeModel(4, "Mike", 'M', "Capgemini", "HR", "9949567826", "Hyderabad", DateTime.Now, 00000)); employeeDetails.Add(new EmployeeModel(5, "Jason", 'M', "Microsoft", "HR", "9678623419", "Hyderabad", DateTime.Now, 100000)); employeeDetails.Add(new EmployeeModel(6, "Patrick", 'M', "TataElxsi", "HR", "9949675729", "Hyderabad", DateTime.Now, 100000)); employeeDetails.Add(new EmployeeModel(7, "Maria", 'F', "Capgemini", "HR", "8976528356", "Hyderabad", DateTime.Now, 100000)); employeeDetails.Add(new EmployeeModel(8, "Steve", 'M', "TataElxsi", "HR", "8987656342", "Hyderabad", DateTime.Now, 100000)); EmployeePayrollOperation employeePayrollOperations = new EmployeePayrollOperation(); DateTime startDateTime = DateTime.Now; employeePayrollOperations.addMultipleEmployeeToList(employeeDetails); DateTime stopDateTime = DateTime.Now; Console.WriteLine("Duration without thread: " + (stopDateTime - startDateTime)); DateTime startDateTimeThread = DateTime.Now; employeePayrollOperations.addMultipleEmployeeToListWithThread(employeeDetails); DateTime stopDateTimeThread = DateTime.Now; Console.WriteLine("Duration with thread: " + (stopDateTimeThread - startDateTimeThread)); }
public void Given10Employee_WhenAddedToList_ShouldMatchEmployeeEntries() { List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>(); employeeDetails.Add(new EmployeeDetails(EmployeeID: 1, EmployeeName: "Bruce", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Banner", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 3, EmployeeName: "clark", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 4, EmployeeName: "Mike", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 5, EmployeeName: "Jason", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 6, EmployeeName: "Patrick", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 7, EmployeeName: "Maria", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 8, EmployeeName: "Steve", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); EmployeePayrollOperation employeePayrollOperations = new EmployeePayrollOperation(); DateTime startDateTime = DateTime.Now; employeePayrollOperations.addEmployeeToPayroll(employeeDetails); DateTime stopDateTime = DateTime.Now; Console.WriteLine("Duration without thread: " + (stopDateTime - startDateTime)); DateTime startDateTimeThread = DateTime.Now; employeePayrollOperations.addEmployeeToPayrollWithThread(employeeDetails); DateTime stopDateTimeThread = DateTime.Now; Console.WriteLine("Duration with thread: " + (stopDateTimeThread - startDateTimeThread)); }
public void TestMethod1() { List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>(); employeeDetails.Add(new EmployeeDetails(EmployeeID: 1, EmployeeName: "Bruce", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Banner", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 3, EmployeeName: "clark", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 4, EmployeeName: "Mike", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 5, EmployeeName: "Jason", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 6, EmployeeName: "Patrick", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 7, EmployeeName: "Maria", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); employeeDetails.Add(new EmployeeDetails(EmployeeID: 8, EmployeeName: "Steve", PhoneNumber: "9999999999", Address: "xyz", Department: "HR", Gender: 'M', City: "abc", BasicPay: 100, TaxablePay: 2, Tax: 3, Country: "India")); EmployeePayrollOperation employeePayrollOperation = new EmployeePayrollOperation(); System.DateTime startDateTime = System.DateTime.Now; employeePayrollOperation.addEmployeeToPayroll(employeeDetails); DateTime stopDateTime = DateTime.Now; Console.WriteLine("Duration during thread ={0}", (stopDateTime - startDateTime)); DateTime startDateTimeThread = DateTime.Now; employeePayrollOperation.addEmployeeToPayrollWithThread(employeeDetails); DateTime stopDateTimeThread = DateTime.Now; Console.WriteLine("Duration during thread ={0}", (stopDateTimeThread - startDateTimeThread)); }
public void GivenEmployee_WhenAddedToList_ShouldMatchEmployeeEntriesWithThreads() { List <EmployeeModel> employeePayrollList = new List <EmployeeModel>(); employeePayrollList.Add(new EmployeeModel { Name = "Sachin", Salary = 25000, Start = Convert.ToDateTime("2019-11-07"), Gender = 'M', Department = "Marketing", PhoneNumber = "8073121212", Address = "Vijay Nagar", Basic_Pay = 25000, Deductions = 1500, Taxable_Pay = 900, Income_Tax = 750, Net_Pay = 10000 }); employeePayrollList.Add(new EmployeeModel { Name = "Dhoni", Salary = 27000, Start = Convert.ToDateTime("2018-10-17"), Gender = 'M', Department = "Sales", PhoneNumber = "8089921212", Address = "Shanthi Nagar", Basic_Pay = 20000, Deductions = 1000, Taxable_Pay = 1900, Income_Tax = 1750, Net_Pay = 1000 }); EmployeePayrollOperation employeePayrollOperation = new EmployeePayrollOperation(); DateTime startDateTime = DateTime.Now; employeePayrollOperation.AddEmployeePayrollUsingThread(employeePayrollList); DateTime stoptDateTime = DateTime.Now; Console.WriteLine("Duration without thread: " + (stoptDateTime - startDateTime)); }
public void AddRecord_AndClaulate_ExecutionTime() { List <EmployeeModel> modelList = new List <EmployeeModel>(); modelList.Add(new EmployeeModel() { Id = 1, name = "Imran", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 2, name = "shaikh", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 4, name = "nijam", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 3, name = "sayaad", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 5, name = "amit", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 8, name = "tambe", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 7, name = "amol", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 9, name = "prajaapti", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 10, name = "wankhede", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 11, name = "suraj", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 12, name = "Dhiraj", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 14, name = "siraj", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'M', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); modelList.Add(new EmployeeModel() { Id = 15, name = "simran", basic_pay = 450000, start_Date = new DateTime(2020, 01, 04), gender = 'F', phoneNumber = "2345676655", department = "HR", address = "Pune", deduction = 4000, taxable = 4500, netpay = 5600, income_tax = 546.00 }); EmployeePayrollOperation employeePayroll = new EmployeePayrollOperation(); DateTime startTime = DateTime.Now; employeePayroll.AddEmployeeToPayroll(modelList); DateTime endTime = DateTime.Now; Console.WriteLine("Duration without thread = " + (endTime - startTime)); EmployeeRepo payrollRepo = new EmployeeRepo(); EmployeeModel employeeModel = new EmployeeModel { Id = 158, name = "Abhilasha", basic_pay = 80000, start_Date = new DateTime(2020, 01, 04), gender = 'F', phoneNumber = "1045676655", department = "Finance", address = "Pune", deduction = 4500, taxable = 8500, netpay = 5760, income_tax = 12000.00 }; DateTime startTimes = DateTime.Now; payrollRepo.AddRecord(employeeModel); DateTime endTimes = DateTime.Now; Console.WriteLine("Duration without thread = " + (endTimes - startTimes)); ///UC 2 with Thread DateTime startTimeWithThread = DateTime.Now; employeePayroll.AddEmployee_WithThread(modelList); DateTime endTimeWithThread = DateTime.Now; Console.WriteLine("Duration with thread = " + (startTimeWithThread - endTimeWithThread)); }
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)); }