Esempio n. 1
0
        public void GiveMultipleEmployee_ShouldREturn_NumberofEmployeesAdded()
        {
            EmployeeModel employee2 = new EmployeeModel();

            employee2.EmployeeName = "Sushree";
            employee2.StartDate    = employee2.StartDate = Convert.ToDateTime("2020-11-03");
            employee2.Gender       = "female";
            employee2.PhoneNumber  = "6302907918";
            employee2.Department   = "Tech";
            employee2.Address      = "Raigarh";
            employee2.BasicPay     = 20000.00M;
            employee2.Tax          = 700.00;
            employee2.TaxablePay   = 15000.00;
            employee2.NetPay       = 18000.00;

            EmployeeModel employee3 = new EmployeeModel();

            employee3.EmployeeName = "Rakesh";
            employee3.StartDate    = employee3.StartDate = Convert.ToDateTime("2020-12-03");
            employee3.Gender       = "Male";
            employee3.PhoneNumber  = "6305687918";
            employee3.Department   = "Logistics";
            employee3.Address      = "Hyderabad Branch";
            employee3.BasicPay     = 50000.00M;
            employee3.Tax          = 500.00;
            employee3.TaxablePay   = 15000.00;
            employee3.NetPay       = 35000.00;

            EmployeeModel employee4 = new EmployeeModel();

            employee4.EmployeeName = "Ritika";
            employee4.StartDate    = employee4.StartDate = Convert.ToDateTime("2020-05-03");
            employee4.Gender       = "Female";
            employee4.PhoneNumber  = "9995687918";
            employee4.Department   = "Sales";
            employee4.Address      = "Hyderabad Branch";
            employee4.BasicPay     = 55000.00M;
            employee4.Tax          = 500.00;
            employee4.TaxablePay   = 15500.00;
            employee4.NetPay       = 40000.00;


            model.employeeList.Add(employee4);
            model.employeeList.Add(employee2);
            model.employeeList.Add(employee3);
            int actualRecordsAdded = repo.AddMultipleEmployees(model.employeeList);

            Assert.AreEqual(actualRecordsAdded, 3);
        }
Esempio n. 2
0
        public void GivenMultipleEmployees_WhenAdded_ShouldReturnNoOfEmployeesAdded()
        {
            List <EmployeeModel> empList   = new List <EmployeeModel>();
            EmployeeModel        employee1 = new EmployeeModel();

            employee1.EmployeeName = "Ganesh";
            employee1.Department   = "Marketting";
            employee1.PhoneNumber  = "7845985625";
            employee1.Address      = "Mathura";
            employee1.Gender       = 'M';
            employee1.BasicPay     = 500000M;
            employee1.Deductions   = 0.2M * employee1.BasicPay;
            employee1.TaxablePay   = employee1.BasicPay - employee1.Deductions;
            employee1.Tax          = 0.1M * employee1.TaxablePay;
            employee1.NetPay       = employee1.BasicPay - employee1.Tax;
            employee1.StartDate    = Convert.ToDateTime("23-10-2018");
            employee1.DepartmentId = 516;
            empList.Add(employee1);
            EmployeeModel employee2 = new EmployeeModel();

            employee2.EmployeeName = "Kanishk";
            employee2.Department   = "Construction";
            employee2.PhoneNumber  = "9856985685";
            employee2.Address      = "Hyderabad";
            employee2.Gender       = 'M';
            employee2.BasicPay     = 400000M;
            employee2.Deductions   = 0.2M * employee2.BasicPay;
            employee2.TaxablePay   = employee2.BasicPay - employee2.Deductions;
            employee2.Tax          = 0.1M * employee2.TaxablePay;
            employee2.NetPay       = employee2.BasicPay - employee2.Tax;
            employee2.StartDate    = Convert.ToDateTime("08-09-2019");
            employee2.DepartmentId = 584;
            empList.Add(employee2);
            //without thread addition
            DateTime startDateTime      = DateTime.Now;
            int      noOfEmployeesAdded = repo.AddMultipleEmployees(empList);
            DateTime stopDateTime       = DateTime.Now;

            Console.WriteLine("Duration without thread: " + (stopDateTime - startDateTime));
            Assert.AreEqual(noOfEmployeesAdded, 2);
        }
Esempio n. 3
0
        public void TestMethod4()
        {
            // when added multiple employees should return true
            List <EmployeeModel> employeeList = new List <EmployeeModel>();
            EmployeeModel        employee1    = new EmployeeModel();
            EmployeeModel        employee2    = new EmployeeModel();

            employee1.EmployeeName = "Sachin";
            employee1.Department   = "Sales";
            employee1.PhoneNumber  = "3456789012";
            employee1.Address      = "Delhi";
            employee1.Gender       = Convert.ToChar("M");
            employee1.StartDate    = DateTime.Today;
            employee1.BasicPay     = Convert.ToDecimal(75000);
            employee1.Deductions   = 0.2M * employee1.BasicPay;
            employee1.TaxablePay   = employee1.BasicPay - employee1.Deductions;
            employee1.Tax          = 0.1M * employee1.TaxablePay;
            employee1.NetPay       = employee1.BasicPay - employee1.Tax;
            employeeList.Add(employee1);

            employee2.EmployeeName = "Shreya";
            employee2.Department   = "Marketing";
            employee2.PhoneNumber  = "9876543210";
            employee2.Address      = "Mumbai";
            employee2.Gender       = Convert.ToChar("F");
            employee2.StartDate    = DateTime.Today;
            employee2.BasicPay     = Convert.ToDecimal(80000);
            employee2.Deductions   = 0.2M * employee2.BasicPay;
            employee2.TaxablePay   = employee2.BasicPay - employee2.Deductions;
            employee2.Tax          = 0.1M * employee2.TaxablePay;
            employee2.NetPay       = employee2.BasicPay - employee2.Tax;
            employeeList.Add(employee2);
            DateTime startTime = DateTime.Now;

            employeeRepo.AddMultipleEmployees(employeeList);
            DateTime endTime = DateTime.Now;

            Console.WriteLine("Duration without thread: " + (endTime - startTime));
        }