public void IsReturnExpectedList_ShowStructure_Directsubordination() { // Arrange IOrganizationService testService = new OrganizationService(); EmployeeModel root = new EmployeeModel("root", "root", 100000, "root"); EmployeeModel employee1 = new EmployeeModel("employee1", "employee1", 90000, "employee1"); WorkerModel worker1 = new WorkerModel("worker1", "worker1", 20000, "worker1"); WorkerModel worker = new WorkerModel("worker", "worker", 10000, "worker"); List <PersonComponent> expected = new List <PersonComponent>() { }; expected.Add(root); expected.Add(employee1); expected.Add(worker1); expected.Add(worker); // Act testService.AddRoot(root); testService.AddWorker(worker); testService.AddEmployee(employee1); testService.AddWorker(worker1); // Assert List <PersonComponent> actual = testService.ShowStructure(StrategyOption.Directsubordination); CollectionAssert.AreEqual(expected, actual); }
public void IsAddingNeededElement_ToCurrentEmployee() { // Arrange IOrganizationService testService = new OrganizationService(); testService.AddRoot(new EmployeeModel("root", "root", 1, "root")); EmployeeModel expected = new EmployeeModel("testsurname", "testname", 1000, "testposition"); // Act testService.AddEmployee(new EmployeeModel("testsurname", "testname", 1000, "testposition")); // Assert EmployeeModel actual = testService.CurrentEmployee; Assert.AreEqual(expected, actual); }
public void IsHierarchySetNeededElement() { // Arrange IOrganizationService testService = new OrganizationService(); testService.AddRoot(new EmployeeModel("root", "root", 1, "root")); testService.AddEmployee(new EmployeeModel("employee", "employee", 1, "employee")); EmployeeModel expected = new EmployeeModel("root", "root", 1, "root"); // Act testService.SetCurrentEmployee("root", "root"); // Assert EmployeeModel actual = testService.CurrentEmployee; Assert.AreEqual(expected, actual); }
public void IsReturnExpectedList_PositionEmployees() { // Arrange IOrganizationService testService = new OrganizationService(); EmployeeModel root = new EmployeeModel("root", "root", 100000, "root"); EmployeeModel employee1 = new EmployeeModel("employee1", "employee1", 90000, "employee1"); WorkerModel worker1 = new WorkerModel("worker1", "worker1", 20000, "worker1"); List <PersonComponent> expected = new List <PersonComponent>(); expected.Add(employee1); // Act testService.AddRoot(root); testService.AddEmployee(employee1); testService.AddWorker(worker1); // Assert List <PersonComponent> actual = testService.PositionEmployees("employee1"); CollectionAssert.AreEqual(expected, actual); }