|
MbUnit : AssemblyCleanUpAttributes
This page last changed on Jun 02, 2006 by peli.
MbUnit defines the AssemblyCleanUpAttribute that can be used to define guard methods that will act at the assembly level. Typically, highly time consuming resources can be initialized and cleaned up using those methods. Rationale
ExampleThis example outputs the starting and finishing time of the tests. Unable to find source-code formatter for language: cs. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml // in AssemblyInfo.csĀ [assembly: MbUnit.Framework.AssemblyCleanup(typeof(MbUnit.Demo.AssemblyCleaner))] // in AssemblyCleaner.cs using System; using MbUnit.Framework; namespace MbUnit.Demo { public static class AssemblyCleaner { [SetUp] public static void SetUp() { Console.WriteLine("Setting up {0}", typeof(AssemblyCleaner).Assembly.FullName); Console.WriteLine(DateTime.Now.ToLongTimeString()); } [TearDown] public static void TearDown() { Console.WriteLine("Cleaning up {0}", typeof(AssemblyCleaner).Assembly.FullName); Console.WriteLine(DateTime.Now.ToLongTimeString()); } } } |
| Document generated by Confluence on Jun 11, 2007 11:56 |