Ejemplo n.º 1
0
        TextFilterViewModel AddFilter(ICollection <TextFilterViewModel> filters, object entity, object key, ImageInsightsViewModel parent, ImageSource imageSource = null, Rect?imageCrop = null)
        {
            var filter = filters.FirstOrDefault(i => i.Key.Equals(key));

            if (filter == null)
            {
                //construct filter
                if (imageSource == null)
                {
                    filter = new TextFilterViewModel()
                    {
                        Entity = entity, Key = key
                    };
                }
                else
                {
                    filter = new ImageFilterViewModel()
                    {
                        Entity = entity, Key = key, ImageSource = imageSource, ImageCrop = imageCrop ?? new Rect()
                    };
                }

                filters.Add(filter);
            }
            if (!filter.Parents.Contains(parent))
            {
                filter.AddParent(parent);
            }
            return(filter);
        }
        public void SetUp()
        {
            _filter = new ImageFilter(null, false, false);

            _mockCommandBus = new Mock <ICommandBus>();

            _viewModel = new ImageFilterViewModel(
                _mockCommandBus.Object,
                _filter);
        }