コード例 #1
0
        public ITestCaseFilter GetTestCaseFilter()
        {
            ITestCaseFilter filter = null;

            if (this.TestCaseFilters.Count != 0)
                return new ScopeTestCaseFilter(this.TestCaseFilters);

            if (this.RunFailures.Count != 0)
            {
                foreach (string runFailureReport in this.RunFailures)
                {
                    if (!File.Exists(runFailureReport))
                        throw new ArgumentException("Could not find failure file " + runFailureReport);
                    XmlTestBatch testBatch = UnitSerializer.Deserialize(runFailureReport);
                    if (testBatch != null)
                    {
                        FailureFilter failureFilter = new FailureFilter(testBatch);
                        if (filter == null)
                            filter = failureFilter;
                        else
                            filter = new AndTestCaseFilter(filter, failureFilter);
                    }
                }
            }

            if (filter==null)
                filter = new AnyTestCaseFilter();
            return filter;
        }
コード例 #2
0
        public IFixtureFilter GetFixtureFilter()
        {
            IFixtureFilter filter=null;
            if (this.FixtureFilters.Count != 0)
                filter = new ScopeFixtureFilter(this.FixtureFilters);

            if (this.Categories.Count != 0)
            {
                if (filter == null)
                    filter = new CategoryFixtureFilter(this.Categories);
                else
                    filter = new AndFixtureFilter(
                        filter,
                        new CategoryFixtureFilter(this.Categories)
                        );
            }

            if (this.RunFailures.Count != 0)
            {
                foreach (string runFailureReport in this.RunFailures)
                {
                    if (!File.Exists(runFailureReport))
                        throw new ArgumentException("Could not find failure file "+ runFailureReport);
                    XmlTestBatch testBatch = UnitSerializer.Deserialize(runFailureReport);
                    if (testBatch != null)
                    {
                        FailureFilter failureFilter = new FailureFilter(testBatch);
                        if (filter == null)
                            filter = failureFilter;
                        else
                            filter = new AndFixtureFilter(filter, failureFilter);
                    }
                }
            }

            if (this.UseCurrentFixtures)
            {
                if (filter == null)
                    filter = new CurrentFixtureFilter();
                else
                    filter = new AndFixtureFilter(filter, new CurrentFixtureFilter());
            }

            if (filter == null)
                filter = new AnyFixtureFilter();
            return filter;
        }