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); } } }
/// <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); }
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 -----"); }
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 -----"); }
public void BeforeTest(TestDetails testDetails) { if (!IsNet45OrNewer()) { Assert.Ignore("Requires .NET 4.5"); } }
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 -----"); }
/// <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); }
public void BeforeTest(TestDetails testDetails) { if (!IsUnix) { Assert.Ignore("Test is Ignored on Windows"); } }
public void BeforeTest(TestDetails testDetails) { var provider = Properties.Settings.Default.LinearAlgebraProvider.ToLowerInvariant(); if (provider.Contains("mkl")) { Control.LinearAlgebraProvider = new Providers.LinearAlgebra.Mkl.MklLinearAlgebraProvider(); } }
public void BeforeTest(TestDetails test) { _fixture = test.Fixture; _fixtureType = _fixture.GetType(); buildContainer(); injectMembers(); }
/// <summary> /// Initialize keyboard controller /// </summary> public override void BeforeTest(TestDetails testDetails) { if (Keyboard.Controller != null) Keyboard.Controller.Dispose(); KeyboardController.Initialize(); base.BeforeTest(testDetails); }
/// <summary> /// Shutdown keyboard controller /// </summary> public override void AfterTest(TestDetails testDetails) { base.AfterTest(testDetails); KeyboardController.Shutdown(); if (InitDummyAfterTests) Keyboard.Controller = new NoOpKeyboardController(); }
public void AfterTest(TestDetails testDetails) { if (context != null) { context.Dispose(); context = null; } }
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."); } }
/// <summary/> public override void AfterTest(TestDetails testDetails) { #if !__MonoCS__ m_currentActivation.Dispose(); m_activationContext.Dispose(); #endif base.AfterTest(testDetails); }
/// <summary/> public override void BeforeTest(TestDetails testDetails) { base.BeforeTest(testDetails); #if !__MonoCS__ m_activationContext = new ActivationContextHelper("FieldWorks.Tests.manifest"); m_currentActivation = m_activationContext.Activate(); #endif }
private void WriteToConsole(string eventMessage, TestDetails details) { Console.WriteLine("{0} {1}: {2}, from {3}.{4}.", eventMessage, details.IsSuite ? "Suite" : "Case", _Message, details.Fixture != null ? details.Fixture.GetType().Name : "{no fixture}", details.Method != null ? details.Method.Name : "{no method}"); }
public void AfterTest(TestDetails testDetails) { _refCount--; if (_refCount == 0) { _offlineSldr.Dispose(); _offlineSldr = null; } }
public override void BeforeTest(TestDetails details) { if (!details.IsSuite) return; if (Fresh) TeardownExisting(); StartNew(); }
public void AfterTest(TestDetails details) { Console.WriteLine("----- Beginning Duality environment teardown -----"); // Just leave it initialized - speeds up re-running individual tests. //DualityApp.Terminate(); Environment.CurrentDirectory = this.oldEnvDir; Console.WriteLine("----- Duality environment teardown complete -----"); }
/// <summary> /// Create a dummy keyboard controller /// </summary> public override void BeforeTest(TestDetails testDetails) { base.BeforeTest(testDetails); // If we already have a keyboard controller we'd better dispose it or we'll end up with missing dispose calls. if (Keyboard.Controller != null) Keyboard.Controller.Dispose(); Keyboard.Controller = new NoOpKeyboardController(); }
public void BeforeTest(TestDetails testDetails) { if (Type.GetType("Mono.Runtime") != null) { var msg = "Ignored on mono"; if (_ignoreText != null) msg += ": " + _ignoreText; Assert.Ignore(msg); } }
/// <summary> /// Restore previous message box adapter /// </summary> public override void AfterTest(TestDetails testDetails) { base.AfterTest(testDetails); s_CurrentAdapter = m_PreviousAdapter; if (s_CurrentAdapter != null) MessageBoxUtils.Manager.SetMessageBoxAdapter(s_CurrentAdapter); else MessageBoxUtils.Manager.Reset(); }
public override void AfterTest(TestDetails details) { if (!details.IsSuite) return; if (TestActorSystem.Instance == null) return; TestActorSystem.Instance.Dispose(); TestActorSystem.Instance = null; }
public override void BeforeTest(TestDetails testDetails) { var currentVersion = ElasticsearchConfiguration.CurrentVersion; var skip = (_inclusive && _upperBound >= currentVersion && currentVersion >= _lowerBound) || (_upperBound > currentVersion && currentVersion > _lowerBound); if (skip) Assert.Pass(_reason); }
public void BeforeTest(TestDetails testDetails) { var options = new TransactionOptions { IsolationLevel = this.IsolationLevel }; if (TimeOutInSeconds > 0) { options.Timeout = TimeSpan.FromSeconds(this.TimeOutInSeconds); } this._scope = new TransactionScope(this.ScopeOption, options); }
/// <summary> /// Register the COM dlls if they aren't registered yet /// </summary> public void BeforeTest(TestDetails testDetails) { #if !__MonoCS__ // On Linux we use a different (file based) approach for accessing COM objects, // so we don't have to do this. m_lock.EnterWriteLock(); try { var uriBase = new Uri(Assembly.GetExecutingAssembly().CodeBase); string sBaseDir = Path.GetDirectoryName(Uri.UnescapeDataString(uriBase.AbsolutePath)); if (m_pathFwKernel == null) { string sDllFile = Path.Combine(sBaseDir, "FwKernel.dll"); if (File.Exists(sDllFile)) { m_pathFwKernel = sDllFile; Register(m_pathFwKernel); } } if (m_pathLanguage == null) { string sDllFile = Path.Combine(sBaseDir, "Language.dll"); if (File.Exists(sDllFile)) { m_pathLanguage = sDllFile; Register(m_pathLanguage); } } if (m_pathViews == null) { string sDllFile = Path.Combine(sBaseDir, "Views.dll"); if (File.Exists(sDllFile)) { m_pathViews = sDllFile; Register(m_pathViews); } } if (m_pathGraphite == null) { string sDllFile = Path.Combine(sBaseDir, "Graphite.dll"); if (File.Exists(sDllFile)) { m_pathGraphite = sDllFile; Register(m_pathGraphite); } } } finally { m_lock.ExitWriteLock(); } #endif }
public void BeforeTest(TestDetails testDetails) { #if !NET35 && NATIVE #if MKL Control.UseNativeMKL(); #elif CUDA Control.UseNativeCUDA(); #elif OPENBLAS Control.UseNativeOpenBLAS(); #endif #endif }
public void BeforeTest(TestDetails testDetails) { var type = Type.GetType("Mono.Runtime"); if (type != null) { var message = "Test is not valid on Mono."; if (_reason != null) { message += " " + _reason; } Assert.Ignore(message); } }
public void BeforeTest(TestDetails testDetails) { var asTestBase = testDetails.Fixture as TestBase; if (asTestBase == null) throw new Exception("[MinPgsqlVersion] can only be used in fixtures inheriting from TestBase"); if (asTestBase.Conn.PostgreSqlVersion < _minVersion) { var msg = String.Format("Postgresql backend version {0} is less than the required {1}", asTestBase.Conn.PostgreSqlVersion, _minVersion); if (_ignoreText != null) msg += ": " + _ignoreText; Assert.Ignore(msg); } }
public void AfterTest(TestDetails testDetails) { }
public void BeforeTest(TestDetails testDetails) { Assert.Ignore($"{PlatformsAffected} - {Description}: {IssueTracker.GetDescription()}/{IssueNumber}"); }
/// <summary> /// Method called after each test /// </summary> /// <param name="testDetails">Info about the test that was just run</param> public virtual void AfterTest(TestDetails testDetails) { }
/// <summary> /// Method called before each test /// </summary> /// <param name="testDetails">Info about the test to be run</param> public virtual void BeforeTest(TestDetails testDetails) { }