Exemple #1
0
        public void TestRemove2()
        {
            var filter1    = _quickFilters.Add();
            var dataSource = new SingleDataSource(_logFileFactory, _scheduler,
                                                  new DataSource("daw")
            {
                Id = DataSourceId.CreateNew()
            });

            dataSource.ActivateQuickFilter(filter1.Id);

            var model = new QuickFiltersSidePanelViewModel(_settings, _quickFilters)
            {
                CurrentDataSource = new SingleDataSourceViewModel(dataSource, _actionCenter.Object)
            };
            var filter1Model = model.QuickFilters.First();

            filter1Model.IsActive = false;

            var changed = 0;

            model.OnFiltersChanged += () => ++ changed;

            filter1Model.RemoveCommand.Execute(null);
            model.QuickFilters.Should().BeEmpty("because we've just removed the only quick filter");
            changed.Should().Be(0, "because removing an inactive quick-filter should never fire the OnFiltersChanged event");
        }
Exemple #2
0
        public void TestCtor2()
        {
            var filter1    = _quickFilters.Add();
            var dataSource = new SingleDataSource(_logFileFactory, _scheduler,
                                                  new DataSource("daw")
            {
                Id = DataSourceId.CreateNew()
            });

            dataSource.ActivateQuickFilter(filter1.Id);

            var model   = new QuickFiltersSidePanelViewModel(_settings, _quickFilters);
            var changed = 0;

            model.OnFiltersChanged += () => ++ changed;
            model.CurrentDataSource = new SingleDataSourceViewModel(dataSource, _actionCenter.Object);
            changed.Should().Be(1, "Because changing the current data source MUST apply ");
        }