public static bool MarkDeleted(ShortPosition item) { return MarkDeleted(item.UID, item.Name); }
public static bool Restore(ShortPosition item) { return Restore(item.UID, item.Name); }
public void IsShowDeletedPosition() { var organisation = new Organisation(); var department = new ShortDepartment { Name = "DeletedDepartment", OrganisationUID = organisation.UID, IsDeleted = true }; var position = new ShortPosition { Name = "DeletedPosition", OrganisationUID = organisation.UID, IsDeleted = true }; var employee = new Employee { FirstName = "FName", SecondName = "SName", LastName = "LName", OrganisationUID = organisation.UID, DepartmentName = department.Name, DepartmentUID = department.UID, IsDepartmentDeleted = department.IsDeleted, PositionName = position.Name, PositionUID = position.UID, IsPositionDeleted = position.IsDeleted }; var shortEmployee = new ShortEmployee { UID = employee.UID, FirstName = employee.FirstName, SecondName = employee.SecondName, LastName = employee.LastName, OrganisationUID = organisation.UID, DepartmentName = department.Name, IsDepartmentDeleted = department.IsDeleted, PositionName = position.Name, IsPositionDeleted = position.IsDeleted }; ClientManager.CurrentUser.PermissionStrings.Add("Oper_SKD_Employees_Edit"); var mock = new Mock<ISafeRubezhService>(); mock.Setup(x => x.GetOrganisations(It.IsAny<OrganisationFilter>())).Returns(() => { return new OperationResult<List<Organisation>>(new List<Organisation> { organisation }); }); mock.Setup(x => x.GetEmployeeList(It.IsAny<EmployeeFilter>())).Returns(() => { return new OperationResult<List<ShortEmployee>>(new List<ShortEmployee> { shortEmployee}); }); mock.Setup(x => x.GetEmployeeDetails(It.IsAny<Guid>())).Returns(() => { return new OperationResult<Employee>(employee); }); mock.Setup(x => x.GetAdditionalColumnTypes(It.IsAny<AdditionalColumnTypeFilter>())).Returns(() => { return new OperationResult<List<AdditionalColumnType>>(); }); mock.Setup(x => x.SaveEmployee(It.IsAny<Employee>(), It.IsAny<bool>())).Returns(() => { return new OperationResult<bool>(true); }); ClientManager.RubezhService = mock.Object; (ServiceFactory.DialogService as MockDialogService).OnShowModal += window => (window as EmployeeDetailsViewModel).SaveCommand.Execute(); var employeesViewModel = new EmployeesViewModel(); employeesViewModel.Initialize(new EmployeeFilter()); employeesViewModel.SelectedItem = employeesViewModel.Organisations.FirstOrDefault().Children.FirstOrDefault(); employeesViewModel.EditCommand.Execute(); Assert.IsTrue(employeesViewModel.SelectedItem.DepartmentName == null || employeesViewModel.SelectedItem.DepartmentName == ""); Assert.IsTrue(employeesViewModel.SelectedItem.PositionName == null || employeesViewModel.SelectedItem.PositionName == ""); }