public IResult UpdateOperationClaim(DepartmentForUpdateClaimDto departmentForUpdateClaimDto) { var department = GetById(departmentForUpdateClaimDto.Id).Data; departmentForUpdateClaimDto.OperationClaimNames.Append("User.Me"); department.OperationClaimNames = departmentForUpdateClaimDto.OperationClaimNames; department.UpdatedAt = DateTime.Now; departmentDal.Update(department); return(new SuccessResult(Messages.DepartmentClaimUpdated)); }
public void UpdateOperationClaim_WhenUpdatedUpdateClaim_ShouldUpdate() { // Arrange var departmentForUpdateClaimDto = new DepartmentForUpdateClaimDto() { OperationClaimNames = Array.Empty <string>() }; var mockDepartmentDal = new MockDepartmentDal().MockUpdate().MockGet(new Department()); var sut = new DepartmentManager(mockDepartmentDal.Object); // Act sut.UpdateOperationClaim(departmentForUpdateClaimDto); // Assert mockDepartmentDal.VerifyUpdate(Times.Once()); }
public void DepartmentForUpdateClaimsValidator_TrueStory() { // Arrange var model = new DepartmentForUpdateClaimDto() { Id = 1, OperationClaimNames = new string[] { "Department.Add", "Department.Update" } }; var sut = new DepartmentForUpdateClaimsValidator(); // Act var result = sut.TestValidate(model); // Assert result.ShouldNotHaveAnyValidationErrors(); }