コード例 #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
ファイル: Executor.cs プロジェクト: marwesfur/DreamNJasmine
        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));
 }