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))); }); }); }); }
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); }
public bool CanBuildFrom(Type type) { return(FixtureClassifier.IsTypeSpecification(type)); }