コード例 #1
0
        public void IsEmpty_ProjectIdsIsEmptyOrNull_ReturnTrue()
        {
            //arrange
            var scope = new WorkflowAssignScope()
            {
                AllArtifacts = true, AllProjects = false, ArtifactIds = new List <int> {
                    1
                }, ProjectIds = new List <int> {
                }
            };
            var expectedResult = true;

            //act
            var result = scope.IsEmpty();

            //assert
            Assert.AreEqual(expectedResult, result);

            //arrange
            scope.ProjectIds = null;

            //act
            result = scope.IsEmpty();

            //assert
            Assert.AreEqual(expectedResult, result);
        }
コード例 #2
0
        public async Task <IHttpActionResult> AssignProjectsAndArtifactTypesToWorkflow(int workFlowid, [FromBody] WorkflowAssignScope workflowAssign)
        {
            await _privilegesManager.Demand(Session.UserId, InstanceAdminPrivileges.AccessAllProjectData);

            if (workflowAssign == null)
            {
                throw new BadRequestException(ErrorMessages.AssignMemberScopeEmpty, ErrorCodes.BadRequest);
            }

            if (workflowAssign.IsEmpty())
            {
                return(Ok(AssignProjectsResult.Empty));
            }

            var result = await _workflowRepository.AssignProjectsAndArtifactTypesToWorkflow(workFlowid, workflowAssign);

            return(Ok(result));
        }
コード例 #3
0
        public void IsEmpty_AllParametersIsOk_ReturnFalse()
        {
            //arrange
            var scope = new WorkflowAssignScope()
            {
                AllArtifacts = true, AllProjects = true, ArtifactIds = new List <int> {
                    1
                }, ProjectIds = new List <int> {
                    1
                }
            };
            var expectedResult = false;

            //act
            var result = scope.IsEmpty();

            //assert
            Assert.AreEqual(expectedResult, result);
        }