本文整理汇总了C#中NUnit.Framework.TestDetails类的典型用法代码示例。如果您正苦于以下问题:C# TestDetails类的具体用法?C# TestDetails怎么用?C# TestDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestDetails类属于NUnit.Framework命名空间,在下文中一共展示了TestDetails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AfterTest
public void AfterTest(TestDetails details)
{
if (_lastAfterTestFullName == details.FullName) return;
_lastAfterTestFullName = details.FullName;
int startTickCount;
if (!_testsProcessed.TryGetValue(details.FullName, out startTickCount))
return;
if (details.IsSuite)
{
int count;
if (details.Fixture != null)
_testsCount.TryGetValue(details.Fixture.GetType().Name, out count);
else count = _totalTestCount;
Console.WriteLine("[==========] {0} test from {1} ({2} ms total)",
count,
details.Fixture != null ? details.Fixture.GetType().Name : details.FullName,
Environment.TickCount - startTickCount);
Console.WriteLine("");
}
else
{
string stateStr;
switch (TestContext.CurrentContext.Result.State)
{
case TestState.Inconclusive:
stateStr = " INCONCL ";
break;
case TestState.NotRunnable:
stateStr = " CANTRUN ";
break;
case TestState.Skipped:
stateStr = " SKIPPED ";
break;
case TestState.Ignored:
stateStr = " IGNORED ";
break;
case TestState.Success:
stateStr = " OK ";
break;
case TestState.Failure:
stateStr = " FAIL ";
break;
case TestState.Error:
stateStr = " ERROR ";
break;
case TestState.Cancelled:
stateStr = " CANCEL ";
break;
default:
throw new ArgumentOutOfRangeException();
}
{
Console.WriteLine("[{0}] {1}.{2} ({3} ms total)",
stateStr,
details.Fixture != null ? details.Fixture.GetType().Name : "<no class>",
details.Method != null ? details.Method.Name : "{no method}",
Environment.TickCount - startTickCount);
}
}
}
开发者ID:Convey-Compliance,项目名称:nunit-gteststyle-console-output,代码行数:60,代码来源:NUnitGStyleConsoleOutput.cs
示例2: BeforeTest
/// <summary>
/// Set the message box adapter
/// </summary>
public override void BeforeTest(TestDetails testDetails)
{
base.BeforeTest(testDetails);
m_PreviousAdapter = s_CurrentAdapter;
s_CurrentAdapter = (IMessageBox)Activator.CreateInstance(m_AdapterType);
MessageBoxUtils.Manager.SetMessageBoxAdapter(s_CurrentAdapter);
}
示例3: BeforeTest
public void BeforeTest(TestDetails details)
{
Console.WriteLine("----- Beginning Duality Editor environment setup -----");
// Set environment directory to Duality binary directory
this.oldEnvDir = Environment.CurrentDirectory;
string codeBaseURI = typeof(DualityEditorApp).Assembly.CodeBase;
string codeBasePath = codeBaseURI.StartsWith("file:") ? codeBaseURI.Remove(0, "file:".Length) : codeBaseURI;
codeBasePath = codeBasePath.TrimStart('/');
Environment.CurrentDirectory = Path.GetDirectoryName(codeBasePath);
// Add some Console logs manually for NUnit
if (!Log.Core.Outputs.OfType<TextWriterLogOutput>().Any(o => o.Target == Console.Out))
{
if (this.consoleLogOutput == null) this.consoleLogOutput = new TextWriterLogOutput(Console.Out);
Log.AddGlobalOutput(this.consoleLogOutput);
}
// Create a dummy window for the editor
if (this.dummyWindow == null)
this.dummyWindow = new MainForm();
// Initialize the Duality Editor
DualityEditorApp.Init(this.dummyWindow, false);
Console.WriteLine("----- Duality Editor environment setup complete -----");
}
示例4: AfterTest
public void AfterTest(TestDetails details)
{
Console.WriteLine("----- Beginning Duality environment teardown -----");
// Remove NUnit Console logs
Log.RemoveGlobalOutput(this.consoleLogOutput);
this.consoleLogOutput = null;
if (this.dummyWindow != null)
{
ContentProvider.ClearContent();
ContentProvider.DisposeDefaultContent();
this.dummyWindow.Dispose();
this.dummyWindow = null;
}
DualityApp.Terminate();
Environment.CurrentDirectory = this.oldEnvDir;
// Save local testing memory
if (TestContext.CurrentContext.Result.Status == TestStatus.Passed && !System.Diagnostics.Debugger.IsAttached)
{
Serializer.WriteObject(TestHelper.LocalTestMemory, TestHelper.LocalTestMemoryFilePath, SerializeMethod.Xml);
}
Console.WriteLine("----- Duality environment teardown complete -----");
}
示例5: BeforeTest
public void BeforeTest(TestDetails testDetails)
{
if (!IsNet45OrNewer())
{
Assert.Ignore("Requires .NET 4.5");
}
}
示例6: BeforeTest
public void BeforeTest(TestDetails details)
{
Console.WriteLine("----- Beginning Duality environment setup -----");
// Set environment directory to Duality binary directory
this.oldEnvDir = Environment.CurrentDirectory;
string codeBaseURI = typeof(DualityApp).Assembly.CodeBase;
string codeBasePath = codeBaseURI.StartsWith("file:") ? codeBaseURI.Remove(0, "file:".Length) : codeBaseURI;
codeBasePath = codeBasePath.TrimStart('/');
Environment.CurrentDirectory = Path.GetDirectoryName(codeBasePath);
// Add some Console logs manually for NUnit
if (!Log.Game.Outputs.OfType<ConsoleLogOutput>().Any())
{
Log.Game.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkGray));
Log.Core.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkBlue));
Log.Editor.AddOutput(new ConsoleLogOutput(ConsoleColor.DarkMagenta));
}
// Initialize Duality
DualityApp.Init(DualityApp.ExecutionEnvironment.Launcher, DualityApp.ExecutionContext.Game);
// Manually register pseudo-plugin for the Unit Testing Assembly
DualityApp.AddPlugin(typeof(DualityTestsPlugin).Assembly, codeBasePath);
Console.WriteLine("----- Duality environment setup complete -----");
}
示例7: AfterTest
/// <summary>
/// Unset keyboard controller
/// </summary>
public override void AfterTest(TestDetails testDetails)
{
// Shut down (and implicitly dispose) the keyboard controller we created.
KeyboardController.Shutdown();
base.AfterTest(testDetails);
}
示例8: BeforeTest
public void BeforeTest(TestDetails testDetails)
{
if (!IsUnix)
{
Assert.Ignore("Test is Ignored on Windows");
}
}
示例9: BeforeTest
public void BeforeTest(TestDetails testDetails)
{
var provider = Properties.Settings.Default.LinearAlgebraProvider.ToLowerInvariant();
if (provider.Contains("mkl"))
{
Control.LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider();
}
}
示例10: BeforeTest
/// <summary>
/// Initialize keyboard controller
/// </summary>
public override void BeforeTest(TestDetails testDetails)
{
if (Keyboard.Controller != null)
Keyboard.Controller.Dispose();
KeyboardController.Initialize();
base.BeforeTest(testDetails);
}
示例11: AfterTest
/// <summary>
/// Shutdown keyboard controller
/// </summary>
public override void AfterTest(TestDetails testDetails)
{
base.AfterTest(testDetails);
KeyboardController.Shutdown();
if (InitDummyAfterTests)
Keyboard.Controller = new NoOpKeyboardController();
}
示例12: BeforeTest
public void BeforeTest(TestDetails test)
{
_fixture = test.Fixture;
_fixtureType = _fixture.GetType();
buildContainer();
injectMembers();
}
示例13: AfterTest
public void AfterTest(TestDetails testDetails)
{
if (context != null)
{
context.Dispose();
context = null;
}
}
示例14: AfterTest
public void AfterTest(TestDetails testDetails)
{
_refCount--;
if (_refCount == 0)
{
_offlineSldr.Dispose();
_offlineSldr = null;
}
}
示例15: BeforeTest
public void BeforeTest(TestDetails testDetails)
{
if (String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(feedUri)) ||
String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(feedUsernameVariable)) ||
String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable(feedPasswordVariable)))
{
Assert.Ignore("The authenticated feed tests were skipped because the " + feedUri + ", " + feedUsernameVariable + " and " +feedPasswordVariable + " environment variables are not set.");
}
}