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));
        }
Beispiel #2
0
        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());
        }
Beispiel #3
0
        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();
        }