/// <summary> /// Creates the test class command, which implements <see cref="ITestClassCommand"/>, for a given type. /// </summary> /// <param name="typeInfo">The type under test</param> /// <returns>The test class command, if the class is a test class; null, otherwise</returns> public static ITestClassCommand Make(ITypeInfo typeInfo) { if (!TypeUtility.IsTestClass(typeInfo)) { return(null); } ITestClassCommand command = null; if (TypeUtility.HasRunWith(typeInfo)) { ITypeInfo runWithTypeInfo = TypeUtility.GetRunWith(typeInfo); if (runWithTypeInfo == null) { return(null); } Type runWithCommandType = runWithTypeInfo.Type; if (runWithCommandType != null) { command = (ITestClassCommand)Activator.CreateInstance(runWithCommandType); } } else if (TypeUtility.ContainsTestMethods(typeInfo)) { command = new TestClassCommand(); } if (command != null) { command.TypeUnderTest = typeInfo; } return(command); }
/// <summary> /// Creates the test class command, which implements <see cref="ITestClassCommand"/>, for a given type. /// </summary> /// <param name="typeInfo">The type under test</param> /// <returns>The test class command, if the class is a test class; null, otherwise</returns> public static ITestClassCommand Make(ITypeInfo typeInfo) { if (!TypeUtility.IsTestClass(typeInfo)) return null; ITestClassCommand command = null; if (TypeUtility.HasRunWith(typeInfo)) { ITypeInfo runWithTypeInfo = TypeUtility.GetRunWith(typeInfo); if (runWithTypeInfo == null) return null; Type runWithCommandType = runWithTypeInfo.Type; if (runWithCommandType != null) command = (ITestClassCommand)Activator.CreateInstance(runWithCommandType); } else if (TypeUtility.ContainsTestMethods(typeInfo)) command = new TestClassCommand(); if (command != null) command.TypeUnderTest = typeInfo; return command; }
protected IEnumerable<MethodResult> RunClass(Type typeUnderTest) { var testClassCommand = new TestClassCommand(typeUnderTest); var classResult = TestClassCommandRunner.Execute(testClassCommand, testClassCommand.EnumerateTestMethods().ToList(), null, null); return classResult.Results.OfType<MethodResult>(); }
protected IEnumerable<MethodResult> RunClass(Type typeUnderTest) { ITestClassCommand testClassCommand = new TestClassCommand(typeUnderTest); ClassResult classResult = TestClassCommandRunner.Execute(testClassCommand, testClassCommand.EnumerateTestMethods().ToList(), startCallback: null, resultCallback: null); return classResult.Results.OfType<MethodResult>(); }
public NameBasedTestClassCommand() { command = new Xunit.Sdk.TestClassCommand(); }
public StubTestClassCommand(Type typeUnderTest) { this.typeUnderTest = Reflector.Wrap(typeUnderTest); testClassCommand = new TestClassCommand(typeUnderTest); }
public TestClassCommand() { command = new Xunit.Sdk.TestClassCommand(); }
/// <summary> /// Creates an instace of the <see cref="IocTestClassCommand"/>. /// </summary> public IocTestClassCommand() { _testClassCommand = new TestClassCommand(); }