source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/lib/NUnit/NUnit-2.5.10.11092/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionBuilder.cs@ 1146

Last change on this file since 1146 was 1146, checked in by Sam Habiel, 13 years ago

Initial Import of BMX4

File size: 1.4 KB
Line 
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
7using System;
8using NUnit.Core.Extensibility;
9
10namespace NUnit.Core.Extensions
11{
12 /// <summary>
13 /// SampleSuiteExtensionBuilder knows how to build a SampleSuiteExtension
14 /// </summary>
15 public class SampleSuiteExtensionBuilder : ISuiteBuilder
16 {
17 #region ISuiteBuilder Members
18
19 // This builder delegates all the work to the constructor of the
20 // extension suite. Many builders will need to do more work,
21 // looking for other attributes, setting properties on the
22 // suite and locating methods for tests, setup and teardown.
23 public Test BuildFrom(Type type)
24 {
25 if ( CanBuildFrom( type ) )
26 return new SampleSuiteExtension( type );
27 return null;
28 }
29
30 // The builder recognizes the types that it can use by the presense
31 // of SampleSuiteExtensionAttribute. Note that an attribute does not
32 // have to be used. You can use any arbitrary set of rules that can be
33 // implemented using reflection on the type.
34 public bool CanBuildFrom(Type type)
35 {
36 return Reflect.HasAttribute( type, "NUnit.Core.Extensions.SampleSuiteExtensionAttribute", false );
37 }
38
39 #endregion
40 }
41}
Note: See TracBrowser for help on using the repository browser.