예제 #1
0
        public override void Specify()
        {
            describe("FixtureClassifier detects classes that are specifications", () =>
            {
                it("excludes non specification classes", () =>
                {
                    expect(() => !FixtureClassifier.IsTypeSpecification(typeof(Object)));
                });

                it("includes classes derived from GivenWhenThenFixture", () =>
                {
                    expect(() => FixtureClassifier.IsTypeSpecification(typeof(FixtureClassifierSpecification.SomeNestedClass)));
                    expect(() => FixtureClassifier.IsTypeSpecification(typeof(SampleTest)));
                });

                describe("some classes derived from GivenWhenThenFixture still are not specifications", () =>
                {
                    it("excludes abstract classes", () =>
                    {
                        expect(() => !FixtureClassifier.IsTypeSpecification(typeof(FixtureClassifierSpecification.SomeAbstractClass)));
                    });

                    it("excludes non-public classes", () =>
                    {
                        expect(() => !FixtureClassifier.IsTypeSpecification(typeof(FixtureClassifierSpecification.ANonpublicFixture)));
                    });
                });
            });
        }
예제 #2
0
        protected static GenericTestFactory RunTestDiscovery(Assembly assembly, Func <Type, bool> typeFilter)
        {
            GenericTestFactory nativeTestFactory = new GenericTestFactory();

            var filteredTypes = assembly.GetTypes().Where(t => FixtureClassifier.IsTypeSpecification(t)).Where(typeFilter);

            foreach (var type in filteredTypes)
            {
                SpecificationBuilder.BuildTestFixture(type, nativeTestFactory, nativeTestFactory.GlobalSetupOwner);
            }

            return(nativeTestFactory);
        }
예제 #3
0
 public bool CanBuildFrom(Type type)
 {
     return(FixtureClassifier.IsTypeSpecification(type));
 }