public void Initialize() { session = new Session { UserId = userId }; artifactIds = new HashSet <int>() { 1, 2, 3 }; processInfo = new List <ProcessInfoDto>() { new ProcessInfoDto() { ItemId = 1, ProcessType = ProcessType.None }, new ProcessInfoDto() { ItemId = 2, ProcessType = ProcessType.None }, new ProcessInfoDto() { ItemId = 3, ProcessType = ProcessType.None } }; filter = StandardArtifactTypes.All; mockArtifactRepository = new Mock <IArtifactRepository>(); mockServiceLogRepository = new Mock <IServiceLogRepository>(); mockArtifactPermissionsRepository = new Mock <IArtifactPermissionsRepository>(); _mockSqlPrivilegesRepository = new Mock <IPrivilegesRepository>(); artifactController = new ArtifactController(mockArtifactRepository.Object, mockArtifactPermissionsRepository.Object, _mockSqlPrivilegesRepository.Object, mockServiceLogRepository.Object) { Request = new HttpRequestMessage() }; artifactController.Request.Properties[ServiceConstants.SessionProperty] = session; }
public async Task <IEnumerable <StandardArtifactType> > GetStandardArtifactTypes(StandardArtifactTypes filter = StandardArtifactTypes.All) { var parameters = new DynamicParameters(); parameters.Add("@isRegularArtifactTypes", filter); var artifacts = await ConnectionWrapper.QueryAsync <StandardArtifactType>("GetStandardArtifactTypes", parameters, commandType : CommandType.StoredProcedure); return(artifacts); }
public async Task <IEnumerable <StandardArtifactType> > GetStandardArtifactTypes(StandardArtifactTypes filter = StandardArtifactTypes.All) { await _privilegesManager.Demand(Session.UserId, InstanceAdminPrivileges.AccessAllProjectData); if (filter != StandardArtifactTypes.All && filter != StandardArtifactTypes.Regular) { throw new BadRequestException(ErrorMessages.InvalidStandardArtifactTypesFilterValue); } return(await _artifactRepository.GetStandardArtifactTypes(filter)); }