public void Delete_filter_queues_delete_command()
        {
            var deleteFilterCommand = MockRepository.GenerateStub<ICommand>();
            commandFactory.Stub(cf => cf.CreateDeleteFilterCommand(Arg<FilterInfo>.Is.Anything))
                .Return(deleteFilterCommand);
            var filterInfo = new FilterInfo("filterName", "*");

            controller.DeleteFilter(filterInfo);

            commandFactory.AssertWasCalled(cf => cf.CreateDeleteFilterCommand(filterInfo));
            taskManager.AssertWasCalled(tm => tm.QueueTask(Arg.Is(deleteFilterCommand)));
        }
        public void Execute_should_call_DeleteFilter_on_ProjectController()
        {
            var projectController = MockRepository.GenerateStub<IProjectController>();
            var filterExpr = new NoneFilter<ITestDescriptor>().ToFilterExpr();
            var filterInfo = new FilterInfo("None", filterExpr);
            var command = new DeleteFilterCommand(projectController)
            {
                FilterInfo = filterInfo
            };

            command.Execute(MockProgressMonitor.Instance);

            projectController.AssertWasCalled(pc => pc.DeleteFilter(Arg<IProgressMonitor>.Is.Anything, 
                Arg.Is(filterInfo)));
        }
示例#3
0
        /// <summary>
        /// Creates a copy of the filter.
        /// </summary>
        /// <returns>The new copy.</returns>
        public FilterInfo Copy()
        {
            FilterInfo copy = new FilterInfo()
            {
                FilterName = filterName,
                FilterExpr = filterExpr
            };

            return copy;
        }
 public void DeleteFilter_Test()
 {
     var testProject = new TestProject();
     projectTreeModel.TestProject = testProject;
     var progressMonitor = MockProgressMonitor.Instance;
     
     Assert.Count(0, projectController.TestFilters.Value);
     FilterInfo filterInfo = new FilterInfo("filterName", new NoneFilter<ITestDescriptor>().ToFilterExpr());
     projectController.TestFilters.Value.Add(filterInfo);
     Assert.Count(1, projectController.TestFilters.Value);
     projectController.DeleteFilter(progressMonitor, filterInfo);
     Assert.Count(0, projectController.TestFilters.Value);
 }
 public void DeleteFilter(FilterInfo filterInfo)
 {
     var command = commandFactory.CreateDeleteFilterCommand(filterInfo);
     taskManager.QueueTask(command);
 }
 private void ApplyFilter(IProgressMonitor progressMonitor, FilterInfo filterInfo)
 {
     var filterSet = FilterUtils.ParseTestFilterSet(filterInfo.FilterExpr);
     var command = commandFactory.CreateApplyFilterCommand(filterSet);
     command.Execute(progressMonitor);
 }
示例#7
0
        /// <summary>
        /// Removes a test filter.
        /// </summary>
        /// <param name="filter">The filter to remove.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="filter"/> is null.</exception>
        public void RemoveTestFilter(FilterInfo filter)
        {
            if (filter == null)
                throw new ArgumentNullException("filter");

            testFilters.Remove(filter);
        }
示例#8
0
        /// <summary>
        /// Adds a test filter if not already added.
        /// </summary>
        /// <param name="filter">The filter to add.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="filter"/> is null.</exception>
        public void AddTestFilter(FilterInfo filter)
        {
            if (filter == null)
                throw new ArgumentNullException("filter");

            filter.Validate();

            if (!testFilters.Contains(filter))
                testFilters.Add(filter);
        }