本文整理汇总了C#中ITestListener类的典型用法代码示例。如果您正苦于以下问题:C# ITestListener类的具体用法?C# ITestListener怎么用?C# ITestListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITestListener类属于命名空间,在下文中一共展示了ITestListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TdNetRunnerHelper
public TdNetRunnerHelper(Assembly assembly, ITestListener testListener)
{
this.testListener = testListener;
xunit = new Xunit2(new NullSourceInformationProvider(), assembly.GetLocalCodeBase());
toDispose.Push(xunit);
}
示例2: TextUI
/// <summary>
/// Initializes a new instance of the <see cref="TextUI"/> class.
/// </summary>
/// <param name="writer">The TextWriter to use.</param>
/// <param name="listener">The Test listener to use.</param>
public TextUI(TextWriter writer, ITestListener listener)
{
// Set the default writer - may be overridden by the args specified
this.writer = writer;
this.runner = new NUnitLiteTestAssemblyRunner(new NUnitLiteTestAssemblyBuilder());
this.listener = listener;
}
示例3: AdapterFacadeTestListener
public AdapterFacadeTestListener(ITestListener testListener)
{
if (testListener == null)
throw new ArgumentNullException("testListener");
this.testListener = testListener;
}
示例4: ValidateParameters
private bool ValidateParameters(ITestListener listener, DataRow dataRow) {
if(_expectedParameterNum == dataRow.Values.Length) {
var parameters = MethodInfo.GetParameters();
var paramValues = new object[parameters.Length];
for(var i = 0; i < parameters.Length; i++) {
try {
paramValues[i] = Convert.ChangeType(dataRow.Values[i], parameters[i].ParameterType);
}
catch(InvalidCastException) {
ReportError(listener, string.Format(
"Parameter types don't match for DataRow({0}).",
dataRow));
return false;
}
catch(FormatException) {
ReportError(listener, string.Format(
"Parameter types don't match for DataRow({0}).",
dataRow));
return false;
}
catch(Exception ex) {
ReportError(listener, "Failed to convert parameter." + ex.Message);
return false;
}
}
dataRow.Values = paramValues;
return true;
}
ReportError(listener, string.Format("Each data row for {0} must have {1} values.",
MethodInfo.Name, _expectedParameterNum));
return false;
}
示例5: AddListener
public void AddListener (ITestListener listener)
{
lock (listeners.SyncRoot)
{
listeners.Add (listener);
}
}
示例6: RunMethod
TestRunState ITdNetTestRunner.RunMember(ITestListener listener, Assembly assembly, MemberInfo member)
{
try
{
using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false))
{
TdNetLogger logger = new TdNetLogger(listener, assembly);
TestRunner runner = new TestRunner(wrapper, logger);
MethodInfo method = member as MethodInfo;
if (method != null)
return RunMethod(runner, method);
Type type = member as Type;
if (type != null)
return RunClassWithInnerTypes(runner, type);
return TestRunState.NoTests;
}
}
catch (ArgumentException)
{
return TestRunState.NoTests;
}
}
示例7: RunMember
public TestRunState RunMember(ITestListener testListener, Assembly assembly, MemberInfo member)
{
var method = member as MethodInfo;
if (method != null)
{
if (method.IsDispose())
{
var listener = new TestDrivenListener(testListener);
listener.CaseSkipped(new SkipResult(new Case(method), "Dispose() is not a test."));
return TestRunState.Success;
}
return Run(testListener, runner => runner.RunMethods(assembly, method));
}
var type = member as Type;
if (type != null)
{
var types = GetTypeAndNestedTypes(type).ToArray();
return Run(testListener, runner => runner.RunTypes(assembly, types));
}
return TestRunState.Error;
}
示例8:
TestRunState ITestRunner.RunNamespace(ITestListener testListener, Assembly assembly, string ns)
{
return TestRunState.NoTests;
//TODO: Fix filter. ns is probably equal to NamespaceFilter in StoryRunnerFilter
//return Run(assembly, null, testListener);
}
示例9: RunMember
public TestRunState RunMember(ITestListener testListener, Assembly assembly, MemberInfo member)
{
var listener = new TDNetRunListener(testListener);
var runner = new AppDomainRunner(listener, RunOptions.Default);
runner.RunMember(assembly, member);
return listener.TestRunState;
}
示例10: RunNamespace
public TestRunState RunNamespace(ITestListener testListener, Assembly assembly, string ns)
{
var listener = new TDNetRunListener(testListener);
var runner = new AppDomainRunner(listener, RunOptions.Default);
runner.RunNamespace(assembly, ns);
return listener.TestRunState;
}
示例11: RunNamespace
public TestRunState RunNamespace(ITestListener testListener, Assembly assembly, string ns)
{
using (var helper = CreateHelper(testListener, assembly))
{
var testCases = helper.Discover().Where(tc => ns == null || tc.GetClass().Namespace == ns);
return helper.Run(testCases);
}
}
示例12: Run
public virtual void Run(ITestListener listener)
{
listener.RunStarted();
ITestExecutor executor = new _ITestExecutor_19(this, listener);
Environments.RunWith(Environments.NewClosedEnvironment(new object[] {executor})
, new _IRunnable_28(this, listener));
listener.RunFinished();
}
示例13: TdNetRunnerHelper
public TdNetRunnerHelper(Assembly assembly, ITestListener testListener)
{
this.testListener = testListener;
var assemblyFileName = assembly.GetLocalCodeBase();
configuration = ConfigReader.Load(assemblyFileName);
var diagnosticMessageSink = new DiagnosticMessageSink(testListener, Path.GetFileNameWithoutExtension(assemblyFileName), configuration.DiagnosticMessagesOrDefault);
xunit = new Xunit2(configuration.AppDomainOrDefault, new NullSourceInformationProvider(), assemblyFileName, shadowCopy: false, diagnosticMessageSink: diagnosticMessageSink);
toDispose.Push(xunit);
}
示例14: TextUI
/// <summary>
/// Initializes a new instance of the <see cref="TextUI"/> class.
/// </summary>
/// <param name="writer">The TextWriter to use.</param>
/// <param name="listener">The Test listener to use.</param>
public TextUI(TextWriter writer, ITestListener listener)
{
// Set the default writer - may be overridden by the args specified
this.writer = writer;
this.finallyDelegate = new FinallyDelegate();
this.runner = new NUnitLiteTestAssemblyRunner(new NUnitLiteTestAssemblyBuilder(), this.finallyDelegate);
this.listener = listener;
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.TopLevelHandler);
}
示例15: Run
public TestRunState Run(ITestListener testListener, string assemblyFile, string cref)
{
if (testListener == null)
throw new ArgumentNullException("testListener");
if (assemblyFile == null)
throw new ArgumentNullException("assemblyFile");
FacadeOptions options = FacadeOptions.ReadFromRegistry();
FacadeTestRunState result = TestRunner.Run(new AdapterFacadeTestListener(testListener), assemblyFile, cref, options);
return FacadeUtils.ToTestRunState(result);
}