public static void UsingObjectAdapter() { var employeesArray = new string[][] { new string[4] { "101", "John", "SE", "10000" }, new string[4] { "101", "John", "SE", "10000" }, new string[4] { "101", "John", "SE", "10000" }, new string[4] { "101", "John", "SE", "10000" }, new string[4] { "101", "John", "SE", "10000" } }; ITarget target = new EmployeeAdapter(); target.ProcessCompanySalary(employeesArray); }
static void Main(string[] args) { string[,] employeesArray = new string[5, 4] { { "101", "John", "SE", "10000" }, { "102", "Smith", "SE", "20000" }, { "103", "Dev", "SSE", "30000" }, { "104", "Pam", "SE", "40000" }, { "105", "Sara", "SSE", "50000" } }; ITarget target = new EmployeeAdapter(); Console.WriteLine("HR system passes employee string array to Adapter\n"); target.ProcessCompanySalary(employeesArray); Console.Read(); }
public void test_employee() { string[,] employeesArray = new string[5, 5] { { "101", "John", "SE", "31.5", "10000" }, { "102", "Smith", "SE", "12.7", "20000" }, { "103", "Dev", "SSE", "21.6", "30000" }, { "104", "Pam", "SE", "23.8", "40000" }, { "105", "Sara", "SSE", "50.5", "50000" } }; ITarget target = new EmployeeAdapter(); target.ProcessCompanySalary(employeesArray); List <Employee> list = target.GetListEmployee(); { Employee employee = EmloyeeServices.FindEmployeeByID(list, 101); Assert.That(employee.ID == 101); Assert.That(employee.Name == "John"); Assert.That(employee.Designation == "SE"); Assert.That(employee.WorkingHours == 31.5); Assert.That(employee.PaySalary == PaySalary.Paid); Assert.That(employee.Salary == 10000); } { Employee employee = EmloyeeServices.FindEmployeeByID(list, 102); Assert.That(employee.ID == 102); Assert.That(employee.Name == "Smith"); Assert.That(employee.Designation == "SE"); Assert.That(employee.WorkingHours == 12.7); Assert.That(employee.PaySalary == PaySalary.NotPaid); Assert.That(employee.Salary == 0); } { Employee employee = EmloyeeServices.FindEmployeeByID(list, 103); Assert.That(employee.ID == 103); Assert.That(employee.Name == "Dev"); Assert.That(employee.Designation == "SSE"); Assert.That(employee.WorkingHours == 21.6); Assert.That(employee.PaySalary == PaySalary.Paid); Assert.That(employee.Salary == 30000); } { Employee employee = EmloyeeServices.FindEmployeeByID(list, 104); Assert.That(employee.ID == 104); Assert.That(employee.Name == "Pam"); Assert.That(employee.Designation == "SE"); Assert.That(employee.WorkingHours == 23.8); Assert.That(employee.PaySalary == PaySalary.Paid); Assert.That(employee.Salary == 40000); } { Employee employee = EmloyeeServices.FindEmployeeByID(list, 105); Assert.That(employee.ID == 105); Assert.That(employee.Name == "Sara"); Assert.That(employee.Designation == "SSE"); Assert.That(employee.WorkingHours == 50.5); Assert.That(employee.PaySalary == PaySalary.Paid); Assert.That(employee.Salary == 50000); } { Employee employee = EmloyeeServices.FindEmployeeByID(list, 106); Assert.That(employee == null); } }