private Test BuildMultipleFixtures(Type type, IFixtureBuilder[] attrs) { TestSuite suite = new ParameterizedFixtureSuite(type); foreach (IFixtureBuilder attr in attrs) { suite.Add(attr.BuildFrom(type)); } return(suite); }
private TestSuite BuildMultipleFixtures(Type type, IEnumerable <TestSuite> fixtures) { TestSuite suite = new ParameterizedFixtureSuite(type); foreach (var fixture in fixtures) { suite.Add(fixture); } return(suite); }
public IEnumerable <TestSuite> BuildFrom(ITypeInfo typeInfo, IPreFilter filter) { Type sourceType = SourceType ?? typeInfo.Type; var fixtureSuite = new ParameterizedFixtureSuite(typeInfo); fixtureSuite.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo()); foreach (ITestFixtureData parms in GetParametersFor(sourceType)) { TestSuite fixture = _builder.BuildFrom(typeInfo, filter, parms); fixtureSuite.Add(fixture); } yield return(fixtureSuite); }
private Test BuildMultipleFixtures(Type type, TestFixtureAttribute[] attrs) { TestSuite suite = new ParameterizedFixtureSuite(type); if (attrs.Length > 0) { foreach (TestFixtureAttribute attr in attrs) suite.Add(BuildSingleFixture(type, attr)); } else { suite.RunState = RunState.NotRunnable; suite.Properties.Set(PropertyNames.SkipReason, NO_TYPE_ARGS_MSG); } return suite; }
private Test BuildMultipleFixtures(Type type, Attribute[] attrs) { TestSuite suite = new ParameterizedFixtureSuite(type); if (attrs.Length > 0) { foreach (Attribute attr in attrs) { suite.Add(BuildSingleFixture(type, attr)); } } else { suite.RunState = RunState.NotRunnable; suite.IgnoreReason = "Generic fixture has no type arguments provided"; } return(suite); }
public IEnumerable <TestSuite> BuildFrom(ITypeInfo typeInfo, IPreFilter filter) { // This whole method does more or less the same thing as NUnit's own // TestFixtureSourceAttribute, but with two differences: // 1) this is hard-coded to use the list of test modes as its input // 2) this adds a Category of "fast" when the DirectInvocation mode is used // That second one is important for enabling a quick developer loop. Developers // can create a test playlist that runs only the "fast" tests, or if they have // NCrunch, they can define a custom Engine Mode that automatically runs only // fast tests. These "fast" tests can run without spinning up a new functions // host. Also, because they do not set up an HTTP listener, they can be executed // in parallel without hitting port conflicts. var fixtureSuite = new ParameterizedFixtureSuite(typeInfo); fixtureSuite.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo()); ICustomAttributeProvider assemblyLifeCycleAttributeProvider = typeInfo.Type.GetTypeInfo().Assembly; ICustomAttributeProvider typeLifeCycleAttributeProvider = typeInfo.Type.GetTypeInfo(); foreach (object[] args in FixtureArgs) { var arg = (TestHostModes)args[0]; ITestFixtureData parms = new TestFixtureParameters(new object[] { arg }); TestSuite fixture = this.builder.BuildFrom(typeInfo, filter, parms); switch (arg) { case TestHostModes.DirectInvocation: fixture.Properties["Category"].Add("fast"); fixture.Properties["Category"].Add("parallelizable"); break; case TestHostModes.InProcessEmulateFunctionWithActionResult: fixture.Properties["Category"].Add("fast"); break; } fixture.ApplyAttributesToTest(assemblyLifeCycleAttributeProvider); fixture.ApplyAttributesToTest(typeLifeCycleAttributeProvider); fixtureSuite.Add(fixture); } yield return(fixtureSuite); }
public Test BuildFrom(Type type) { var suite = new ParameterizedFixtureSuite(type); var attr = (ParameterizedTestFixtureAttribute)Reflect.GetAttribute(type, typeof(ParameterizedTestFixtureAttribute).FullName, true); ITestParameterProvider provider; if (attr.FactoryName != null) { provider = Configuration.GetProvider(attr.FactoryName); } else { provider = Configuration.GetProvider(attr.Type); } foreach (var parameter in provider.GetParameters(type)) { suite.Add(BuildFixture(type, attr, parameter)); } return(suite); }
/// <inheritdoc/> public IEnumerable <TestSuite> BuildFrom(ITypeInfo typeInfo, IPreFilter filter) { // This whole method does more or less the same thing as NUnit's own // TestFixtureSourceAttribute, but with one difference: it is hard-coded to use // the list of test modes as its input. var fixtureSuite = new ParameterizedFixtureSuite(typeInfo); fixtureSuite.ApplyAttributesToTest(typeInfo.Type.GetTypeInfo()); ICustomAttributeProvider assemblyLifeCycleAttributeProvider = typeInfo.Type.GetTypeInfo().Assembly; ICustomAttributeProvider typeLifeCycleAttributeProvider = typeInfo.Type.GetTypeInfo(); foreach (object[] args in FixtureArgs) { var arg = (SetupModes)args[0]; ITestFixtureData parms = new TestFixtureParameters(new object[] { arg }); TestSuite fixture = this.builder.BuildFrom(typeInfo, filter, parms); fixture.ApplyAttributesToTest(assemblyLifeCycleAttributeProvider); fixture.ApplyAttributesToTest(typeLifeCycleAttributeProvider); fixtureSuite.Add(fixture); } yield return(fixtureSuite); }
private Test BuildMultipleFixtures(Type type, Attribute[] attrs) { TestSuite suite = new ParameterizedFixtureSuite(type); if (attrs.Length > 0) { foreach (Attribute attr in attrs) suite.Add(BuildSingleFixture(type, attr)); } else { suite.RunState = RunState.NotRunnable; suite.IgnoreReason = "Generic fixture has no type arguments provided"; } return suite; }
private Test BuildMultipleFixtures(Type type, IFixtureBuilder[] attrs) { TestSuite suite = new ParameterizedFixtureSuite(type); foreach (IFixtureBuilder attr in attrs) suite.Add(attr.BuildFrom(type)); return suite; }
private TestSuite BuildMultipleFixtures(ITypeInfo typeInfo, IEnumerable<TestSuite> fixtures) { TestSuite suite = new ParameterizedFixtureSuite(typeInfo); foreach (var fixture in fixtures) suite.Add(fixture); return suite; }