Ejemplo n.º 1
0
        public void AddEmployee_ShouldMatchEmployeeEnries_UsingMultiThreading()
        {
            EmployeeRepo repo = new EmployeeRepo();

            EmployeePayroll employee = new EmployeePayroll();

            employee.EmployeeName = "ktrrr";
            employee.Department   = ".Net";
            employee.StartDate    = DateTime.Parse("10-24-2009");

            DateTime startTime = DateTime.Now;

            repo.AddEmployee(employee);
            repo.AddEmployee(employee);
            repo.AddEmployee(employee);
            DateTime stopTime = DateTime.Now;

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

            DateTime startTime2 = DateTime.Now;

            repo.AddEmployeeWithThread(employee);
            repo.AddEmployeeWithThread(employee);
            repo.AddEmployeeWithThread(employee);
            DateTime stopTime2 = DateTime.Now;

            Console.WriteLine("Duration with thread: " + (stopTime2 - startTime2));
        }
Ejemplo n.º 2
0
        public int CreateEmployee(RegisterInputModel model)
        {
            var employee = new EmployeeInputModel
            {
                Email     = model.Email,
                FirstName = model.FirstName,
                LastName  = model.LastName
            };

            return(_employeeRepo.AddEmployee(employee));
        }
Ejemplo n.º 3
0
        public bool AddEmployee(Employee e, string password)
        {
            _e = FinishEmployeeObject(e);
            EmployeeRepo repo = new EmployeeRepo();

            ValidateEmployeeForCreate();

            LoginRepo lRepo = new LoginRepo();

            PrepareLogin(password);
            if (Errors.Count == 0)
            {
                repo.AddEmployee(_e);
                return(lRepo.Insert(_l));
            }
            return(false);
        }
Ejemplo n.º 4
0
 public void OnaddingEmployeeShouldSyncWithDB()
 {
     EmployeeDetails employee = new EmployeeDetails();
     EmployeeRepo employeeRepo = new EmployeeRepo();
     employee.EmployeeName = "Harry";
     employee.Department = "Finance";
     employee.PhoneNumber = "9999999999";
     employee.Address = "Kolkata";
     employee.Gender = Convert.ToChar("M");
     employee.StartDate = DateTime.Today;
     employee.BasicPay = Convert.ToDecimal(800000);
     employee.Deductions = Convert.ToDecimal(80000);
     employee.TaxablePay = Convert.ToDecimal(720000);
     employee.IncomeTax = Convert.ToDecimal(7200);
     employee.NetPay = Convert.ToDecimal(712800);
     bool result = employeeRepo.AddEmployee(employee);
     Assert.AreEqual(result, true);
 }
Ejemplo n.º 5
0
        public void Given_NewEmployeeWhenAdded_Should_SyncWithDB()
        {
            EmployeeModel employee = new EmployeeModel();

            employee.EmployeeName = "Manpreet";
            employee.Department   = "Sales";
            employee.PhoneNumber  = "568793223";
            employee.Address      = "03-Pancham Society";
            employee.Gender       = "Female";
            employee.StartDate    = DateTime.Today;
            employee.BasicPay     = 20000;
            employee.TaxablePay   = 500;
            employee.Tax          = 5000;
            employee.NetPay       = 15000;

            bool actualResult = repo.AddEmployee(employee);

            Assert.AreEqual(actualResult, true);
        }
Ejemplo n.º 6
0
        public void Given_NewEmployeeWhenAdded_Should_SyncWithDB()
        {
            EmployeeModel employee = new EmployeeModel();

            employee.EmployeeName = "Ankit";
            employee.Department   = "Marketing";
            employee.PhoneNumber  = "245342636";
            employee.Address      = "Uttam nagar";
            employee.Gender       = 'F';
            employee.StartDate    = DateTime.Now;
            employee.BasicPay     = 200000;
            employee.Deductions   = 15000;
            employee.TaxablePay   = 150000;
            employee.Tax          = 20000;
            employee.NetPay       = 110000;

            bool result = employeeRepo.AddEmployee(employee);

            Assert.AreEqual(result, true);
        }
Ejemplo n.º 7
0
        public void GivenNewEmployee_AddEmployeeMethod_ShouldReturnTrue()
        {
            EmployeeRepo  repo     = new EmployeeRepo();
            EmployeeModel employee = new EmployeeModel()
            {
                EmployeeName = "Devrath",
                Gender       = 'M',
                Company      = "Accenture",
                Department   = "Sales",
                PhoneNumber  = "6308299587",
                Address      = "Hyderabad",
                StartDate    = Convert.ToDateTime("05-04-2019"),
                BasicPay     = 100000,
                Deductions   = 2000,
                TaxablePay   = 98000,
                Tax          = 10000,
                NetPay       = 97000,
            };
            bool result = repo.AddEmployee(employee);

            Assert.AreEqual(true, result);
        }
Ejemplo n.º 8
0
 public void AddEmployee([FromBody] Employee employee)
 {
     employeeRepo.AddEmployee(employee);
 }