1
// *********************************************************************
2
// Copyright 2007, Andreas Schlapsi
3
// This is free software licensed under the MIT license.
4
// *********************************************************************
6
using System.Reflection;
8
using NUnit.Core.Extensibility;
10
namespace NUnitExtension.RowTest.AddIn
12
[NUnitAddin(Name = "Row Test Extension")]
13
public class RowTestAddIn : IAddin, ITestCaseBuilder
15
private RowTestFactory _testFactory;
19
_testFactory = new RowTestFactory();
22
public bool Install(IExtensionHost host)
25
throw new ArgumentNullException("host");
27
IExtensionPoint testCaseBuilders = host.GetExtensionPoint("TestCaseBuilders");
28
if (testCaseBuilders == null)
31
testCaseBuilders.Install(this);
35
public bool CanBuildFrom(MethodInfo method)
37
return CanBuildFrom(method, null);
40
public bool CanBuildFrom(MethodInfo method, Test suite)
42
return RowTestFramework.IsRowTest(method);
45
public Test BuildFrom(MethodInfo method)
47
return BuildFrom(method, null);
50
public Test BuildFrom(MethodInfo method, Test suite)
53
throw new ArgumentNullException("method");
55
RowTestSuite methods = _testFactory.CreateRowTestSuite(method);
56
Attribute[] rows = RowTestFramework.GetRowAttributes(method);
58
foreach (Attribute row in rows)
59
methods.Add(_testFactory.CreateRowTestCase(row, method));