Ejemplo n.º 1
0
        public void Given8Employee_WhenAddedTOList_ShouldMatchEmployeeEntries()
        {
            List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>();

            employeeDetails.Add(new EmployeeDetails(EmployeeID: 1, EmployeeName: "Manish", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Reddy", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Nagendra", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Gunjan", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Dilip", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Sachin", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Mahesh", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Aniket", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));
            employeeDetails.Add(new EmployeeDetails(EmployeeID: 2, EmployeeName: "Saurabh", PhoneNumber: "7760467611", Address: "xyz", Department: "HR", Gender: 'M', BasicPay: 100, Deductions: 2, TaxablePay: 20, Tax: 100, NetPay: 400, City: "Banglore", Country: "India"));

            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();
            DateTime startDate = DateTime.Now;

            employeePayrollOperations.addEmployeeToPayroll(employeeDetails);
            DateTime stopDate = DateTime.Now;

            Console.WriteLine("Duration without thread: " + (stopDate - startDate));

            DateTime startDateThread = DateTime.Now;

            employeePayrollOperations.addEmployeeToPayrollWithThread(employeeDetails);
            DateTime stopDateThread = DateTime.Now;

            Console.WriteLine("Duration with thread: " + (stopDateThread - startDateThread));
        }
Ejemplo n.º 2
0
        public void Given10Employee_WhenAddesTDList_ShouldMatchEmployeeEntities()
        {
            List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>();

            employeeDetails.Add(new EmployeeDetails(EmpID: 1, EmpName: "Bruce", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7559171697, Address: "Mumbai", DeptID: 1, PayrollId: 1, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 2, EmpName: "Wayne", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7894563321, Address: "Delhi", DeptID: 2, PayrollId: 2, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 3, EmpName: "Peter", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 1236547890, Address: "Delhi", DeptID: 1, PayrollId: 3, BasicPay: 250000, Deduction: 18000, IncomeTax: 12000, NetPay: 18000));
            employeeDetails.Add(new EmployeeDetails(EmpID: 4, EmpName: "Parker", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 2145698730, Address: "Delhi", DeptID: 2, PayrollId: 4, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 5, EmpName: "Abhishek", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7559171697, Address: "Delhi", DeptID: 1, PayrollId: 5, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 6, EmpName: "Wonder Woman", StartDate: DateTime.Now, Gender: "Female", PhoneNumber: 7559171697, Address: "Bengaluru", DeptID: 2, PayrollId: 6, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 7, EmpName: "Iron Man", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7559171697, Address: "Delhi", DeptID: 2, PayrollId: 7, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 8, EmpName: "Wayne", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7559171697, Address: "Delhi", DeptID: 2, PayrollId: 8, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 9, EmpName: "Wayne", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7559171697, Address: "Delhi", DeptID: 2, PayrollId: 9, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));
            employeeDetails.Add(new EmployeeDetails(EmpID: 10, EmpName: "Wayne", StartDate: DateTime.Now, Gender: "Male", PhoneNumber: 7559171697, Address: "Delhi", DeptID: 2, PayrollId: 10, BasicPay: 300000, Deduction: 24000, IncomeTax: 18000, NetPay: 26500));

            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();
            DateTime startDateTime = DateTime.Now;

            employeePayrollOperations.AddEmployeeToPayroll(employeeDetails);
            DateTime stopDateTime = DateTime.Now;

            Console.WriteLine("Duration without thread :" + (stopDateTime - startDateTime));

            DateTime startDateTimeWithThread = DateTime.Now;

            employeePayrollOperations.AddEmployeeToPayrollToThread(employeeDetails);
            DateTime stopDateTimeWithThread = DateTime.Now;

            Console.WriteLine("Duration with thread :" + (stopDateTime - startDateTime));
        }
Ejemplo n.º 3
0
        public void Given4Employee_WhenAddedTOList_ShouldMatchEmployeeEntries()
        {
            List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>();

            employeeDetails.Add(new EmployeeDetails {
                EmployeeID = 1, EmployeeName = "Sindhu"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmployeeID = 2, EmployeeName = "Peeter"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmployeeID = 3, EmployeeName = "Kavitha"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmployeeID = 4, EmployeeName = "Aravindh"
            });


            EmployeePayrollOperations employeePayrolloperations = new EmployeePayrollOperations();
            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));
            Console.ReadLine();
        }
        public void GivenEmployee_WhenAddedToList_ShouldMatchEmployeeEntries()
        {
            List <EmployeeModel> employeeModelList = new List <EmployeeModel>();

            employeeModelList.Add(new EmployeeModel(EmpId: 1, EmpName: "Apoorva", Salary: 500000, Start_Date: Convert.ToDateTime("2020-02-06"), Gender: 'F', Phone_Number: "9876543212",
                                                    Employee_Address: "Pune", Department: "Sales", Basic_Pay: 5432, Deductions: 8765, Taxable_Pay: 6754, Income_Tax: 5432, Net_Pay: 98765,
                                                    SalaryMonth: "July", SalaryId: 1, DeptId: 1, DeptName: "Sales", DeptLocation: "Pune"));

            employeeModelList.Add(new EmployeeModel(EmpId: 2, EmpName: "Aarya", Salary: 400000, Start_Date: Convert.ToDateTime("2020-08-02"), Gender: 'F', Phone_Number: "9076543212",
                                                    Employee_Address: "Mumbai", Department: "Marketing", Basic_Pay: 5422, Deductions: 5765, Taxable_Pay: 7754, Income_Tax: 6432, Net_Pay: 88765,
                                                    SalaryMonth: "August", SalaryId: 2, DeptId: 2, DeptName: "Marketing", DeptLocation: "Mumbai"));

            employeeModelList.Add(new EmployeeModel(EmpId: 3, EmpName: "Yash", Salary: 600000, Start_Date: Convert.ToDateTime("2019-04-12"), Gender: 'M', Phone_Number: "9976543222",
                                                    Employee_Address: "NaviMumbai", Department: "Development", Basic_Pay: 5444, Deductions: 6765, Taxable_Pay: 7954, Income_Tax: 6452, Net_Pay: 78765,
                                                    SalaryMonth: "June", SalaryId: 3, DeptId: 3, DeptName: "Development", DeptLocation: "NaviMumbai"));

            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();
            DateTime StartDateTime = DateTime.Now;

            employeePayrollOperations.AddEmployeeToPayroll(employeeModelList);
            DateTime StopDateTime = DateTime.Now;

            Console.WriteLine("Duration without thread:" + (StopDateTime - StartDateTime));

            DateTime StartDateTimeThread = DateTime.Now;

            employeePayrollOperations.AddEmployeeToPayrollWithThread(employeeModelList);
            DateTime StopDateTimeThread = DateTime.Now;

            Console.WriteLine("Duration with thread:" + (StopDateTimeThread - StartDateTimeThread));
        }
Ejemplo n.º 5
0
        public void AddedMultipleEmployeeAndGetCount()
        {
            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();

            employeePayrollOperations.AddEmployeeDetails();
            employeePayrollOperations.AddEmployeeDetailsUsingThreads();
            int result = employeePayrollOperations.EmployeeCount();

            Assert.AreEqual(2, result);
        }
        public void AddingDataIntoDataBase()
        {
            List <EmployeeDetails> employeeDetails = AddingDataToList();
            DateTime starttime = DateTime.Now;
            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();

            employeePayrollOperations.addEmployeeToPayrollDataBase(employeeDetails);
            DateTime endtime = DateTime.Now;

            Console.WriteLine("Total time for operation withut thread: {0}", starttime - endtime);
        }
        public void GivenEmployeeAddedIntoList_WithThreadWithSynchronization()
        {
            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();
            List <EmployeeModel>      employeeModelList         = new List <EmployeeModel>();
            DateTime startDateTime = DateTime.Now;

            employeePayrollOperations.AddEmployeeToPayrollWithThreadWithSynchronization(employeeModelList);
            DateTime stopDateTime = DateTime.Now;

            Console.WriteLine("Duration with thread:" + (stopDateTime - startDateTime));
        }
Ejemplo n.º 8
0
        public void UpdateSalaryToMultipleEmployees()
        {
            Stopwatch stopwatch = new Stopwatch();
            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();

            employeePayrollOperations.AddEmployeeDetails();
            stopwatch.Start();
            var result = employeePayrollOperations.UpdateEmployee(1);

            employeePayrollOperations.AddEmployeeDetailsUsingThreads();
            Assert.AreEqual(2000, result.BasicPay);
        }
Ejemplo n.º 9
0
        public void GivenListANdDB_WhenInsert_ShouldRecordExecutionTime()
        {
            List <EmployeePayrollModel> employeeList = new List <EmployeePayrollModel>();

            employeeList.Add(new EmployeePayrollModel(employee_id: 101, employee_name: "Simran", job_description: "Tech", salary: 300000.00, new DateTime(2019 - 10 - 11), geneder: "F", companyId: 1, departmentId: 2, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 102, employee_name: "Adesh", job_description: "Support", salary: 400000.00, new DateTime(2019 - 11 - 11), geneder: "M", companyId: 3, departmentId: 3, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 103, employee_name: "Sandesh", job_description: "Production", salary: 300000.00, new DateTime(2019 - 10 - 11), geneder: "M", companyId: 3, departmentId: 1, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 104, employee_name: "Ruchita", job_description: "Management", salary: 400000.00, new DateTime(2019 - 10 - 11), geneder: "F", companyId: 2, departmentId: 3, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 105, employee_name: "Suchita", job_description: "Management", salary: 400000.00, new DateTime(2019 - 10 - 11), geneder: "F", companyId: 1, departmentId: 2, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 106, employee_name: "Shital", job_description: "Tech", salary: 300000.00, new DateTime(2019 - 10 - 11), geneder: "F", companyId: 1, departmentId: 2, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 107, employee_name: "Akash", job_description: "Support", salary: 400000.00, new DateTime(2019 - 11 - 11), geneder: "M", companyId: 3, departmentId: 3, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 108, employee_name: "Lalit", job_description: "Production", salary: 300000.00, new DateTime(2019 - 10 - 11), geneder: "M", companyId: 3, departmentId: 1, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 109, employee_name: "Rekha", job_description: "Management", salary: 400000.00, new DateTime(2019 - 10 - 11), geneder: "F", companyId: 2, departmentId: 3, is_employee_active: true));
            employeeList.Add(new EmployeePayrollModel(employee_id: 110, employee_name: "Rani", job_description: "Finance", salary: 400000.00, new DateTime(2019 - 10 - 11), geneder: "F", companyId: 1, departmentId: 1, is_employee_active: true));
            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();
            DateTime startDataTime = DateTime.Now;

            employeePayrollOperations.addEmplyeeToPayroll(employeeList);
            DateTime stopDateTime             = DateTime.Now;
            var      DurationWithoutThreading = stopDateTime - startDataTime;

            Console.WriteLine("Duration of Insertion without threading for List " + DurationWithoutThreading);

            EmployeePayroll      employeePayroll = new EmployeePayroll();
            EmployeePayrollModel model           = new EmployeePayrollModel()
            {
                employee_id        = 21,
                employee_name      = "Mahishwari",
                job_description    = "Finance",
                joining_date       = new DateTime(2019, 02, 22),
                salary             = 450000.00,
                geneder            = "F",
                companyId          = 2,
                departmentId       = 1,
                is_employee_active = true
            };

            DateTime startDataTimeforDB = DateTime.Now;

            employeePayroll.AddNewEmployee(model);
            DateTime stopDateTimeforDB             = DateTime.Now;
            var      DurationWithoutThreadingForDB = stopDateTimeforDB - startDataTimeforDB;

            Console.WriteLine("Duration of Insertion without threading for DB " + DurationWithoutThreadingForDB);

            DateTime startDataTimeThread = DateTime.Now;

            employeePayrollOperations.addEmplyeeToPayrollWithThread(employeeList);
            DateTime stopDateTimeThread  = DateTime.Now;
            var      DurationInThreading = stopDateTimeThread - startDataTimeThread;

            Console.WriteLine("Duration of Insertion with threading for List " + DurationInThreading);
        }
Ejemplo n.º 10
0
        public void CompareTimeAddingToMultipleTableDBWithOrWithoutThreading()
        {
            List <Employee>           empList = AddingDataToList();
            EmployeePayrollOperations employeePayrollOperations = new EmployeePayrollOperations();
            DateTime t1 = DateTime.Now;

            employeePayrollOperations.AddEmployeeListToDBMultipleTablesWithoutThread(empList);
            DateTime t2 = DateTime.Now;

            Console.WriteLine("Time taken while adding to list without threading: " + (t2 - t1));

            DateTime t3 = DateTime.Now;

            employeePayrollOperations.AddEmployeeListToDBMultipleTableWithThread(empList);
            DateTime t4 = DateTime.Now;

            Console.WriteLine("Time taken while adding to list with threading: " + (t4 - t3));
        }
Ejemplo n.º 11
0
        public void Given4Employee_WhenAddedTOList_ShouldMatchEmployeeEntries()
        {
            List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>();

            employeeDetails.Add(new EmployeeDetails {
                EmpID = 1, EmpName = "Kumar Kartikeya", PhoneNo = "7206183244", Address = "Tec", Department = "IT", Gender = "Male"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmpID = 2, EmpName = "Robert Lewandowski", PhoneNo = "8521479630", Address = "Bayern", Department = "Football", Gender = "Male"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmpID = 3, EmpName = "Douglas Costa", PhoneNo = "8745219630", Address = "Bayern", Department = "Football", Gender = "Male"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmpID = 4, EmpName = "Meg Lanning", PhoneNo = "9632587410", Address = "Australia", Department = "Cricket", Gender = "Female"
            });
            EmployeePayrollOperations employeePayrolloperations = new EmployeePayrollOperations();
            // UC 1
            DateTime startDateTime = DateTime.Now;

            employeePayrolloperations.addEmployeeToPayroll(employeeDetails);
            DateTime stopDateTime = DateTime.Now;

            Console.WriteLine("Duration without thread: " + (stopDateTime - startDateTime));
            /// UC 2 & UC 3
            DateTime startDateTimeThread = DateTime.Now;

            employeePayrolloperations.AddEmployeeToPayrollWithThread(employeeDetails);
            DateTime stopDateTimeThread = DateTime.Now;

            Console.WriteLine("Duration with thread: " + (stopDateTimeThread - startDateTimeThread));
            /// UC 4
            DateTime startDateTimeThreadSync = DateTime.Now;

            employeePayrolloperations.SynchronizingAddEmployeeWithThread(employeeDetails);
            DateTime stopDateTimeThreadSync = DateTime.Now;

            Console.WriteLine("Duration with thread: " + (stopDateTimeThreadSync - startDateTimeThreadSync));
        }
Ejemplo n.º 12
0
        /// UC 1:
        /// Adding without thread
        public void Given4Employee_WhenAddedTOList_ShouldMatchEmployeeEntries()
        {
            List <EmployeeDetails> employeeDetails = new List <EmployeeDetails>();

            employeeDetails.Add(new EmployeeDetails {
                EmpID = 1, EmpName = "Ruthik Reddy", PhoneNo = "5808983789", Address = "MBNR", Department = "IT", Gender = "Male"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmpID = 2, EmpName = "Ishan", PhoneNo = "8521479630", Address = "HYD", Department = "HR", Gender = "Male"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmpID = 3, EmpName = "Rohith", PhoneNo = "1234568798", Address = "Mumbai", Department = "SALES", Gender = "Male"
            });
            employeeDetails.Add(new EmployeeDetails {
                EmpID = 4, EmpName = "AXAR", PhoneNo = "9632587410", Address = "Chennai", Department = "HR", Gender = "Female"
            });
            EmployeePayrollOperations employeePayrolloperations = new EmployeePayrollOperations();
            DateTime startDateTime = DateTime.Now;

            employeePayrolloperations.addEmployeeToPayroll(employeeDetails);
            DateTime stopDateTime = DateTime.Now;

            Console.WriteLine("Duration without thread: " + (stopDateTime - startDateTime));
        }