[1146] | 1 | // ****************************************************************
|
---|
| 2 | // Copyright 2007, Charlie Poole
|
---|
| 3 | // This is free software licensed under the NUnit license. You may
|
---|
| 4 | // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
|
---|
| 5 | // ****************************************************************
|
---|
| 6 |
|
---|
| 7 | using System;
|
---|
| 8 | using NUnit.Core.Builders;
|
---|
| 9 | using NUnit.Core.Extensibility;
|
---|
| 10 |
|
---|
| 11 | namespace NUnit.Core.Extensions
|
---|
| 12 | {
|
---|
| 13 | /// <summary>
|
---|
| 14 | /// MockFixtureExtensionBuilder knows how to build
|
---|
| 15 | /// a MockFixtureExtension.
|
---|
| 16 | /// </summary>
|
---|
| 17 | [NUnitAddin(Description="Wraps an NUnitTestFixture with an additional level of SetUp and TearDown")]
|
---|
| 18 | public class SampleFixtureExtensionBuilder : ISuiteBuilder, IAddin
|
---|
| 19 | {
|
---|
| 20 | #region NUnitTestFixtureBuilder Overrides
|
---|
| 21 | /// <summary>
|
---|
| 22 | /// Makes a SampleFixtureExtension instance
|
---|
| 23 | /// </summary>
|
---|
| 24 | /// <param name="type">The type to be used</param>
|
---|
| 25 | /// <returns>A SampleFixtureExtension as a TestSuite</returns>
|
---|
| 26 | // protected override TestSuite MakeSuite(Type type)
|
---|
| 27 | // {
|
---|
| 28 | // return new SampleFixtureExtension( type );
|
---|
| 29 | // }
|
---|
| 30 |
|
---|
| 31 | // The builder recognizes the types that it can use by the presense
|
---|
| 32 | // of SampleFixtureExtensionAttribute. Note that an attribute does not
|
---|
| 33 | // have to be used. You can use any arbitrary set of rules that can be
|
---|
| 34 | // implemented using reflection on the type.
|
---|
| 35 | public bool CanBuildFrom(Type type)
|
---|
| 36 | {
|
---|
| 37 | return Reflect.HasAttribute( type, "NUnit.Core.Extensions.SampleFixtureExtensionAttribute", false );
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | public Test BuildFrom(Type type)
|
---|
| 41 | {
|
---|
| 42 | return null;
|
---|
| 43 | }
|
---|
| 44 | #endregion
|
---|
| 45 |
|
---|
| 46 | #region IAddin Members
|
---|
| 47 | public bool Install(IExtensionHost host)
|
---|
| 48 | {
|
---|
| 49 | IExtensionPoint suiteBuilders = host.GetExtensionPoint( "SuiteBuilders" );
|
---|
| 50 | if ( suiteBuilders == null )
|
---|
| 51 | return false;
|
---|
| 52 |
|
---|
| 53 | suiteBuilders.Install( this );
|
---|
| 54 | return true;
|
---|
| 55 | }
|
---|
| 56 | #endregion
|
---|
| 57 | }
|
---|
| 58 | }
|
---|