public void GetLabel_InValidData()
        {
            List <LabelEntity> labelList = new List <LabelEntity>();

            labelList.Add(new LabelEntity {
                Id = 11, Description = "Label_11", CreatedBy = 1, UpdatedBy = 1, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now
            });
            labelList.Add(new LabelEntity {
                Id = 12, Description = "Label_12", CreatedBy = 1, UpdatedBy = 1, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now
            });

            List <LabelDTO> dtoList = new List <LabelDTO>();

            dtoList.Add(new LabelDTO {
                Id = 11, Description = "Label_11", CreatedBy = 1, UpdatedBy = 1, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now
            });
            dtoList.Add(new LabelDTO {
                Id = 12, Description = "Label_12", CreatedBy = 1, UpdatedBy = 1, CreatedDate = DateTime.Now, UpdatedDate = DateTime.Now
            });

            _mapper.Setup(p => p.Map <List <LabelEntity>, List <LabelDTO> >(labelList)).Returns(dtoList);
            _repo.Setup(p => p.Get <LabelEntity>()).Returns(labelList);
            var returnObj = labelService.GetLabels();

            Assert.IsTrue(returnObj.Count == 2);
        }
 public DisplayableSpecial(string name, string path, Type type, BitmapImage icon)
 {
     Name   = name;
     Path   = path;
     Type   = type;
     Icon   = icon;
     Labels = LabelService.GetLabels(Path).Select((x) => new LabelItem(x)).ToList();
 }
示例#3
0
        private ImageNavigationResultView GetImageLabelNavigationResult(Topic topic, NavigationParameter navigationParameter, ENavigationDirection navigationDirection)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // fill imagelabel-structure of image label
            ImageNavigationResult image = NavigationService.Navigate(topic, navigationParameter.Index, navigationParameter.LabelMode, navigationDirection);


            // default navigation if not label was found on navigation to blank
            if (image == null && (navigationDirection == ENavigationDirection.Blank || navigationDirection == ENavigationDirection.LastBlank))
            {
                image = NavigationService.Navigate(topic, navigationParameter.Index, navigationParameter.LabelMode, ENavigationDirection.Direct);
            }

            if (image == null)
            {
                // return http-404 if no label found
                return(null);
            }

            // create naviation result
            ImageNavigationResultView navigationResult = ImageNavigationResultFactory.CreateView(image);

            switch (navigationParameter.LabelMode)
            {
            case ELabelMode.ObjectDetection:
                if (image.ImageLabel.HasLabels)
                {
                    IEnumerable <Label> labels = LabelService.GetLabels(topic, image.ImageLabel);
                    navigationResult.ImageLabel.Labels = labels.Select(LabelFactory.CreateView);
                }
                break;
            }

            sw.Stop();
            Log.Information($"Navigation takes {sw.ElapsedMilliseconds} ms");

            return(navigationResult);
        }
示例#4
0
 private DisplayableFolder(StorageFolder f)
 {
     _folder = f;
     _icon   = new BitmapImage();
     _labels = LabelService.GetLabels(f.Path).Select((x) => new LabelItem(x)).ToList();
 }
示例#5
0
 private DisplayableDisk(DriveInfo d)
 {
     _drive  = d;
     _labels = LabelService.GetLabels(d.Name).Select((x) => new LabelItem(x)).ToList();
 }