예제 #1
0
        public void ProcessInfo_MapArray_Successfull()
        {
            // Arrange
            List <ProcessInfo> pi = new List <ProcessInfo>()
            {
                new ProcessInfo()
                {
                    ProcessType = ProcessType.SystemToSystemProcess.ToString(),
                    ItemId      = 1
                },
                new ProcessInfo()
                {
                    ProcessType = ProcessType.UserToSystemProcess.ToString(),
                    ItemId      = 2
                },
                new ProcessInfo()
                {
                    ProcessType = ProcessType.BusinessProcess.ToString(),
                    ItemId      = 3
                },
            };


            List <ProcessInfoDto> piDTO = ProcessInfoMapper.Map(pi);

            Assert.AreEqual(piDTO.Count, 3);
            Assert.AreEqual(piDTO[0].ProcessType, ProcessType.SystemToSystemProcess);
            Assert.AreEqual(piDTO[1].ProcessType, ProcessType.UserToSystemProcess);
            Assert.AreEqual(piDTO[2].ProcessType, ProcessType.BusinessProcess);
        }
예제 #2
0
        public void ProcessInfo_IncorrectString_ParsedToNoneType_Successfull()
        {
            // Arrange
            ProcessInfo pi = new ProcessInfo()
            {
                ProcessType = "sefsdfsdfsdf~@!@$@#$",
                ItemId      = 1
            };

            ProcessInfoDto piDTO = ProcessInfoMapper.Map(pi);

            Assert.AreEqual(piDTO.ProcessType, ProcessType.None);
        }
예제 #3
0
        public void ProcessInfo_MapUserToSystemType_Successfull()
        {
            // Arrange
            ProcessInfo pi = new ProcessInfo()
            {
                ProcessType = ProcessType.UserToSystemProcess.ToString(),
                ItemId      = 1
            };

            ProcessInfoDto piDTO = ProcessInfoMapper.Map(pi);

            Assert.AreEqual(piDTO.ProcessType, ProcessType.UserToSystemProcess);
        }
예제 #4
0
        public async Task <IEnumerable <ProcessInfoDto> > GetProcessInformationAsync(IEnumerable <int> artifactIds, int userId)
        {
            if (artifactIds == null)
            {
                throw new ArgumentOutOfRangeException(nameof(artifactIds));
            }

            var artifactsPermissions = await ArtifactPermissionsRepository.GetArtifactPermissions(artifactIds, userId);

            artifactIds = artifactsPermissions.Where(p => p.Value.HasFlag(RolePermissions.Read)).Select(p => p.Key);

            var param = new DynamicParameters();

            param.Add("@artifactIds", SqlConnectionWrapper.ToDataTable(artifactIds));
            var artifacts = await ConnectionWrapper.QueryAsync <ProcessInfo>("GetProcessInformation", param, commandType : CommandType.StoredProcedure);

            return(ProcessInfoMapper.Map(artifacts));
        }