Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2008-11-26 00:41:19 +0300
committerAtsushi Eno <atsushieno@gmail.com>2008-11-26 00:41:19 +0300
commitbf5668ad1b32edd1a874c2c6ad4982c33664e2ab (patch)
tree6e751c06b4e6da2361274f687bbc6fe16edf0149 /mcs/nunit24
parentaa46835403f6f34dfb458f8c120789baec9d782c (diff)
2005-11-25 Atsushi Enomoto <atsushi@ximian.com>
* import NUnit 2.4.8 to replace with fresh version. svn path=/trunk/mcs/; revision=120009
Diffstat (limited to 'mcs/nunit24')
-rw-r--r--mcs/nunit24/ClientUtilities/util/AggregatingTestRunner.cs293
-rw-r--r--mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs11
-rw-r--r--mcs/nunit24/ClientUtilities/util/AssemblyItem.cs36
-rw-r--r--mcs/nunit24/ClientUtilities/util/AssemblyList.cs79
-rw-r--r--mcs/nunit24/ClientUtilities/util/AssemblyWatcher.cs114
-rw-r--r--mcs/nunit24/ClientUtilities/util/CategoryExpression.cs152
-rw-r--r--mcs/nunit24/ClientUtilities/util/CategoryManager.cs54
-rw-r--r--mcs/nunit24/ClientUtilities/util/CommandLineOptions.cs316
-rw-r--r--mcs/nunit24/ClientUtilities/util/ConsoleWriter.cs73
-rw-r--r--mcs/nunit24/ClientUtilities/util/ISettings.cs102
-rw-r--r--mcs/nunit24/ClientUtilities/util/ITestEvents.cs67
-rw-r--r--mcs/nunit24/ClientUtilities/util/ITestLoader.cs83
-rw-r--r--mcs/nunit24/ClientUtilities/util/Makefile43
-rw-r--r--mcs/nunit24/ClientUtilities/util/MemorySettingsStorage.cs79
-rw-r--r--mcs/nunit24/ClientUtilities/util/MultipleTestDomainRunner.cs87
-rw-r--r--mcs/nunit24/ClientUtilities/util/NUnitProject.cs656
-rw-r--r--mcs/nunit24/ClientUtilities/util/NUnitRegistry.cs141
-rw-r--r--mcs/nunit24/ClientUtilities/util/PathUtils.cs209
-rw-r--r--mcs/nunit24/ClientUtilities/util/ProcessRunner.cs58
-rw-r--r--mcs/nunit24/ClientUtilities/util/ProjectConfig.cs255
-rw-r--r--mcs/nunit24/ClientUtilities/util/ProjectConfigCollection.cs103
-rw-r--r--mcs/nunit24/ClientUtilities/util/ProjectFormatException.cs58
-rw-r--r--mcs/nunit24/ClientUtilities/util/ProxyTestRunner.cs179
-rw-r--r--mcs/nunit24/ClientUtilities/util/RecentFileEntry.cs74
-rw-r--r--mcs/nunit24/ClientUtilities/util/RecentFiles.cs55
-rw-r--r--mcs/nunit24/ClientUtilities/util/RecentFilesCollection.cs57
-rw-r--r--mcs/nunit24/ClientUtilities/util/RegistrySettingsStorage.cs167
-rw-r--r--mcs/nunit24/ClientUtilities/util/RemoteTestAgent.cs133
-rw-r--r--mcs/nunit24/ClientUtilities/util/ResultSummarizer.cs80
-rw-r--r--mcs/nunit24/ClientUtilities/util/ServerBase.cs89
-rw-r--r--mcs/nunit24/ClientUtilities/util/ServerUtilities.cs128
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services.cs130
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/AddinManager.cs93
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/AddinRegistry.cs60
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/DomainManager.cs261
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/RecentFilesService.cs169
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/ServiceManager.cs82
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/SettingsService.cs140
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/TestAgency.cs353
-rw-r--r--mcs/nunit24/ClientUtilities/util/Services/TestAgentManager.cs45
-rw-r--r--mcs/nunit24/ClientUtilities/util/SettingsGroup.cs256
-rw-r--r--mcs/nunit24/ClientUtilities/util/SettingsStorage.cs62
-rw-r--r--mcs/nunit24/ClientUtilities/util/StackTraceFilter.cs62
-rw-r--r--mcs/nunit24/ClientUtilities/util/SummaryVisitor.cs133
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestAgent.cs58
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestDomain.cs93
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestEventArgs.cs234
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestEventDispatcher.cs234
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestExceptionHandler.cs46
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestLoader.cs786
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestObserver.cs20
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestResultItem.cs76
-rw-r--r--mcs/nunit24/ClientUtilities/util/TestServer.cs28
-rw-r--r--mcs/nunit24/ClientUtilities/util/Transform.resx151
-rw-r--r--mcs/nunit24/ClientUtilities/util/VSProject.cs328
-rw-r--r--mcs/nunit24/ClientUtilities/util/VSProjectConfig.cs39
-rw-r--r--mcs/nunit24/ClientUtilities/util/VSProjectConfigCollection.cs48
-rw-r--r--mcs/nunit24/ClientUtilities/util/XmlResultTransform.cs65
-rw-r--r--mcs/nunit24/ClientUtilities/util/XmlResultVisitor.cs277
-rw-r--r--mcs/nunit24/ClientUtilities/util/XmlSettingsStorage.cs91
-rw-r--r--mcs/nunit24/ClientUtilities/util/nunit.util.build88
-rw-r--r--mcs/nunit24/ClientUtilities/util/nunit.util.dll.csproj395
-rw-r--r--mcs/nunit24/ClientUtilities/util/nunit.util.dll.sources59
-rw-r--r--mcs/nunit24/ClientUtilities/util/nunit.util.dll_VS2005.csproj208
-rw-r--r--mcs/nunit24/CommonAssemblyInfo.cs34
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/App.config117
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/App.icobin0 -> 1078 bytes
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/Class1.cs25
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile13
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/assemblyinfo.cs11
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.build49
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config117
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config.net_2_0109
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.csproj124
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.sources3
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe_VS2005.csproj79
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/App.icobin0 -> 1078 bytes
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs11
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/ConsoleOptions.cs127
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/ConsoleUi.cs275
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/EventCollector.cs209
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/Makefile30
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/Runner.cs117
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/nunit-console-runner.dll.sources6
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.build33
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.csproj140
-rw-r--r--mcs/nunit24/ConsoleRunner/nunit-console/nunit-console_VS2005.csproj94
-rw-r--r--mcs/nunit24/Makefile14
-rw-r--r--mcs/nunit24/NUnitCore/core/AbstractTestCaseDecoration.cs41
-rw-r--r--mcs/nunit24/NUnitCore/core/AssemblyInfo.cs13
-rw-r--r--mcs/nunit24/NUnitCore/core/AssemblyReader.cs168
-rw-r--r--mcs/nunit24/NUnitCore/core/AssemblyResolver.cs122
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/AbstractFixtureBuilder.cs201
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/AbstractTestCaseBuilder.cs105
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/LegacySuiteBuilder.cs26
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/MultiCultureDecorator.cs19
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/NUnitTestCaseBuilder.cs76
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/NUnitTestFixtureBuilder.cs129
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/SetUpFixtureBuilder.cs35
-rw-r--r--mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs213
-rw-r--r--mcs/nunit24/NUnitCore/core/CoreExtensions.cs215
-rw-r--r--mcs/nunit24/NUnitCore/core/CoreExtensions.save.cs215
-rw-r--r--mcs/nunit24/NUnitCore/core/CultureDetector.cs127
-rw-r--r--mcs/nunit24/NUnitCore/core/DelegatingTestRunner.cs174
-rw-r--r--mcs/nunit24/NUnitCore/core/DirectorySwapper.cs44
-rw-r--r--mcs/nunit24/NUnitCore/core/EventListenerTextWriter.cs114
-rw-r--r--mcs/nunit24/NUnitCore/core/EventPump.cs169
-rw-r--r--mcs/nunit24/NUnitCore/core/EventQueue.cs195
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/AddinRegistry.cs66
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/EventListenerCollection.cs86
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/FrameworkRegistry.cs60
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/SuiteBuilderCollection.cs68
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/TestCaseBuilderCollection.cs67
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.cs43
-rw-r--r--mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.save.cs84
-rw-r--r--mcs/nunit24/NUnitCore/core/ExtensionHost.cs57
-rw-r--r--mcs/nunit24/NUnitCore/core/ExtensionPoint.cs74
-rw-r--r--mcs/nunit24/NUnitCore/core/IgnoreDecorator.cs49
-rw-r--r--mcs/nunit24/NUnitCore/core/InvalidSuiteException.cs44
-rw-r--r--mcs/nunit24/NUnitCore/core/InvalidTestFixtureException.cs34
-rw-r--r--mcs/nunit24/NUnitCore/core/LegacySuite.cs85
-rw-r--r--mcs/nunit24/NUnitCore/core/Log4NetCapture.cs180
-rw-r--r--mcs/nunit24/NUnitCore/core/LogCapture.cs44
-rw-r--r--mcs/nunit24/NUnitCore/core/Makefile27
-rw-r--r--mcs/nunit24/NUnitCore/core/NTrace.cs123
-rw-r--r--mcs/nunit24/NUnitCore/core/NUnitException.cs50
-rw-r--r--mcs/nunit24/NUnitCore/core/NUnitFramework.cs448
-rw-r--r--mcs/nunit24/NUnitCore/core/NUnitTestFixture.cs37
-rw-r--r--mcs/nunit24/NUnitCore/core/NUnitTestMethod.cs58
-rw-r--r--mcs/nunit24/NUnitCore/core/NamespaceTreeBuilder.cs165
-rw-r--r--mcs/nunit24/NUnitCore/core/NoTestFixturesException.cs28
-rw-r--r--mcs/nunit24/NUnitCore/core/NotRunnableTestCase.cs50
-rw-r--r--mcs/nunit24/NUnitCore/core/NullListener.cs41
-rw-r--r--mcs/nunit24/NUnitCore/core/PlatformHelper.cs244
-rw-r--r--mcs/nunit24/NUnitCore/core/ProxyTestRunner.cs174
-rw-r--r--mcs/nunit24/NUnitCore/core/QueuingEventListener.cs110
-rw-r--r--mcs/nunit24/NUnitCore/core/Reflect.cs430
-rw-r--r--mcs/nunit24/NUnitCore/core/RemoteTestRunner.cs97
-rw-r--r--mcs/nunit24/NUnitCore/core/Results.xsd99
-rw-r--r--mcs/nunit24/NUnitCore/core/SetUpFixture.cs44
-rw-r--r--mcs/nunit24/NUnitCore/core/SimpleTestRunner.cs218
-rw-r--r--mcs/nunit24/NUnitCore/core/StringTextWriter.cs128
-rw-r--r--mcs/nunit24/NUnitCore/core/SuiteBuilderAttribute.cs18
-rw-r--r--mcs/nunit24/NUnitCore/core/Summary.xslt50
-rw-r--r--mcs/nunit24/NUnitCore/core/TestBuilderAttribute.cs26
-rw-r--r--mcs/nunit24/NUnitCore/core/TestCase.cs96
-rw-r--r--mcs/nunit24/NUnitCore/core/TestCaseBuilder.cs45
-rw-r--r--mcs/nunit24/NUnitCore/core/TestCaseBuilderAttribute.cs18
-rw-r--r--mcs/nunit24/NUnitCore/core/TestContext.cs362
-rw-r--r--mcs/nunit24/NUnitCore/core/TestDecoratorAttribute.cs17
-rw-r--r--mcs/nunit24/NUnitCore/core/TestFixture.cs40
-rw-r--r--mcs/nunit24/NUnitCore/core/TestFixtureBuilder.cs84
-rw-r--r--mcs/nunit24/NUnitCore/core/TestMethod.cs401
-rw-r--r--mcs/nunit24/NUnitCore/core/TestRunnerThread.cs162
-rw-r--r--mcs/nunit24/NUnitCore/core/TestSuite.cs376
-rw-r--r--mcs/nunit24/NUnitCore/core/TestSuiteBuilder.cs125
-rw-r--r--mcs/nunit24/NUnitCore/core/TextCapture.cs95
-rw-r--r--mcs/nunit24/NUnitCore/core/ThreadedTestRunner.cs74
-rw-r--r--mcs/nunit24/NUnitCore/core/nunit.core.build89
-rw-r--r--mcs/nunit24/NUnitCore/core/nunit.core.dll.csproj419
-rw-r--r--mcs/nunit24/NUnitCore/core/nunit.core.dll.sources64
-rw-r--r--mcs/nunit24/NUnitCore/core/nunit.core.dll_VS2005.csproj221
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs14
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/EventListener.cs75
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/Addin.cs110
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/AddinStatus.cs36
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/ExtensionType.cs35
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddin.cs29
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinManager.cs12
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinRegistry.cs36
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionHost.cs46
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionPoint.cs42
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/IFrameworkRegistry.cs23
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/ISuiteBuilder.cs37
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestCaseBuilder.cs39
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestDecorator.cs26
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/NUnitAddinAttribute.cs40
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Extensibility/TestFramework.cs42
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Filters/AndFilter.cs82
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Filters/CategoryFilter.cs102
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Filters/NameFilter.cs58
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Filters/NotFilter.cs64
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Filters/OrFilter.cs82
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Filters/SimpleNameFilter.cs57
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/IService.cs25
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/ITest.cs91
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/ITestFilter.cs39
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Makefile27
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/ResultState.cs68
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/ResultVisitor.cs27
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/RunState.cs46
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/RuntimeFramework.cs97
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/Test.cs330
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestAssemblyInfo.cs61
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestCaseResult.cs41
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestFilter.cs102
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestID.cs144
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestInfo.cs249
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestName.cs204
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestNode.cs88
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestOutput.cs92
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestPackage.cs178
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestResult.cs428
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestRunner.cs165
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/TestSuiteResult.cs72
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.build65
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.csproj301
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.sources43
-rw-r--r--mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll_VS2005.csproj120
-rw-r--r--mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs14
-rw-r--r--mcs/nunit24/NUnitExtensions/core/Makefile32
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RepeatedTestCase.cs39
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RepeatedTestDecorator.cs63
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RowTest/RowTestAddIn.cs54
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RowTest/RowTestCase.cs37
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFactory.cs79
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFramework.cs65
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RowTest/RowTestNameBuilder.cs92
-rw-r--r--mcs/nunit24/NUnitExtensions/core/RowTest/RowTestSuite.cs50
-rw-r--r--mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.build31
-rw-r--r--mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.csproj151
-rw-r--r--mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.sources10
-rw-r--r--mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll_VS2005.csproj85
-rw-r--r--mcs/nunit24/NUnitExtensions/docs/RowTest/License.txt22
-rw-r--r--mcs/nunit24/NUnitExtensions/docs/RowTest/Release Notes.txt48
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs14
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/Makefile29
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/RepeatAttribute.cs37
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/RowAttribute.cs67
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/RowTest/RowAttribute.cs67
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/RowTest/RowTestAttribute.cs13
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/RowTest/SpecialValue.cs13
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/RowTestAttribute.cs13
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/SpecialValue.cs13
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.build31
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.csproj126
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.sources9
-rw-r--r--mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll_VS2005.csproj105
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/AssemblyRunner.cs30
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/PlatformInfo.cs36
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/SnippetRunner.cs87
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/TestCompiler.cs50
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/TestLoadFixture.cs76
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/TestTree.cs52
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.build43
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.csproj146
-rw-r--r--mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures_VS2005.csproj144
-rw-r--r--mcs/nunit24/NUnitFixtures/tests/AssemblyInfo.cs58
-rw-r--r--mcs/nunit24/NUnitFixtures/tests/CompilationTests.cs97
-rw-r--r--mcs/nunit24/NUnitFixtures/tests/TestTreeTests.cs53
-rw-r--r--mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.build29
-rw-r--r--mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.csproj136
-rw-r--r--mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests_VS2005.csproj147
-rw-r--r--mcs/nunit24/NUnitFramework/framework/AbstractAsserter.cs88
-rw-r--r--mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs14
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Assert.cs2960
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Assertion.cs169
-rw-r--r--mcs/nunit24/NUnitFramework/framework/AssertionException.cs40
-rw-r--r--mcs/nunit24/NUnitFramework/framework/AssertionFailureMessage.cs533
-rw-r--r--mcs/nunit24/NUnitFramework/framework/AssertionHelper.cs111
-rw-r--r--mcs/nunit24/NUnitFramework/framework/CategoryAttribute.cs50
-rw-r--r--mcs/nunit24/NUnitFramework/framework/CollectionAssert.cs595
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/BinaryOperations.cs109
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/CollectionConstraints.cs318
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/ComparisonConstraints.cs127
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/Constraint.cs209
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/ConstraintBuilder.cs436
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/ContainsConstraint.cs77
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/EmptyConstraint.cs51
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/EqualConstraint.cs393
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/Numerics.cs216
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/PrefixConstraints.cs241
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/PropertyConstraint.cs83
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/SameAsConstraint.cs50
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/StringConstraints.cs234
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Constraints/TypeConstraints.cs143
-rw-r--r--mcs/nunit24/NUnitFramework/framework/DescriptionAttribute.cs31
-rw-r--r--mcs/nunit24/NUnitFramework/framework/ExpectedExceptionAttribute.cs144
-rw-r--r--mcs/nunit24/NUnitFramework/framework/ExplicitAttribute.cs47
-rw-r--r--mcs/nunit24/NUnitFramework/framework/FileAssert.cs333
-rw-r--r--mcs/nunit24/NUnitFramework/framework/GlobalSettings.cs16
-rw-r--r--mcs/nunit24/NUnitFramework/framework/IAsserter.cs41
-rw-r--r--mcs/nunit24/NUnitFramework/framework/IExpectException.cs25
-rw-r--r--mcs/nunit24/NUnitFramework/framework/IgnoreAttribute.cs47
-rw-r--r--mcs/nunit24/NUnitFramework/framework/IgnoreException.cs38
-rw-r--r--mcs/nunit24/NUnitFramework/framework/IncludeExcludeAttributes.cs106
-rw-r--r--mcs/nunit24/NUnitFramework/framework/Makefile30
-rw-r--r--mcs/nunit24/NUnitFramework/framework/MessageWriter.cs139
-rw-r--r--mcs/nunit24/NUnitFramework/framework/MsgUtils.cs217
-rw-r--r--mcs/nunit24/NUnitFramework/framework/NUnit.Framework.dll.sources54
-rw-r--r--mcs/nunit24/NUnitFramework/framework/OldTestCase.cs36
-rw-r--r--mcs/nunit24/NUnitFramework/framework/PropertyAttribute.cs66
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SetCultureAttribute.cs17
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SetUpAttribute.cs19
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SetUpFixtureAttribute.cs18
-rw-r--r--mcs/nunit24/NUnitFramework/framework/StringAssert.cs227
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SuiteAttribute.cs18
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Has.cs144
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Is.cs212
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/List.cs30
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/ListMapper.cs46
-rw-r--r--mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Text.cs104
-rw-r--r--mcs/nunit24/NUnitFramework/framework/TearDownAttribute.cs19
-rw-r--r--mcs/nunit24/NUnitFramework/framework/TestAttribute.cs46
-rw-r--r--mcs/nunit24/NUnitFramework/framework/TestFixtureAttribute.cs30
-rw-r--r--mcs/nunit24/NUnitFramework/framework/TestFixtureSetUpAttribute.cs19
-rw-r--r--mcs/nunit24/NUnitFramework/framework/TestFixtureTearDownAttribute.cs21
-rw-r--r--mcs/nunit24/NUnitFramework/framework/TextMessageWriter.cs474
-rw-r--r--mcs/nunit24/NUnitFramework/framework/nunit.framework.build79
-rw-r--r--mcs/nunit24/NUnitFramework/framework/nunit.framework.dll.csproj361
-rw-r--r--mcs/nunit24/NUnitFramework/framework/nunit.framework.dll_VS2005.csproj165
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs12
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/DynamicMock.cs47
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/ICall.cs24
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/ICallHandler.cs25
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/IMethod.cs28
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/IMock.cs66
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/IVerify.cs18
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/Makefile29
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/MethodSignature.cs56
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/Mock.cs155
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/MockCall.cs54
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/MockInterfaceHandler.cs72
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/MockMethod.cs119
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/nunit.mocks.build38
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj161
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/nunit.mocks.dll.sources13
-rw-r--r--mcs/nunit24/NUnitMocks/mocks/nunit.mocks_VS2005.csproj107
-rw-r--r--mcs/nunit24/license.rtf41
-rw-r--r--mcs/nunit24/nunit.sln258
-rw-r--r--mcs/nunit24/nunit.snkbin0 -> 490 bytes
-rw-r--r--mcs/nunit24/nunit20under21.config27
-rw-r--r--mcs/nunit24/nunit20under22.config27
-rw-r--r--mcs/nunit24/nunit21under22.config27
-rw-r--r--mcs/nunit24/nunit_VS2005.sln217
335 files changed, 38803 insertions, 0 deletions
diff --git a/mcs/nunit24/ClientUtilities/util/AggregatingTestRunner.cs b/mcs/nunit24/ClientUtilities/util/AggregatingTestRunner.cs
new file mode 100644
index 00000000000..9c31805a2fc
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/AggregatingTestRunner.cs
@@ -0,0 +1,293 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+//#define RUN_IN_PARALLEL
+
+namespace NUnit.Util
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+ using NUnit.Core;
+
+ /// <summary>
+ /// AggregatingTestRunner allows running multiple TestRunners
+ /// and combining the results.
+ /// </summary>
+ public abstract class AggregatingTestRunner : MarshalByRefObject, TestRunner, EventListener
+ {
+ static int AggregateTestID = 1000;
+
+ #region Instance Variables
+
+ /// <summary>
+ /// Our runner ID
+ /// </summary>
+ protected int runnerID;
+
+ /// <summary>
+ /// The downstream TestRunners
+ /// </summary>
+ protected ArrayList runners;
+
+ /// <summary>
+ /// The loaded test suite
+ /// </summary>
+ protected TestNode aggregateTest;
+
+ /// <summary>
+ /// The result of the last run
+ /// </summary>
+ private TestResult testResult;
+
+ /// <summary>
+ /// The event listener for the currently running test
+ /// </summary>
+ protected EventListener listener;
+
+ protected string projectName;
+
+ protected TestName testName;
+
+ #endregion
+
+ #region Constructors
+ public AggregatingTestRunner() : this( 0 ) { }
+ public AggregatingTestRunner( int runnerID )
+ {
+ this.runnerID = runnerID;
+ this.testName = new TestName();
+ testName.TestID = new TestID( AggregateTestID );
+ testName.RunnerID = this.runnerID;
+ testName.FullName = testName.Name = "Not Loaded";
+ }
+ #endregion
+
+ #region Properties
+
+ public virtual int ID
+ {
+ get { return runnerID; }
+ }
+
+ public virtual bool Running
+ {
+ get
+ {
+ foreach( TestRunner runner in runners )
+ if ( runner.Running )
+ return true;
+
+ return false;
+ }
+ }
+
+ public virtual IList AssemblyInfo
+ {
+ get
+ {
+ ArrayList info = new ArrayList();
+ foreach( TestRunner runner in runners )
+ info.AddRange( runner.AssemblyInfo );
+ return info;
+ }
+ }
+
+ public virtual ITest Test
+ {
+ get
+ {
+ if ( aggregateTest == null && runners != null )
+ {
+ // Count non-null tests, in case we specified a fixture
+ int count = 0;
+ foreach( TestRunner runner in runners )
+ if ( runner.Test != null )
+ ++count;
+
+ // Copy non-null tests to an array
+ int index = 0;
+ ITest[] tests = new ITest[count];
+ foreach( TestRunner runner in runners )
+ if ( runner.Test != null )
+ tests[index++] = runner.Test;
+
+ // Return master node containing all the tests
+ aggregateTest = new TestNode( testName, tests );
+ }
+
+ return aggregateTest;
+ }
+ }
+
+ public virtual TestResult TestResult
+ {
+ get { return testResult; }
+ }
+ #endregion
+
+ #region Load and Unload Methods
+ public abstract bool Load(TestPackage package);
+
+ public virtual void Unload()
+ {
+ foreach( TestRunner runner in runners )
+ runner.Unload();
+ aggregateTest = null;
+ }
+ #endregion
+
+ #region CountTestCases
+ public virtual int CountTestCases( ITestFilter filter )
+ {
+ int count = 0;
+ foreach( TestRunner runner in runners )
+ count += runner.CountTestCases( filter );
+ return count;
+ }
+ #endregion
+
+ #region Methods for Running Tests
+ public virtual TestResult Run( EventListener listener )
+ {
+ return Run( listener, TestFilter.Empty );
+ }
+
+ public virtual TestResult Run(EventListener listener, ITestFilter filter )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+
+ ITest[] tests = new ITest[runners.Count];
+ for( int index = 0; index < runners.Count; index++ )
+ tests[index] = ((TestRunner)runners[index]).Test;
+
+ this.listener.RunStarted( this.Test.TestName.Name, this.CountTestCases( filter ) );
+
+ this.listener.SuiteStarted( this.Test.TestName );
+ long startTime = DateTime.Now.Ticks;
+
+ TestSuiteResult result = new TestSuiteResult( new TestInfo( testName, tests ), projectName );
+ result.RunState = RunState.Executed;
+ foreach( TestRunner runner in runners )
+ if ( filter.Pass( runner.Test ) )
+ result.AddResult( runner.Run( this, filter ) );
+
+ long stopTime = DateTime.Now.Ticks;
+ double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
+ result.Time = time;
+
+ this.listener.SuiteFinished( result );
+
+ this.listener.RunFinished( result );
+
+ this.testResult = result;
+
+ return result;
+ }
+
+ public virtual void BeginRun( EventListener listener )
+ {
+ BeginRun( listener, TestFilter.Empty );
+ }
+
+ public virtual void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+
+#if RUN_IN_PARALLEL
+ this.listener.RunStarted( this.Test.Name, this.CountTestCases( filter ) );
+
+ foreach( TestRunner runner in runners )
+ if ( runner.Test != null )
+ runner.BeginRun( this, filter );
+
+ //this.listener.RunFinished( this.Results );
+#else
+ ThreadedTestRunner threadedRunner = new ThreadedTestRunner( this );
+ threadedRunner.BeginRun( listener, filter );
+#endif
+ }
+
+ public virtual TestResult EndRun()
+ {
+ TestSuiteResult suiteResult = new TestSuiteResult( aggregateTest, Test.TestName.FullName );
+ foreach( TestRunner runner in runners )
+ suiteResult.Results.Add( runner.EndRun() );
+
+ return suiteResult;
+ }
+
+ public virtual void CancelRun()
+ {
+ foreach( TestRunner runner in runners )
+ runner.CancelRun();
+ }
+
+ public virtual void Wait()
+ {
+ foreach( TestRunner runner in runners )
+ runner.Wait();
+ }
+ #endregion
+
+ #region EventListener Members
+ public void TestStarted(TestName testName)
+ {
+ this.listener.TestStarted( testName );
+ }
+
+ public void RunStarted(string name, int testCount)
+ {
+ // TODO: We may want to count how many runs are started
+ // Ignore - we provide our own
+ }
+
+ public void RunFinished(Exception exception)
+ {
+ // Ignore - we provide our own
+ }
+
+ void NUnit.Core.EventListener.RunFinished(TestResult result)
+ {
+ // TODO: Issue combined RunFinished when all runs are done
+ }
+
+ public void SuiteFinished(TestSuiteResult result)
+ {
+ this.listener.SuiteFinished( result );
+ }
+
+ public void TestFinished(TestCaseResult result)
+ {
+ this.listener.TestFinished( result );
+ }
+
+ public void UnhandledException(Exception exception)
+ {
+ this.listener.UnhandledException( exception );
+ }
+
+ public void TestOutput(TestOutput testOutput)
+ {
+ this.listener.TestOutput( testOutput );
+ }
+
+ public void SuiteStarted(TestName suiteName)
+ {
+ this.listener.SuiteStarted( suiteName );
+ }
+ #endregion
+
+ #region InitializeLifetimeService Override
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs b/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs
new file mode 100644
index 00000000000..919ca07ace3
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/AssemblyInfo.cs
@@ -0,0 +1,11 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Reflection;
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/ClientUtilities/util/AssemblyItem.cs b/mcs/nunit24/ClientUtilities/util/AssemblyItem.cs
new file mode 100644
index 00000000000..55d97f19db1
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/AssemblyItem.cs
@@ -0,0 +1,36 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Threading;
+using System.Xml.Serialization;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Holds an assembly path and other information needed to
+ /// load an assembly. Currently there is no other info.
+ /// Used in serialization of NUnit projects.
+ /// </summary>
+ [Serializable]
+ public struct AssemblyItem
+ {
+ [XmlAttribute]
+ public string path;
+
+ public ApartmentState apartment;
+
+ public AssemblyItem( string path ) : this( path, ApartmentState.Unknown ) { }
+
+ public AssemblyItem( string path, ApartmentState apartment )
+ {
+ if ( !System.IO.Path.IsPathRooted( path ) )
+ throw new ArgumentException( "Assembly path must be absolute", "path" );
+ this.path = path;
+ this.apartment = apartment;
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/AssemblyList.cs b/mcs/nunit24/ClientUtilities/util/AssemblyList.cs
new file mode 100644
index 00000000000..9ee5c46ceed
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/AssemblyList.cs
@@ -0,0 +1,79 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Represents a list of assemblies. It stores paths
+ /// that are added and fires an event whenevever it
+ /// changes. All paths must be added as absolute paths.
+ /// </summary>
+ public class AssemblyList : CollectionBase
+ {
+ #region Properties and Events
+ public string this[int index]
+ {
+ get { return (string)List[index]; }
+ set
+ {
+ if ( !Path.IsPathRooted( value ) )
+ throw new ArgumentException( "Assembly path must be absolute" );
+ List[index] = value;
+ }
+ }
+
+ public event EventHandler Changed;
+ #endregion
+
+ #region Methods
+ public string[] ToArray()
+ {
+ return (string[])InnerList.ToArray( typeof( string ) );
+ }
+
+ public void Add( string assemblyPath )
+ {
+ if ( !Path.IsPathRooted( assemblyPath ) )
+ throw new ArgumentException( "Assembly path must be absolute" );
+ List.Add( assemblyPath );
+ }
+
+ public void Remove( string assemblyPath )
+ {
+ for( int index = 0; index < this.Count; index++ )
+ {
+ if ( this[index] == assemblyPath )
+ RemoveAt( index );
+ }
+ }
+
+ protected override void OnRemoveComplete(int index, object value)
+ {
+ FireChangedEvent();
+ }
+
+ protected override void OnInsertComplete(int index, object value)
+ {
+ FireChangedEvent();
+ }
+
+ protected override void OnSetComplete(int index, object oldValue, object newValue)
+ {
+ FireChangedEvent();
+ }
+
+ private void FireChangedEvent()
+ {
+ if ( Changed != null )
+ Changed( this, EventArgs.Empty );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/AssemblyWatcher.cs b/mcs/nunit24/ClientUtilities/util/AssemblyWatcher.cs
new file mode 100644
index 00000000000..557c7b11144
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/AssemblyWatcher.cs
@@ -0,0 +1,114 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Text;
+using System.Timers;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// AssemblyWatcher keeps track of one or more assemblies to
+ /// see if they have changed. It incorporates a delayed notification
+ /// and uses a standard event to notify any interested parties
+ /// about the change. The path to the assembly is provided as
+ /// an argument to the event handler so that one routine can
+ /// be used to handle events from multiple watchers.
+ /// </summary>
+ public class AssemblyWatcher
+ {
+ FileSystemWatcher[] fileWatcher;
+ FileInfo[] fileInfo;
+
+ protected System.Timers.Timer timer;
+ protected string changedAssemblyPath;
+
+ public delegate void AssemblyChangedHandler(String fullPath);
+ public event AssemblyChangedHandler AssemblyChangedEvent;
+
+ public AssemblyWatcher( int delay, string assemblyFileName )
+ : this( delay, new string[]{ assemblyFileName } ) { }
+
+ public AssemblyWatcher( int delay, IList assemblies )
+ {
+ fileInfo = new FileInfo[assemblies.Count];
+ fileWatcher = new FileSystemWatcher[assemblies.Count];
+
+ for( int i = 0; i < assemblies.Count; i++ )
+ {
+ fileInfo[i] = new FileInfo( (string)assemblies[i] );
+
+ fileWatcher[i] = new FileSystemWatcher();
+ fileWatcher[i].Path = fileInfo[i].DirectoryName;
+ fileWatcher[i].Filter = fileInfo[i].Name;
+ fileWatcher[i].NotifyFilter = NotifyFilters.Size | NotifyFilters.LastWrite;
+ fileWatcher[i].Changed+=new FileSystemEventHandler(OnChanged);
+ fileWatcher[i].EnableRaisingEvents = false;
+ }
+
+ timer = new System.Timers.Timer( delay );
+ timer.AutoReset=false;
+ timer.Enabled=false;
+ timer.Elapsed+=new ElapsedEventHandler(OnTimer);
+ }
+
+ public FileInfo GetFileInfo( int index )
+ {
+ return fileInfo[index];
+ }
+
+ public void Start()
+ {
+ EnableWatchers( true );
+ }
+
+ public void Stop()
+ {
+ EnableWatchers( false );
+ }
+
+ private void EnableWatchers( bool enable )
+ {
+ foreach( FileSystemWatcher watcher in fileWatcher )
+ watcher.EnableRaisingEvents = enable;
+ }
+
+ protected void OnTimer(Object source, ElapsedEventArgs e)
+ {
+ lock(this)
+ {
+ PublishEvent();
+ timer.Enabled=false;
+ }
+ }
+
+ protected void OnChanged(object source, FileSystemEventArgs e)
+ {
+ changedAssemblyPath = e.FullPath;
+ if ( timer != null )
+ {
+ lock(this)
+ {
+ if(!timer.Enabled)
+ timer.Enabled=true;
+ timer.Start();
+ }
+ }
+ else
+ {
+ PublishEvent();
+ }
+ }
+
+ protected void PublishEvent()
+ {
+ if ( AssemblyChangedEvent != null )
+ AssemblyChangedEvent( changedAssemblyPath );
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit24/ClientUtilities/util/CategoryExpression.cs b/mcs/nunit24/ClientUtilities/util/CategoryExpression.cs
new file mode 100644
index 00000000000..b35512a790f
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/CategoryExpression.cs
@@ -0,0 +1,152 @@
+using System;
+using System.Collections;
+using NUnit.Core;
+using NUnit.Core.Filters;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// CategoryExpression parses strings representing boolean
+ /// combinations of categories according to the following
+ /// grammar:
+ /// CategoryName ::= string not containing any of ',', '&', '+', '-'
+ /// CategoryFilter ::= CategoryName | CategoryFilter ',' CategoryName
+ /// CategoryPrimitive ::= CategoryFilter | '-' CategoryPrimitive
+ /// CategoryTerm ::= CategoryPrimitive | CategoryTerm '&' CategoryPrimitive
+ /// </summary>
+ public class CategoryExpression
+ {
+ static readonly char[] ops = new char[] { ',', ';', '-', '|', '+', '(', ')' };
+
+ private string text;
+ private int next;
+ private string token;
+
+ private TestFilter filter;
+
+ public CategoryExpression(string text)
+ {
+ this.text = text;
+ this.next = 0;
+ }
+
+ public TestFilter Filter
+ {
+ get
+ {
+ if( filter == null )
+ {
+ filter = GetToken() == null
+ ? TestFilter.Empty
+ : GetExpression();
+ }
+
+ return filter;
+ }
+ }
+
+ private TestFilter GetExpression()
+ {
+ TestFilter term = GetTerm();
+ if ( token != "|" )
+ return term;
+
+ OrFilter filter = new OrFilter( term );
+
+ while ( token == "|" )
+ {
+ GetToken();
+ filter.Add( GetTerm() );
+ }
+
+ return filter;
+ }
+
+ private TestFilter GetTerm()
+ {
+ TestFilter prim = GetPrimitive();
+ if ( token != "+" && token != "-" )
+ return prim;
+
+ AndFilter filter = new AndFilter( prim );
+
+ while ( token == "+"|| token == "-" )
+ {
+ string tok = token;
+ GetToken();
+ prim = GetPrimitive();
+ filter.Add( tok == "-" ? new NotFilter( prim ) : prim );
+ }
+
+ return filter;
+ }
+
+ private TestFilter GetPrimitive()
+ {
+ if( token == "-" )
+ {
+ GetToken();
+ return new NotFilter( GetPrimitive() );
+ }
+ else if( token == "(" )
+ {
+ GetToken();
+ TestFilter expr = GetExpression();
+ GetToken(); // Skip ')'
+ return expr;
+ }
+
+ return GetCategoryFilter();
+ }
+
+ private CategoryFilter GetCategoryFilter()
+ {
+ CategoryFilter filter = new CategoryFilter( token );
+
+ while( GetToken() == "," || token == ";" )
+ filter.AddCategory( GetToken() );
+
+ return filter;
+ }
+
+ public string GetToken()
+ {
+ SkipWhiteSpace();
+
+ if ( EndOfText() )
+ token = null;
+ else if ( NextIsOperator() )
+ token = text.Substring(next++, 1);
+ else
+ {
+ int index2 = text.IndexOfAny( ops, next );
+ if ( index2 < 0 ) index2 = text.Length;
+
+ token = text.Substring( next, index2 - next ).TrimEnd();
+ next = index2;
+ }
+
+ return token;
+ }
+
+ private void SkipWhiteSpace()
+ {
+ while( next < text.Length && Char.IsWhiteSpace( text[next] ) )
+ ++next;
+ }
+
+ private bool EndOfText()
+ {
+ return next >= text.Length;
+ }
+
+ private bool NextIsOperator()
+ {
+ foreach( char op in ops )
+ if( op == text[next] )
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/CategoryManager.cs b/mcs/nunit24/ClientUtilities/util/CategoryManager.cs
new file mode 100644
index 00000000000..0c64fbc87f9
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/CategoryManager.cs
@@ -0,0 +1,54 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ public class CategoryManager
+ {
+ private Hashtable categories = new Hashtable();
+
+ public void Add(string name)
+ {
+ categories[name] = name;
+ }
+
+ public void Add(IList list)
+ {
+ foreach(string name in list)
+ {
+ Add(name);
+ }
+ }
+
+ public void AddCategories( ITest test )
+ {
+ if ( test.Categories != null )
+ Add( test.Categories );
+ }
+
+ public void AddAllCategories( ITest test )
+ {
+ AddCategories( test );
+ if ( test.IsSuite )
+ foreach( ITest child in test.Tests )
+ AddAllCategories( child );
+ }
+
+ public ICollection Categories
+ {
+ get { return categories.Values; }
+ }
+
+ public void Clear()
+ {
+ categories = new Hashtable();
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/CommandLineOptions.cs b/mcs/nunit24/ClientUtilities/util/CommandLineOptions.cs
new file mode 100644
index 00000000000..004ccee7af6
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/CommandLineOptions.cs
@@ -0,0 +1,316 @@
+// File: CommandLineOptions.cs
+//
+// This is a re-usable component to be used when you
+// need to parse command-line options/parameters.
+//
+// Separates command line parameters from command line options.
+// Uses reflection to populate member variables the derived class with the values
+// of the options.
+//
+// An option can start with "-" or "--". On Windows systems, it can start with "/" as well.
+//
+// I define 3 types of "options":
+// 1. Boolean options (yes/no values), e.g: /r to recurse
+// 2. Value options, e.g: /loglevel=3
+// 2. Parameters: standalone strings like file names
+//
+// An example to explain:
+// csc /nologo /t:exe myfile.cs
+// | | |
+// | | + parameter
+// | |
+// | + value option
+// |
+// + boolean option
+//
+// Please see a short description of the CommandLineOptions class
+// at http://codeblast.com/~gert/dotnet/sells.html
+//
+// Gert Lombard (gert@codeblast.com)
+// James Newkirk (jim@nunit.org)
+
+namespace Codeblast
+{
+ using System;
+ using System.Reflection;
+ using System.Collections;
+ using System.Text;
+
+ //
+ // The Attributes
+ //
+
+ [AttributeUsage(AttributeTargets.Field)]
+ public class OptionAttribute : Attribute
+ {
+ protected object optValue;
+ protected string optName;
+ protected string description;
+
+ public string Short
+ {
+ get { return optName; }
+ set { optName = value; }
+ }
+
+ public object Value
+ {
+ get { return optValue; }
+ set { optValue = value; }
+ }
+
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+ }
+
+ //
+ // The CommandLineOptions members
+ //
+
+ public abstract class CommandLineOptions
+ {
+ protected ArrayList parameters;
+ protected bool isInvalid = false;
+
+ private int optionCount;
+ private ArrayList invalidArguments = new ArrayList();
+ private bool allowForwardSlash;
+
+ public CommandLineOptions( string[] args )
+ : this( System.IO.Path.DirectorySeparatorChar != '/', args ) {}
+
+ public CommandLineOptions( bool allowForwardSlash, string[] args )
+ {
+ this.allowForwardSlash = allowForwardSlash;
+ optionCount = Init( args );
+ }
+
+ public IList InvalidArguments
+ {
+ get { return invalidArguments; }
+ }
+
+ public bool NoArgs
+ {
+ get
+ {
+ return ParameterCount == 0 && optionCount == 0;
+ }
+ }
+
+ public bool AllowForwardSlash
+ {
+ get { return allowForwardSlash; }
+ }
+
+ public int Init(params string[] args)
+ {
+ int count = 0;
+ int n = 0;
+ while (n < args.Length)
+ {
+ int pos = IsOption(args[n]);
+ if (pos > 0)
+ {
+ // It's an option:
+ if (GetOption(args, ref n, pos))
+ count++;
+ else
+ InvalidOption(args[Math.Min(n, args.Length-1)]);
+ }
+ else
+ {
+ if (parameters == null) parameters = new ArrayList();
+ parameters.Add(args[n]);
+ if ( !IsValidParameter(args[n]) )
+ InvalidOption( args[n] );
+ }
+ n++;
+ }
+ return count;
+ }
+
+ // An option starts with "/", "-" or "--":
+ protected virtual int IsOption(string opt)
+ {
+ char[] c = null;
+ if (opt.Length < 2)
+ {
+ return 0;
+ }
+ else if (opt.Length > 2)
+ {
+ c = opt.ToCharArray(0, 3);
+ if (c[0] == '-' && c[1] == '-' && IsOptionNameChar(c[2])) return 2;
+ }
+ else
+ {
+ c = opt.ToCharArray(0, 2);
+ }
+ if ((c[0] == '-' || c[0] == '/' && AllowForwardSlash) && IsOptionNameChar(c[1])) return 1;
+ return 0;
+ }
+
+ protected virtual bool IsOptionNameChar(char c)
+ {
+ return Char.IsLetterOrDigit(c) || c == '?';
+ }
+
+ protected virtual void InvalidOption(string name)
+ {
+ invalidArguments.Add( name );
+ isInvalid = true;
+ }
+
+ protected virtual bool IsValidParameter(string param)
+ {
+ return true;
+ }
+
+ protected virtual bool MatchShortName(FieldInfo field, string name)
+ {
+ object[] atts = field.GetCustomAttributes(typeof(OptionAttribute), true);
+ foreach (OptionAttribute att in atts)
+ {
+ if (string.Compare(att.Short, name, true) == 0) return true;
+ }
+ return false;
+ }
+
+ protected virtual FieldInfo GetMemberField(string name)
+ {
+ Type t = this.GetType();
+ FieldInfo[] fields = t.GetFields(BindingFlags.Instance|BindingFlags.Public);
+ foreach (FieldInfo field in fields)
+ {
+ if (string.Compare(field.Name, name, true) == 0) return field;
+ if (MatchShortName(field, name)) return field;
+ }
+ return null;
+ }
+
+ protected virtual object GetOptionValue(FieldInfo field)
+ {
+ object[] atts = field.GetCustomAttributes(typeof(OptionAttribute), true);
+ if (atts.Length > 0)
+ {
+ OptionAttribute att = (OptionAttribute)atts[0];
+ return att.Value;
+ }
+ return null;
+ }
+
+ protected virtual bool GetOption(string[] args, ref int index, int pos)
+ {
+ try
+ {
+ object cmdLineVal = null;
+ string opt = args[index].Substring(pos, args[index].Length-pos);
+ SplitOptionAndValue(ref opt, ref cmdLineVal);
+ FieldInfo field = GetMemberField(opt);
+ if (field != null)
+ {
+ object value = GetOptionValue(field);
+ if (value == null)
+ {
+ if (field.FieldType == typeof(bool))
+ value = true; // default for bool values is true
+ else if(field.FieldType == typeof(string))
+ {
+ value = cmdLineVal != null ? cmdLineVal : args[++index];
+ field.SetValue(this, Convert.ChangeType(value, field.FieldType));
+ string stringValue = (string)value;
+ if(stringValue == null || stringValue.Length == 0) return false;
+ return true;
+ }
+ else if(field.FieldType.IsEnum)
+ value = Enum.Parse( field.FieldType, (string)cmdLineVal, true );
+ else
+ value = cmdLineVal != null ? cmdLineVal : args[++index];
+ }
+ field.SetValue(this, Convert.ChangeType(value, field.FieldType));
+ return true;
+ }
+ }
+ catch (Exception)
+ {
+ // Ignore exceptions like type conversion errors.
+ }
+ return false;
+ }
+
+ protected virtual void SplitOptionAndValue(ref string opt, ref object val)
+ {
+ // Look for ":" or "=" separator in the option:
+ int pos = opt.IndexOfAny( new char[] { ':', '=' } );
+ if (pos < 1) return;
+
+ val = opt.Substring(pos+1);
+ opt = opt.Substring(0, pos);
+ }
+
+ // Parameter accessor:
+ public string this[int index]
+ {
+ get
+ {
+ if (parameters != null) return (string)parameters[index];
+ return null;
+ }
+ }
+
+ public ArrayList Parameters
+ {
+ get { return parameters; }
+ }
+
+ public int ParameterCount
+ {
+ get
+ {
+ return parameters == null ? 0 : parameters.Count;
+ }
+ }
+
+ public virtual void Help()
+ {
+ Console.WriteLine(GetHelpText());
+ }
+
+ public virtual string GetHelpText()
+ {
+ StringBuilder helpText = new StringBuilder();
+
+ Type t = this.GetType();
+ FieldInfo[] fields = t.GetFields(BindingFlags.Instance|BindingFlags.Public);
+ char optChar = allowForwardSlash ? '/' : '-';
+ foreach (FieldInfo field in fields)
+ {
+ object[] atts = field.GetCustomAttributes(typeof(OptionAttribute), true);
+ if (atts.Length > 0)
+ {
+ OptionAttribute att = (OptionAttribute)atts[0];
+ if (att.Description != null)
+ {
+ string valType = "";
+ if (att.Value == null)
+ {
+ if (field.FieldType == typeof(float)) valType = "=FLOAT";
+ else if (field.FieldType == typeof(string)) valType = "=STR";
+ else if (field.FieldType != typeof(bool)) valType = "=X";
+ }
+
+ helpText.AppendFormat("{0}{1,-20}\t{2}", optChar, field.Name+valType, att.Description);
+ if (att.Short != null)
+ helpText.AppendFormat(" (Short format: {0}{1}{2})", optChar, att.Short, valType);
+ helpText.Append( Environment.NewLine );
+ }
+ }
+ }
+ return helpText.ToString();
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ConsoleWriter.cs b/mcs/nunit24/ClientUtilities/util/ConsoleWriter.cs
new file mode 100644
index 00000000000..6f56c54bccb
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ConsoleWriter.cs
@@ -0,0 +1,73 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using System.IO;
+ using System.Text;
+
+ /// <summary>
+ /// Class used for receiving console output from the running test and displaying it.
+ /// </summary>
+ public class ConsoleWriter : TextWriter
+ {
+ #region Private Fields
+
+ private TextWriter console;
+
+ #endregion
+
+ #region Constructors
+
+ public ConsoleWriter(TextWriter console)
+ {
+ this.console = console;
+ }
+
+ #endregion
+
+ #region TextWriter Overrides
+
+ public override void Close()
+ {
+ //console.Close ();
+ }
+
+ public override void Flush()
+ {
+ console.Flush ();
+ }
+
+
+ public override void Write(char c)
+ {
+ console.Write(c);
+ }
+
+ public override void Write(String s)
+ {
+ console.Write(s);
+ }
+
+ public override void WriteLine(string s)
+ {
+ console.WriteLine(s);
+ }
+
+ public override Encoding Encoding
+ {
+ get { return Encoding.Default; }
+ }
+
+ public override Object InitializeLifetimeService()
+ {
+ return null;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ISettings.cs b/mcs/nunit24/ClientUtilities/util/ISettings.cs
new file mode 100644
index 00000000000..dcb2f980316
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ISettings.cs
@@ -0,0 +1,102 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ public delegate void SettingsEventHandler( object sender, SettingsEventArgs args );
+
+ public class SettingsEventArgs : EventArgs
+ {
+ private string settingName;
+
+ public SettingsEventArgs( string settingName )
+ {
+ this.settingName = settingName;
+ }
+
+ public string SettingName
+ {
+ get { return settingName; }
+ }
+ }
+
+ /// <summary>
+ /// The ISettings interface is used to access all user
+ /// settings and options.
+ /// </summary>
+ public interface ISettings
+ {
+ event SettingsEventHandler Changed;
+
+ /// <summary>
+ /// Load a setting from the storage.
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <returns>Value of the setting or null</returns>
+ object GetSetting( string settingName );
+
+ /// <summary>
+ /// Load a setting from the storage or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <param name="settingName">Value to return if the setting is missing</param>
+ /// <returns>Value of the setting or the default value</returns>
+ object GetSetting( string settingName, object defaultValue );
+
+ /// <summary>
+ /// Load an integer setting from the storage or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <param name="defaultValue">Value to return if the setting is missing</param>
+ /// <returns>Value of the setting or the default value</returns>
+ int GetSetting( string settingName, int defaultValue );
+
+ /// <summary>
+ /// Load a boolean setting or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <param name="defaultValue">Value to return if the setting is missing</param>
+ /// <returns>Value of the setting or the default value</returns>
+ bool GetSetting( string settingName, bool defaultValue );
+
+ /// <summary>
+ /// Load a string setting from the storage or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <param name="defaultValue">Value to return if the setting is missing</param>
+ /// <returns>Value of the setting or the default value</returns>
+ string GetSetting( string settingName, string defaultValue );
+
+ /// <summary>
+ /// Load an enum setting from the storage or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <param name="defaultValue">Value to return if the setting is missing</param>
+ /// <returns>Value of the setting or the default value</returns>
+ System.Enum GetSetting( string settingName, System.Enum defaultValue );
+
+ /// <summary>
+ /// Remove a setting from the storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to remove</param>
+ void RemoveSetting( string settingName );
+
+ /// <summary>
+ /// Remove an entire group of settings from the storage
+ /// </summary>
+ /// <param name="groupName">Name of the group to remove</param>
+ void RemoveGroup( string groupName );
+
+ /// <summary>
+ /// Save a setting in the storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to save</param>
+ /// <param name="settingValue">Value to be saved</param>
+ void SaveSetting( string settingName, object settingValue );
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ITestEvents.cs b/mcs/nunit24/ClientUtilities/util/ITestEvents.cs
new file mode 100644
index 00000000000..af9a39edcef
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ITestEvents.cs
@@ -0,0 +1,67 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// ITestEvents interface defines events related to loading
+ /// and unloading of test projects and loading, unloading and
+ /// running tests.
+ /// </summary>
+ public interface ITestEvents
+ {
+ // Events related to the loading and unloading
+ // of projects - including wrapper projects
+ // created in order to load assemblies. This
+ // occurs separately from the loading of tests
+ // for the assemblies in the project.
+ event TestEventHandler ProjectLoading;
+ event TestEventHandler ProjectLoaded;
+ event TestEventHandler ProjectLoadFailed;
+ event TestEventHandler ProjectUnloading;
+ event TestEventHandler ProjectUnloaded;
+ event TestEventHandler ProjectUnloadFailed;
+
+ // Events related to loading and unloading tests.
+ event TestEventHandler TestLoading;
+ event TestEventHandler TestLoaded;
+ event TestEventHandler TestLoadFailed;
+
+ event TestEventHandler TestReloading;
+ event TestEventHandler TestReloaded;
+ event TestEventHandler TestReloadFailed;
+
+ event TestEventHandler TestUnloading;
+ event TestEventHandler TestUnloaded;
+ event TestEventHandler TestUnloadFailed;
+
+ // Events related to a running a set of tests
+ event TestEventHandler RunStarting;
+ event TestEventHandler RunFinished;
+
+ // Events that arise while a test is running
+ // These are translated from calls to the runner on the
+ // EventListener interface.
+ event TestEventHandler SuiteStarting;
+ event TestEventHandler SuiteFinished;
+ event TestEventHandler TestStarting;
+ event TestEventHandler TestFinished;
+
+ /// <summary>
+ /// An unhandled exception was thrown during a test run,
+ /// and it cannot be associated with a particular test failure.
+ /// </summary>
+ event TestEventHandler TestException;
+
+ /// <summary>
+ /// Console Out/Error
+ /// </summary>
+ event TestEventHandler TestOutput;
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ITestLoader.cs b/mcs/nunit24/ClientUtilities/util/ITestLoader.cs
new file mode 100644
index 00000000000..4e3c124bba3
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ITestLoader.cs
@@ -0,0 +1,83 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// The ITestLoader interface supports the loading and running
+ /// of tests in a remote domain.
+ /// </summary>
+ public interface ITestLoader
+ {
+ #region Properties
+
+ // See if a project is loaded
+ bool IsProjectLoaded { get; }
+
+ // See if a test has been loaded from the project
+ bool IsTestLoaded { get; }
+
+ // See if a test is running
+ bool Running { get; }
+
+ // The loaded test project
+ NUnitProject TestProject { get; set; }
+
+ string TestFileName { get; }
+
+ // Our last test results
+ TestResult TestResult { get; }
+
+ #endregion
+
+ #region Methods
+
+ // Create a new empty project using a default name
+ void NewProject();
+
+ // Create a new project given a filename
+ void NewProject( string filename );
+
+ // Load a project given a filename
+ void LoadProject( string filename );
+
+ // Load a project given a filename and config
+ void LoadProject( string filename, string configname );
+
+ // Load a project given an array of assemblies
+ void LoadProject( string[] assemblies );
+
+ // Unload current project
+ void UnloadProject();
+
+ // Load tests for current project and config
+ void LoadTest();
+
+ // Load a specific test for current project and config
+ void LoadTest( string testName );
+
+ // Unload current test
+ void UnloadTest();
+
+ // Reload current test
+ void ReloadTest();
+
+ // Run all tests
+ void RunTests();
+
+ // Run specific tests
+ void RunTests( ITestFilter filter );
+
+ // Cancel the running test
+ void CancelTestRun();
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit24/ClientUtilities/util/Makefile b/mcs/nunit24/ClientUtilities/util/Makefile
new file mode 100644
index 00000000000..08aebcda379
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Makefile
@@ -0,0 +1,43 @@
+thisdir = nunit24/ClientUtilities/util
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit.util.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LOCAL_MCS_FLAGS= \
+ /resource:Transform.resources,NUnit.Util.Transform.resources \
+ -r:nunit.core.dll -r:nunit.core.interfaces.dll -r:System.dll \
+ -r:System.Xml.dll -r:System.Runtime.Remoting.dll \
+ /d:MONO /d:StronglyNamedAssembly
+NO_TEST = yo
+
+RESX_RES = Transform.resources
+
+EXTRA_DISTFILES = \
+ nunit.util.dll.csproj \
+ nunit.util.dll_VS2005.csproj \
+ $(RESX_RES:.resources=.resx)
+
+CLEAN_FILES = $(RESX_RES)
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+include ../../../build/library.make
+
+$(the_lib): $(RESX_RES)
+
+$(RESX_RES): %.resources: %.resx
+ $(RESGEN) `echo $< | $(PLATFORM_CHANGE_SEPARATOR_CMD)`
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/ClientUtilities/util/MemorySettingsStorage.cs b/mcs/nunit24/ClientUtilities/util/MemorySettingsStorage.cs
new file mode 100644
index 00000000000..47ca33217ba
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/MemorySettingsStorage.cs
@@ -0,0 +1,79 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// MemorySettingsStorage is used to hold settings for
+ /// the NUnit tests and also serves as the base class
+ /// for XmlSettingsStorage.
+ /// </summary>
+ public class MemorySettingsStorage : ISettingsStorage
+ {
+ protected Hashtable settings = new Hashtable();
+
+ #region ISettingsStorage Members
+
+ public object GetSetting(string settingName)
+ {
+ return settings[settingName];
+ }
+
+ public void RemoveSetting(string settingName)
+ {
+ settings.Remove( settingName );
+ }
+
+ public void RemoveGroup( string groupName )
+ {
+ ArrayList keysToRemove = new ArrayList();
+
+ string prefix = groupName;
+ if ( !prefix.EndsWith(".") )
+ prefix = prefix + ".";
+
+ foreach( string key in settings.Keys )
+ if ( key.StartsWith( prefix ) )
+ keysToRemove.Add( key );
+
+ foreach( string key in keysToRemove )
+ settings.Remove( key );
+ }
+
+ public void SaveSetting(string settingName, object settingValue)
+ {
+ settings[settingName] = settingValue;
+ }
+
+ public ISettingsStorage MakeChildStorage(string name)
+ {
+ return new MemorySettingsStorage();
+ }
+
+ public virtual void LoadSettings()
+ {
+ // No action required
+ }
+
+ public virtual void SaveSettings()
+ {
+ // No action required
+ }
+ #endregion
+
+ #region IDisposable Members
+
+ public void Dispose()
+ {
+ // TODO: Add MemorySettingsStorage.Dispose implementation
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/MultipleTestDomainRunner.cs b/mcs/nunit24/ClientUtilities/util/MultipleTestDomainRunner.cs
new file mode 100644
index 00000000000..ddd9b0d90b5
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/MultipleTestDomainRunner.cs
@@ -0,0 +1,87 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for MultipleTestDomainRunner.
+ /// </summary>
+ public class MultipleTestDomainRunner : AggregatingTestRunner
+ {
+ #region Constructors
+ public MultipleTestDomainRunner() : base( 0 ) { }
+
+ public MultipleTestDomainRunner( int runnerID ) : base( runnerID ) { }
+ #endregion
+
+ #region Load Method Overrides
+ public override bool Load(TestPackage package)
+ {
+ this.projectName = package.FullName;
+ this.testName.FullName = this.testName.Name = projectName;
+ runners = new ArrayList();
+
+ int nfound = 0;
+ int index = 0;
+
+ string targetAssemblyName = null;
+ if( package.TestName != null && package.Assemblies.Contains( package.TestName ) )
+ {
+ targetAssemblyName = package.TestName;
+ package.TestName = null;
+ }
+
+ foreach( string assembly in package.Assemblies )
+ {
+ if ( targetAssemblyName == null || targetAssemblyName == assembly )
+ {
+ TestDomain runner = new TestDomain( this.runnerID * 100 + index + 1 );
+
+ TestPackage p = new TestPackage( assembly );
+ p.AutoBinPath = package.AutoBinPath;
+ p.ConfigurationFile = package.ConfigurationFile;
+ p.BasePath = package.BasePath;
+ p.PrivateBinPath = package.PrivateBinPath;
+ p.TestName = package.TestName;
+ foreach( object key in package.Settings.Keys )
+ p.Settings[key] = package.Settings[key];
+
+ if ( package.TestName == null )
+ {
+ runners.Add( runner );
+ if ( runner.Load( p ) )
+ nfound++;
+ }
+ else if ( runner.Load( p ) )
+ {
+ runners.Add( runner );
+ nfound++;
+ }
+ }
+ }
+
+ if ( package.TestName == null && targetAssemblyName == null )
+ return nfound == package.Assemblies.Count;
+ else
+ return nfound > 0;
+ }
+
+ private void CreateRunners( int count )
+ {
+ runners = new ArrayList();
+ for( int index = 0; index < count; index++ )
+ {
+ TestDomain runner = new TestDomain( this.runnerID * 100 + index + 1 );
+ runners.Add( runner );
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/NUnitProject.cs b/mcs/nunit24/ClientUtilities/util/NUnitProject.cs
new file mode 100644
index 00000000000..6fa8d284142
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/NUnitProject.cs
@@ -0,0 +1,656 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Xml;
+using System.Xml.Schema;
+using System.IO;
+using System.Threading;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Types of changes that may occur to a config
+ /// </summary>
+ public enum ProjectChangeType
+ {
+ ActiveConfig,
+ AddConfig,
+ RemoveConfig,
+ UpdateConfig,
+ Other
+ }
+
+ /// <summary>
+ /// Arguments for a project event
+ /// </summary>
+ public class ProjectEventArgs : EventArgs
+ {
+ public ProjectChangeType type;
+ public string configName;
+
+ public ProjectEventArgs( ProjectChangeType type, string configName )
+ {
+ this.type = type;
+ this.configName = configName;
+ }
+ }
+
+ /// <summary>
+ /// Delegate to be used to handle project events
+ /// </summary>
+ public delegate void ProjectEventHandler( object sender, ProjectEventArgs e );
+
+ /// <summary>
+ /// Class that represents an NUnit test project
+ /// </summary>
+ public class NUnitProject
+ {
+ #region Static and instance variables
+
+ /// <summary>
+ /// Used to generate default names for projects
+ /// </summary>
+ private static int projectSeed = 0;
+
+ /// <summary>
+ /// The extension used for test projects
+ /// </summary>
+ private static readonly string nunitExtension = ".nunit";
+
+ /// <summary>
+ /// Path to the file storing this project
+ /// </summary>
+ private string projectPath;
+
+ /// <summary>
+ /// Application Base for the project. Since this
+ /// can be null, always fetch from the property
+ /// rather than using the field directly.
+ /// </summary>
+ private string basePath;
+
+ /// <summary>
+ /// Whether the project is dirty
+ /// </summary>
+ private bool isDirty = false;
+
+ /// <summary>
+ /// Collection of configs for the project
+ /// </summary>
+ private ProjectConfigCollection configs;
+
+ /// <summary>
+ /// The currently active configuration
+ /// </summary>
+ private ProjectConfig activeConfig;
+
+ /// <summary>
+ /// Flag indicating that this project is a
+ /// temporary wrapper for an assembly.
+ /// </summary>
+ private bool isAssemblyWrapper = false;
+
+ #endregion
+
+ #region Constructor
+
+ public NUnitProject( string projectPath )
+ {
+ this.projectPath = Path.GetFullPath( projectPath );
+ configs = new ProjectConfigCollection( this );
+ }
+
+ #endregion
+
+ #region Static Methods
+ // True if it's one of our project types
+ public static bool IsProjectFile( string path )
+ {
+ return Path.GetExtension( path ) == nunitExtension;
+ }
+
+ // True if it's ours or one we can load
+ public static bool CanLoadAsProject( string path )
+ {
+ return IsProjectFile( path ) ||
+ VSProject.IsProjectFile( path ) ||
+ VSProject.IsSolutionFile( path );
+ }
+
+ public static string GenerateProjectName()
+ {
+ return string.Format( "Project{0}", ++projectSeed );
+ }
+
+ public static NUnitProject EmptyProject()
+ {
+ return new NUnitProject( GenerateProjectName() );
+ }
+
+ public static NUnitProject NewProject()
+ {
+ NUnitProject project = EmptyProject();
+
+ project.Configs.Add( "Debug" );
+ project.Configs.Add( "Release" );
+ project.IsDirty = false;
+
+ return project;
+ }
+
+ /// <summary>
+ /// Return a test project by either loading it from
+ /// the supplied path, creating one from a VS file
+ /// or wrapping an assembly.
+ /// </summary>
+ public static NUnitProject LoadProject( string path )
+ {
+ if ( NUnitProject.IsProjectFile( path ) )
+ {
+ NUnitProject project = new NUnitProject( path );
+ project.Load();
+ return project;
+ }
+ else if ( VSProject.IsProjectFile( path ) )
+ return NUnitProject.FromVSProject( path );
+ else if ( VSProject.IsSolutionFile( path ) )
+ return NUnitProject.FromVSSolution( path );
+ else
+ return NUnitProject.FromAssembly( path );
+
+ }
+
+ /// <summary>
+ /// Creates a project to wrap a list of assemblies
+ /// </summary>
+ public static NUnitProject FromAssemblies( string[] assemblies )
+ {
+ // if only one assembly is passed in then the configuration file
+ // should follow the name of the assembly. This will only happen
+ // if the LoadAssembly method is called. Currently the console ui
+ // does not differentiate between having one or multiple assemblies
+ // passed in.
+ if ( assemblies.Length == 1)
+ return NUnitProject.FromAssembly(assemblies[0]);
+
+
+ NUnitProject project = NUnitProject.EmptyProject();
+ ProjectConfig config = new ProjectConfig( "Default" );
+ foreach( string assembly in assemblies )
+ {
+ string fullPath = Path.GetFullPath( assembly );
+
+ if ( !File.Exists( fullPath ) )
+ throw new FileNotFoundException( string.Format( "Assembly not found: {0}", fullPath ) );
+
+ config.Assemblies.Add( fullPath );
+ }
+
+ project.Configs.Add( config );
+
+ // TODO: Deduce application base, and provide a
+ // better value for loadpath and project path
+ // analagous to how new projects are handled
+ string basePath = Path.GetDirectoryName( Path.GetFullPath( assemblies[0] ) );
+ project.projectPath = Path.Combine( basePath, project.Name + ".nunit" );
+
+ project.IsDirty = true;
+
+ return project;
+ }
+
+ /// <summary>
+ /// Creates a project to wrap an assembly
+ /// </summary>
+ public static NUnitProject FromAssembly( string assemblyPath )
+ {
+ if ( !File.Exists( assemblyPath ) )
+ throw new FileNotFoundException( string.Format( "Assembly not found: {0}", assemblyPath ) );
+
+ string fullPath = Path.GetFullPath( assemblyPath );
+
+ NUnitProject project = new NUnitProject( fullPath );
+
+ ProjectConfig config = new ProjectConfig( "Default" );
+ config.Assemblies.Add( fullPath );
+ project.Configs.Add( config );
+
+ project.isAssemblyWrapper = true;
+ project.IsDirty = false;
+
+ return project;
+ }
+
+ public static NUnitProject FromVSProject( string vsProjectPath )
+ {
+ NUnitProject project = new NUnitProject( Path.GetFullPath( vsProjectPath ) );
+
+ VSProject vsProject = new VSProject( vsProjectPath );
+ project.Add( vsProject );
+
+ project.isDirty = false;
+
+ return project;
+ }
+
+ public static NUnitProject FromVSSolution( string solutionPath )
+ {
+ NUnitProject project = new NUnitProject( Path.GetFullPath( solutionPath ) );
+
+ string solutionDirectory = Path.GetDirectoryName( solutionPath );
+ using(StreamReader reader = new StreamReader( solutionPath ))
+ {
+ char[] delims = { '=', ',' };
+ char[] trimchars = { ' ', '"' };
+
+ string line = reader.ReadLine();
+ while ( line != null )
+ {
+ if ( line.StartsWith( "Project" ) )
+ {
+ string[] parts = line.Split( delims );
+ string vsProjectPath = parts[2].Trim(trimchars);
+
+ if ( VSProject.IsProjectFile( vsProjectPath ) )
+ project.Add( new VSProject( Path.Combine( solutionDirectory, vsProjectPath ) ) );
+ }
+
+ line = reader.ReadLine();
+ }
+ }
+
+ project.isDirty = false;
+
+ return project;
+ }
+
+ /// <summary>
+ /// Figure out the proper name to be used when saving a file.
+ /// </summary>
+ public static string ProjectPathFromFile( string path )
+ {
+ string fileName = Path.GetFileNameWithoutExtension( path ) + nunitExtension;
+ return Path.Combine( Path.GetDirectoryName( path ), fileName );
+ }
+
+ #endregion
+
+ #region Properties and Events
+
+ public static int ProjectSeed
+ {
+ get { return projectSeed; }
+ set { projectSeed = value; }
+ }
+
+ /// <summary>
+ /// The path to which a project will be saved.
+ /// </summary>
+ public string ProjectPath
+ {
+ get { return projectPath; }
+ set
+ {
+ projectPath = Path.GetFullPath( value );
+ isDirty = true;
+ }
+ }
+
+ public string DefaultBasePath
+ {
+ get { return Path.GetDirectoryName( projectPath ); }
+ }
+
+ /// <summary>
+ /// Indicates whether a base path was specified for the project
+ /// </summary>
+ public bool BasePathSpecified
+ {
+ get
+ {
+ return basePath != null && basePath != string.Empty;
+ }
+ }
+
+ /// <summary>
+ /// The base path for the project. Constructor sets
+ /// it to the directory part of the project path.
+ /// </summary>
+ public string BasePath
+ {
+ get
+ {
+ if ( !BasePathSpecified )
+ return DefaultBasePath;
+ return basePath;
+ }
+ set
+ {
+ basePath = value;
+
+ if ( basePath != null && basePath != string.Empty
+ && !Path.IsPathRooted( basePath ) )
+ {
+ basePath = Path.Combine(
+ DefaultBasePath,
+ basePath );
+ }
+
+ basePath = PathUtils.Canonicalize( basePath );
+ OnProjectChange( ProjectChangeType.Other, null );
+ }
+ }
+
+ /// <summary>
+ /// The name of the project.
+ /// </summary>
+ public string Name
+ {
+ get { return Path.GetFileNameWithoutExtension( projectPath ); }
+ }
+
+ public ProjectConfig ActiveConfig
+ {
+ get
+ {
+ // In case the previous active config was removed
+ if ( activeConfig != null && !configs.Contains( activeConfig ) )
+ activeConfig = null;
+
+ // In case no active config is set or it was removed
+ if ( activeConfig == null && configs.Count > 0 )
+ activeConfig = configs[0];
+
+ return activeConfig;
+ }
+ }
+
+ // Safe access to name of the active config
+ public string ActiveConfigName
+ {
+ get
+ {
+ ProjectConfig config = ActiveConfig;
+ return config == null ? null : config.Name;
+ }
+ }
+
+ public bool IsLoadable
+ {
+ get
+ {
+ return ActiveConfig != null &&
+ ActiveConfig.Assemblies.Count > 0;
+ }
+ }
+
+ // A project made from a single assembly is treated
+ // as a transparent wrapper for some purposes until
+ // a change is made to it.
+ public bool IsAssemblyWrapper
+ {
+ get { return isAssemblyWrapper; }
+ }
+
+ public string ConfigurationFile
+ {
+ get
+ {
+ // TODO: Check this
+ return isAssemblyWrapper
+ ? Path.GetFileName( projectPath ) + ".config"
+ : Path.GetFileNameWithoutExtension( projectPath ) + ".config";
+ }
+ }
+
+ public bool IsDirty
+ {
+ get { return isDirty; }
+ set { isDirty = value; }
+ }
+
+ public ProjectConfigCollection Configs
+ {
+ get { return configs; }
+ }
+
+ public event ProjectEventHandler Changed;
+
+ #endregion
+
+ #region Instance Methods
+
+ public void SetActiveConfig( int index )
+ {
+ activeConfig = configs[index];
+ OnProjectChange( ProjectChangeType.ActiveConfig, activeConfig.Name );
+ }
+
+ public void SetActiveConfig( string name )
+ {
+ foreach( ProjectConfig config in configs )
+ {
+ if ( config.Name == name )
+ {
+ activeConfig = config;
+ OnProjectChange( ProjectChangeType.ActiveConfig, activeConfig.Name );
+ break;
+ }
+ }
+ }
+
+// public int IndexOf( string name )
+// {
+// for( int index = 0; index < configs.Count; index++ )
+// if( configs[index].Name == name )
+// return index;
+//
+// return -1;
+// }
+
+ public void OnProjectChange( ProjectChangeType type, string configName )
+ {
+ isDirty = true;
+
+ if ( isAssemblyWrapper )
+ {
+ projectPath = Path.ChangeExtension( projectPath, ".nunit" );
+ isAssemblyWrapper = false;
+ }
+
+ if ( Changed != null )
+ Changed( this, new ProjectEventArgs( type, configName ) );
+
+ if ( type == ProjectChangeType.RemoveConfig )
+ {
+ if ( activeConfig == null || activeConfig.Name == configName )
+ {
+ if ( configs.Count > 0 )
+ SetActiveConfig( 0 );
+ }
+ }
+ }
+
+ public void Add( VSProject vsProject )
+ {
+ foreach( VSProjectConfig vsConfig in vsProject.Configs )
+ {
+ string name = vsConfig.Name;
+
+ if ( !configs.Contains( name ) )
+ configs.Add( name );
+
+ ProjectConfig config = this.Configs[name];
+
+ foreach ( string assembly in vsConfig.Assemblies )
+ config.Assemblies.Add( assembly );
+ }
+ }
+
+ public void Load()
+ {
+ XmlTextReader reader = new XmlTextReader( projectPath );
+
+ string activeConfigName = null;
+ ProjectConfig currentConfig = null;
+
+ try
+ {
+ reader.MoveToContent();
+ if ( reader.NodeType != XmlNodeType.Element || reader.Name != "NUnitProject" )
+ throw new ProjectFormatException(
+ "Invalid project format: <NUnitProject> expected.",
+ reader.LineNumber, reader.LinePosition );
+
+ while( reader.Read() )
+ if ( reader.NodeType == XmlNodeType.Element )
+ switch( reader.Name )
+ {
+ case "Settings":
+ if ( reader.NodeType == XmlNodeType.Element )
+ {
+ activeConfigName = reader.GetAttribute( "activeconfig" );
+ if (activeConfigName == "NUnitAutoConfig")
+ activeConfigName = NUnitFramework.BuildConfiguration;
+ string appbase = reader.GetAttribute( "appbase" );
+ if ( appbase != null )
+ this.BasePath = appbase;
+ }
+ break;
+
+ case "Config":
+ if ( reader.NodeType == XmlNodeType.Element )
+ {
+ string configName = reader.GetAttribute( "name" );
+ currentConfig = new ProjectConfig( configName );
+ currentConfig.BasePath = reader.GetAttribute( "appbase" );
+ currentConfig.ConfigurationFile = reader.GetAttribute( "configfile" );
+
+ string binpath = reader.GetAttribute( "binpath" );
+ currentConfig.PrivateBinPath = binpath;
+ string type = reader.GetAttribute( "binpathtype" );
+ if ( type == null )
+ if ( binpath == null )
+ currentConfig.BinPathType = BinPathType.Auto;
+ else
+ currentConfig.BinPathType = BinPathType.Manual;
+ else
+ currentConfig.BinPathType = (BinPathType)Enum.Parse( typeof( BinPathType ), type, true );
+ Configs.Add( currentConfig );
+ if ( configName == activeConfigName )
+ activeConfig = currentConfig;
+ }
+ else if ( reader.NodeType == XmlNodeType.EndElement )
+ currentConfig = null;
+ break;
+
+ case "assembly":
+ if ( reader.NodeType == XmlNodeType.Element && currentConfig != null )
+ {
+ string path = reader.GetAttribute( "path" );
+ currentConfig.Assemblies.Add(
+ Path.Combine( currentConfig.BasePath, path ) );
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ this.IsDirty = false;
+ }
+ catch( FileNotFoundException )
+ {
+ throw;
+ }
+ catch( XmlException e )
+ {
+ throw new ProjectFormatException(
+ string.Format( "Invalid project format: {0}", e.Message ),
+ e.LineNumber, e.LinePosition );
+ }
+ catch( Exception e )
+ {
+ throw new ProjectFormatException(
+ string.Format( "Invalid project format: {0} Line {1}, Position {2}",
+ e.Message, reader.LineNumber, reader.LinePosition ),
+ reader.LineNumber, reader.LinePosition );
+ }
+ finally
+ {
+ reader.Close();
+ }
+ }
+
+ public void Save()
+ {
+ projectPath = ProjectPathFromFile( projectPath );
+
+ XmlTextWriter writer = new XmlTextWriter( projectPath, System.Text.Encoding.UTF8 );
+ writer.Formatting = Formatting.Indented;
+
+ writer.WriteStartElement( "NUnitProject" );
+
+ if ( configs.Count > 0 || this.BasePath != this.DefaultBasePath )
+ {
+ writer.WriteStartElement( "Settings" );
+ if ( configs.Count > 0 )
+ writer.WriteAttributeString( "activeconfig", ActiveConfigName );
+ if ( this.BasePath != this.DefaultBasePath )
+ writer.WriteAttributeString( "appbase", this.BasePath );
+ writer.WriteEndElement();
+ }
+
+ foreach( ProjectConfig config in Configs )
+ {
+ writer.WriteStartElement( "Config" );
+ writer.WriteAttributeString( "name", config.Name );
+ string appbase = config.BasePath;
+ if ( !PathUtils.SamePathOrUnder( this.BasePath, appbase ) )
+ writer.WriteAttributeString( "appbase", appbase );
+ else if ( config.RelativeBasePath != null )
+ writer.WriteAttributeString( "appbase", config.RelativeBasePath );
+
+ string configFile = config.ConfigurationFile;
+ if ( configFile != null && configFile != this.ConfigurationFile )
+ writer.WriteAttributeString( "configfile", config.ConfigurationFile );
+
+ if ( config.BinPathType == BinPathType.Manual )
+ writer.WriteAttributeString( "binpath", config.PrivateBinPath );
+ else
+ writer.WriteAttributeString( "binpathtype", config.BinPathType.ToString() );
+
+ foreach( string assembly in config.Assemblies )
+ {
+ writer.WriteStartElement( "assembly" );
+ writer.WriteAttributeString( "path", PathUtils.RelativePath( config.BasePath, assembly ) );
+ writer.WriteEndElement();
+ }
+
+ writer.WriteEndElement();
+ }
+
+ writer.WriteEndElement();
+
+ writer.Close();
+ this.IsDirty = false;
+
+ // Once we save a project, it's no longer
+ // loaded as an assembly wrapper on reload.
+ this.isAssemblyWrapper = false;
+ }
+
+ public void Save( string projectPath )
+ {
+ this.ProjectPath = projectPath;
+ Save();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/NUnitRegistry.cs b/mcs/nunit24/ClientUtilities/util/NUnitRegistry.cs
new file mode 100644
index 00000000000..cd61361c979
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/NUnitRegistry.cs
@@ -0,0 +1,141 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using System.IO;
+ using System.Text;
+ using Microsoft.Win32;
+
+ /// <summary>
+ /// NUnitRegistry provides static properties for NUnit's
+ /// CurrentUser and LocalMachine subkeys.
+ /// </summary>
+ public class NUnitRegistry
+ {
+ public static readonly string KEY =
+ @"Software\nunit.org\Nunit\2.4";
+
+ public static readonly string LEGACY_KEY =
+ @"Software\Nascent Software\Nunit\";
+
+ private static bool testMode = false;
+ public static readonly string TEST_KEY =
+ @"Software\nunit.org\Nunit-Test";
+
+
+ /// <summary>
+ /// Prevent construction of object
+ /// </summary>
+ private NUnitRegistry() { }
+
+ public static bool TestMode
+ {
+ get { return testMode; }
+ set { testMode = value; }
+ }
+
+ /// <summary>
+ /// Registry subkey for the current user
+ /// </summary>
+ public static RegistryKey CurrentUser
+ {
+ get
+ {
+ if ( testMode )
+ return Registry.CurrentUser.CreateSubKey( TEST_KEY );
+
+ RegistryKey newKey = Registry.CurrentUser.OpenSubKey( KEY, true );
+ if (newKey == null)
+ {
+ newKey = Registry.CurrentUser.CreateSubKey( KEY );
+ RegistryKey oldKey = Registry.CurrentUser.OpenSubKey( LEGACY_KEY );
+ if ( oldKey != null )
+ {
+ CopyKey( oldKey, newKey );
+ oldKey.Close();
+ }
+ }
+
+ return newKey;
+ }
+ }
+
+ public static bool KeyExists( string subkey )
+ {
+ using ( RegistryKey key = Registry.CurrentUser.OpenSubKey( subkey, true ) )
+ {
+ return key != null;
+ }
+ }
+
+ /// <summary>
+ /// Registry subkey for the local machine
+ /// </summary>
+ public static RegistryKey LocalMachine
+ {
+ get { return Registry.LocalMachine.CreateSubKey( testMode ? TEST_KEY : KEY ); }
+ }
+
+ public static void ClearTestKeys()
+ {
+ ClearSubKey( Registry.CurrentUser, TEST_KEY );
+ //ClearSubKey( Registry.LocalMachine, TEST_KEY );
+ }
+
+ /// <summary>
+ /// Static helper method that clears out the contents of a subkey
+ /// </summary>
+ /// <param name="baseKey">Base key for the subkey</param>
+ /// <param name="subKey">Name of the subkey</param>
+ private static void ClearSubKey( RegistryKey baseKey, string subKey )
+ {
+ using( RegistryKey key = baseKey.OpenSubKey( subKey, true ) )
+ {
+ if ( key != null ) ClearKey( key );
+ }
+ }
+
+ /// <summary>
+ /// Static function that clears out the contents of a key
+ /// </summary>
+ /// <param name="key">Key to be cleared</param>
+ public static void ClearKey( RegistryKey key )
+ {
+ foreach( string name in key.GetValueNames() )
+ key.DeleteValue( name );
+
+ // TODO: This throws under Mono - Restore when bug is fixed
+ //foreach( string name in key.GetSubKeyNames() )
+ // key.DeleteSubKeyTree( name );
+
+ foreach (string name in key.GetSubKeyNames())
+ {
+ ClearSubKey(key, name);
+ key.DeleteSubKey( name );
+ }
+ }
+
+ /// <summary>
+ /// Static method that copies the contents of one key to another
+ /// </summary>
+ /// <param name="fromKey">The source key for the copy</param>
+ /// <param name="toKey">The target key for the copy</param>
+ public static void CopyKey( RegistryKey fromKey, RegistryKey toKey )
+ {
+ foreach( string name in fromKey.GetValueNames() )
+ toKey.SetValue( name, fromKey.GetValue( name ) );
+
+ foreach( string name in fromKey.GetSubKeyNames() )
+ using( RegistryKey fromSubKey = fromKey.OpenSubKey( name ) )
+ using( RegistryKey toSubKey = toKey.CreateSubKey( name ) )
+ {
+ CopyKey( fromSubKey, toSubKey );
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/PathUtils.cs b/mcs/nunit24/ClientUtilities/util/PathUtils.cs
new file mode 100644
index 00000000000..b6e138301ac
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/PathUtils.cs
@@ -0,0 +1,209 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Text;
+using System.Reflection;
+using System.Collections;
+using System.Runtime.InteropServices;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Static methods for manipulating project paths, including both directories
+ /// and files. Some synonyms for System.Path methods are included as well.
+ /// </summary>
+ public class PathUtils
+ {
+ public const uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
+ public const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
+ public const int MAX_PATH = 256;
+
+ protected static char DirectorySeparatorChar = Path.DirectorySeparatorChar;
+ protected static char AltDirectorySeparatorChar = Path.AltDirectorySeparatorChar;
+
+ #region Public methods
+
+ public static bool IsAssemblyFileType( string path )
+ {
+ string extension = Path.GetExtension( path ).ToLower();
+ return extension == ".dll" || extension == ".exe";
+ }
+
+ /// <summary>
+ /// Returns the relative path from a base directory to another
+ /// directory or file.
+ /// </summary>
+ public static string RelativePath( string from, string to )
+ {
+ if (from == null)
+ throw new ArgumentNullException (from);
+ if (to == null)
+ throw new ArgumentNullException (to);
+ if (!Path.IsPathRooted (to))
+ return to;
+ if (Path.GetPathRoot (from) != Path.GetPathRoot (to))
+ return null;
+
+ string[] _from = from.Split (PathUtils.DirectorySeparatorChar,
+ PathUtils.AltDirectorySeparatorChar);
+ string[] _to = to.Split (PathUtils.DirectorySeparatorChar,
+ PathUtils.AltDirectorySeparatorChar);
+
+ StringBuilder sb = new StringBuilder (Math.Max (from.Length, to.Length));
+
+ int last_common, min = Math.Min (_from.Length, _to.Length);
+ for (last_common = 0; last_common < min; ++last_common)
+ {
+ if (!_from [last_common].Equals (_to [last_common]))
+ break;
+ }
+
+ if (last_common < _from.Length)
+ sb.Append ("..");
+ for (int i = last_common + 1; i < _from.Length; ++i)
+ {
+ sb.Append (PathUtils.DirectorySeparatorChar).Append ("..");
+ }
+
+ if (sb.Length > 0)
+ sb.Append (PathUtils.DirectorySeparatorChar);
+ if (last_common < _to.Length)
+ sb.Append (_to [last_common]);
+ for (int i = last_common + 1; i < _to.Length; ++i)
+ {
+ sb.Append (PathUtils.DirectorySeparatorChar).Append (_to [i]);
+ }
+
+ return sb.ToString ();
+ }
+
+ /// <summary>
+ /// Return the canonical form of a path.
+ /// </summary>
+ public static string Canonicalize( string path )
+ {
+ ArrayList parts = new ArrayList(
+ path.Split( DirectorySeparatorChar, AltDirectorySeparatorChar ) );
+
+ for( int index = 0; index < parts.Count; )
+ {
+ string part = (string)parts[index];
+
+ switch( part )
+ {
+ case ".":
+ parts.RemoveAt( index );
+ break;
+
+ case "..":
+ parts.RemoveAt( index );
+ if ( index > 0 )
+ parts.RemoveAt( --index );
+ break;
+ default:
+ index++;
+ break;
+ }
+ }
+
+ return String.Join( DirectorySeparatorChar.ToString(), (string[])parts.ToArray( typeof( string ) ) );
+ }
+
+ /// <summary>
+ /// True if the two paths are the same. However, two paths
+ /// to the same file or directory using different network
+ /// shares or drive letters are not treated as equal.
+ /// </summary>
+ public static bool SamePath( string path1, string path2 )
+ {
+ return string.Compare( Canonicalize(path1), Canonicalize(path2), PathUtils.IsWindows() ) == 0;
+ }
+
+ /// <summary>
+ /// True if the two paths are the same or if the second is
+ /// directly or indirectly under the first. Note that paths
+ /// using different network shares or drive letters are
+ /// considered unrelated, even if they end up referencing
+ /// the same subtrees in the file system.
+ /// </summary>
+ public static bool SamePathOrUnder( string path1, string path2 )
+ {
+ path1 = Canonicalize( path1 );
+ path2 = Canonicalize( path2 );
+
+ int length1 = path1.Length;
+ int length2 = path2.Length;
+
+ // if path1 is longer, then path2 can't be under it
+ if ( length1 > length2 )
+ return false;
+
+ // if lengths are the same, check for equality
+ if ( length1 == length2 )
+ //return path1.ToLower() == path2.ToLower();
+ return string.Compare( path1, path2, IsWindows() ) == 0;
+
+ // path 2 is longer than path 1: see if initial parts match
+ //if ( path1.ToLower() != path2.Substring( 0, length1 ).ToLower() )
+ if ( string.Compare( path1, path2.Substring( 0, length1 ), IsWindows() ) != 0 )
+ return false;
+
+ // must match through or up to a directory separator boundary
+ return path2[length1-1] == DirectorySeparatorChar ||
+ path2[length1] == DirectorySeparatorChar;
+ }
+
+ public static string Combine( string path1, params string[] morePaths )
+ {
+ string result = path1;
+ foreach( string path in morePaths )
+ result = Path.Combine( result, path );
+ return result;
+ }
+
+ // TODO: This logic should be in shared source
+ public static string GetAssemblyPath( Assembly assembly )
+ {
+ string uri = assembly.CodeBase;
+
+ // If it wasn't loaded locally, use the Location
+ if ( !uri.StartsWith( Uri.UriSchemeFile ) )
+ return assembly.Location;
+
+ return GetAssemblyPathFromFileUri( uri );
+ }
+
+ // Separate method for testability
+ public static string GetAssemblyPathFromFileUri( string uri )
+ {
+ // Skip over the file://
+ int start = Uri.UriSchemeFile.Length + Uri.SchemeDelimiter.Length;
+
+ if ( PathUtils.DirectorySeparatorChar == '\\' )
+ {
+ if ( uri[start] == '/' && uri[start+2] == ':' )
+ ++start;
+ }
+ else
+ {
+ if ( uri[start] != '/' )
+ --start;
+ }
+
+ return uri.Substring( start );
+ }
+ #endregion
+
+ #region Helper Methods
+ private static bool IsWindows()
+ {
+ return PathUtils.DirectorySeparatorChar == '\\';
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ProcessRunner.cs b/mcs/nunit24/ClientUtilities/util/ProcessRunner.cs
new file mode 100644
index 00000000000..ca742970c9f
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ProcessRunner.cs
@@ -0,0 +1,58 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Reflection;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Services;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for ProcessRunner.
+ /// </summary>
+ public class ProcessRunner : ProxyTestRunner, IDisposable
+ {
+ private TestAgent agent;
+
+ #region Constructors
+ public ProcessRunner() : base( 0 ) { }
+
+ public ProcessRunner( int runnerID ) : base( runnerID ) { }
+ #endregion
+
+ public override bool Load(TestPackage package)
+ {
+ if ( this.agent == null )
+ this.agent = Services.TestAgency.GetAgent( AgentType.ProcessAgent, 5000 );
+
+ if ( this.TestRunner == null )
+ this.TestRunner = agent.CreateRunner(this.runnerID);
+
+ return base.Load (package);
+ }
+
+ #region IDisposable Members
+ public void Dispose()
+ {
+ if ( TestRunner != null )
+ this.TestRunner.Unload();
+
+ if ( this.agent != null )
+ Services.TestAgency.ReleaseAgent(this.agent);
+
+ this.TestRunner = null;
+ this.agent = null;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ProjectConfig.cs b/mcs/nunit24/ClientUtilities/util/ProjectConfig.cs
new file mode 100644
index 00000000000..ceaaa924fc0
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ProjectConfig.cs
@@ -0,0 +1,255 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Text;
+using System.Collections;
+using System.IO;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ public enum BinPathType
+ {
+ Auto,
+ Manual,
+ None
+ }
+
+ public class ProjectConfig
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// The name of this config
+ /// </summary>
+ private string name;
+
+ /// <summary>
+ /// IProject interface of containing project
+ /// </summary>
+ protected NUnitProject project = null;
+
+ /// <summary>
+ /// List of the names of the assemblies
+ /// </summary>
+ private AssemblyList assemblies;
+
+ /// <summary>
+ /// Base path specific to this configuration
+ /// </summary>
+ private string basePath;
+
+ /// <summary>
+ /// Our configuration file, if specified
+ /// </summary>
+ private string configFile;
+
+ /// <summary>
+ /// Private bin path, if specified
+ /// </summary>
+ private string binPath;
+
+ /// <summary>
+ /// True if assembly paths should be added to bin path
+ /// </summary>
+ private BinPathType binPathType = BinPathType.Auto;
+
+ #endregion
+
+ #region Constructor
+ public ProjectConfig( string name )
+ {
+ this.name = name;
+ this.assemblies = new AssemblyList();
+ assemblies.Changed += new EventHandler( assemblies_Changed );
+ }
+ #endregion
+
+ #region Properties and Events
+
+ public event EventHandler Changed;
+
+ public NUnitProject Project
+ {
+// get { return project; }
+ set { project = value; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ set
+ {
+ if ( name != value )
+ {
+ name = value;
+ FireChangedEvent();
+ }
+ }
+ }
+
+ private bool BasePathSpecified
+ {
+ get
+ {
+ return project.BasePathSpecified || this.basePath != null && this.basePath != "";
+ }
+ }
+
+ /// <summary>
+ /// The base directory for this config - used
+ /// as the application base for loading tests.
+ /// </summary>
+ public string BasePath
+ {
+ get
+ {
+ if ( project == null || project.BasePath == null )
+ return basePath;
+
+ if ( basePath == null )
+ return project.BasePath;
+
+ return Path.Combine( project.BasePath, basePath );
+ }
+ set
+ {
+ if ( BasePath != value )
+ {
+ basePath = value;
+ FireChangedEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// The base path relative to the project base
+ /// </summary>
+ public string RelativeBasePath
+ {
+ get
+ {
+ if ( project == null || basePath == null || !Path.IsPathRooted( basePath ) )
+ return basePath;
+
+ return PathUtils.RelativePath( project.BasePath, basePath );
+ }
+ }
+
+ private bool ConfigurationFileSpecified
+ {
+ get { return configFile != null; }
+ }
+
+ public string ConfigurationFile
+ {
+ get
+ {
+ return configFile == null && project != null
+ ? project.ConfigurationFile
+ : configFile;
+ }
+ set
+ {
+ if ( ConfigurationFile != value )
+ {
+ configFile = value;
+ FireChangedEvent();
+ }
+ }
+ }
+
+ public string ConfigurationFilePath
+ {
+ get
+ {
+ return BasePath != null && ConfigurationFile != null
+ ? Path.Combine( BasePath, ConfigurationFile )
+ : ConfigurationFile;
+ }
+ }
+
+ private bool PrivateBinPathSpecified
+ {
+ get { return binPath != null; }
+ }
+
+ /// <summary>
+ /// The Path.PathSeparator-separated path containing all the
+ /// assemblies in the list.
+ /// </summary>
+ public string PrivateBinPath
+ {
+ get { return binPath; }
+ set
+ {
+ if ( binPath != value )
+ {
+ binPath = value;
+ binPathType = binPath == null ? BinPathType.Auto : BinPathType.Manual;
+ FireChangedEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// How our PrivateBinPath is generated
+ /// </summary>
+ public BinPathType BinPathType
+ {
+ get { return binPathType; }
+ set
+ {
+ if ( binPathType != value )
+ {
+ binPathType = value;
+ FireChangedEvent();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Return our AssemblyList
+ /// </summary>
+ public AssemblyList Assemblies
+ {
+ get { return assemblies; }
+ }
+ #endregion
+
+ public TestPackage MakeTestPackage()
+ {
+ TestPackage package = new TestPackage( project.ProjectPath );
+
+ if ( !project.IsAssemblyWrapper )
+ foreach ( string assembly in this.Assemblies )
+ package.Assemblies.Add( assembly );
+
+ if ( this.BasePathSpecified || this.PrivateBinPathSpecified || this.ConfigurationFileSpecified )
+ {
+ package.BasePath = this.BasePath;
+ package.PrivateBinPath = this.PrivateBinPath;
+ package.ConfigurationFile = this.ConfigurationFile;
+ }
+
+ package.AutoBinPath = this.BinPathType == BinPathType.Auto;
+
+ return package;
+ }
+
+ private void assemblies_Changed( object sender, EventArgs e )
+ {
+ FireChangedEvent();
+ }
+
+ private void FireChangedEvent()
+ {
+ if ( Changed != null )
+ Changed( this, EventArgs.Empty );
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ProjectConfigCollection.cs b/mcs/nunit24/ClientUtilities/util/ProjectConfigCollection.cs
new file mode 100644
index 00000000000..6566d83a2e3
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ProjectConfigCollection.cs
@@ -0,0 +1,103 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for ProjectConfigCollection.
+ /// </summary>
+ public class ProjectConfigCollection : CollectionBase
+ {
+ protected NUnitProject project;
+
+ public ProjectConfigCollection( NUnitProject project )
+ {
+ this.project = project;
+ }
+
+ #region Properties
+ public ProjectConfig this[int index]
+ {
+ get { return (ProjectConfig)InnerList[index]; }
+ }
+
+ public ProjectConfig this[string name]
+ {
+ get
+ {
+ int index = IndexOf( name );
+ return index >= 0 ? (ProjectConfig)InnerList[index]: null;
+ }
+ }
+ #endregion
+
+ #region Methods
+ public void Add( ProjectConfig config )
+ {
+ List.Add( config );
+ config.Project = this.project;
+ config.Changed += new EventHandler(config_Changed);
+ }
+
+ public void Add( string name )
+ {
+ Add( new ProjectConfig( name ) );
+ }
+
+ public void Remove( string name )
+ {
+ int index = IndexOf( name );
+ if ( index >= 0 )
+ {
+ RemoveAt( index );
+ }
+ }
+
+ private int IndexOf( string name )
+ {
+ for( int index = 0; index < InnerList.Count; index++ )
+ {
+ ProjectConfig config = (ProjectConfig)InnerList[index];
+ if( config.Name == name )
+ return index;
+ }
+
+ return -1;
+ }
+
+ public bool Contains( ProjectConfig config )
+ {
+ return InnerList.Contains( config );
+ }
+
+ public bool Contains( string name )
+ {
+ return IndexOf( name ) >= 0;
+ }
+
+ protected override void OnRemoveComplete( int index, object obj )
+ {
+ ProjectConfig config = obj as ProjectConfig;
+ this.project.OnProjectChange( ProjectChangeType.RemoveConfig, config.Name );
+ }
+
+ protected override void OnInsertComplete( int index, object obj )
+ {
+ ProjectConfig config = obj as ProjectConfig;
+ project.OnProjectChange( ProjectChangeType.AddConfig, config.Name );
+ }
+
+ private void config_Changed(object sender, EventArgs e)
+ {
+ ProjectConfig config = sender as ProjectConfig;
+ project.OnProjectChange( ProjectChangeType.UpdateConfig, config.Name );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ProjectFormatException.cs b/mcs/nunit24/ClientUtilities/util/ProjectFormatException.cs
new file mode 100644
index 00000000000..964f8edfa85
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ProjectFormatException.cs
@@ -0,0 +1,58 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Exception raised when loading a project file with
+ /// an invalid format.
+ /// </summary>
+ public class ProjectFormatException : ApplicationException
+ {
+ #region Instance Variables
+
+ private int lineNumber;
+
+ private int linePosition;
+
+ #endregion
+
+ #region Constructors
+
+ public ProjectFormatException() : base() {}
+
+ public ProjectFormatException( string message )
+ : base( message ) {}
+
+ public ProjectFormatException( string message, Exception inner )
+ : base( message, inner ) {}
+
+ public ProjectFormatException( string message, int lineNumber, int linePosition )
+ : base( message )
+ {
+ this.lineNumber = lineNumber;
+ this.linePosition = linePosition;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public int LineNumber
+ {
+ get { return lineNumber; }
+ }
+
+ public int LinePosition
+ {
+ get { return linePosition; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ProxyTestRunner.cs b/mcs/nunit24/ClientUtilities/util/ProxyTestRunner.cs
new file mode 100644
index 00000000000..e41a7334e37
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ProxyTestRunner.cs
@@ -0,0 +1,179 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+ using NUnit.Core;
+
+ /// <summary>
+ /// ProxyTestRunner is the abstract base for all client-side
+ /// TestRunner implementations that delegate to a remote
+ /// TestRunner. All calls are simply passed on to the
+ /// TestRunner that is provided to the constructor.
+ ///
+ /// This class is similar to DelegatingTestRunner in the
+ /// NUnit core, but is separate because of how it is used.
+ ///
+ /// Although the class is abstract, it has no abstract
+ /// methods specified because each implementation will
+ /// need to override different methods. All methods are
+ /// specified using interface syntax and the derived class
+ /// must explicitly implement TestRunner in order to
+ /// redefine the selected methods.
+ /// </summary>
+ public abstract class ProxyTestRunner : TestRunner
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// Our runner ID
+ /// </summary>
+ protected int runnerID;
+
+ /// <summary>
+ /// The downstream TestRunner
+ /// </summary>
+ private TestRunner testRunner;
+
+ /// <summary>
+ /// The event listener for the currently running test
+ /// </summary>
+ protected EventListener listener;
+
+ #endregion
+
+ #region Construction
+ public ProxyTestRunner(TestRunner testRunner)
+ {
+ this.testRunner = testRunner;
+ this.runnerID = testRunner.ID;
+ }
+
+ /// <summary>
+ /// Protected constructor for runners that create their own
+ /// specialized downstream runner.
+ /// </summary>
+ protected ProxyTestRunner( int runnerID )
+ {
+ this.runnerID = runnerID;
+ }
+ #endregion
+
+ #region Properties
+ public virtual int ID
+ {
+ get { return runnerID; }
+ }
+
+ public virtual bool Running
+ {
+ get { return testRunner != null && testRunner.Running; }
+ }
+
+ public virtual IList AssemblyInfo
+ {
+ get { return testRunner == null ? null : testRunner.AssemblyInfo; }
+ }
+
+ public virtual ITest Test
+ {
+ get { return testRunner == null ? null : testRunner.Test; }
+ }
+
+ public virtual TestResult TestResult
+ {
+ get { return testRunner == null ? null : testRunner.TestResult; }
+ }
+
+ /// <summary>
+ /// Protected property copies any settings to the downstream test runner
+ /// when it is set. Derived runners overriding this should call the base
+ /// or copy the settings themselves.
+ /// </summary>
+ protected virtual TestRunner TestRunner
+ {
+ get { return testRunner; }
+ set { testRunner = value; }
+ }
+ #endregion
+
+ #region Load and Unload Methods
+ public virtual bool Load( TestPackage package )
+ {
+ return this.testRunner.Load( package );
+ }
+
+ public virtual void Unload()
+ {
+ if ( this.testRunner != null )
+ this.testRunner.Unload();
+ }
+ #endregion
+
+ #region CountTestCases
+ public virtual int CountTestCases( ITestFilter filter )
+ {
+ return this.testRunner.CountTestCases( filter );
+ }
+ #endregion
+
+ #region Methods for Running Tests
+ public virtual TestResult Run(EventListener listener)
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ return this.testRunner.Run(listener);
+ }
+
+ public virtual TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ return this.testRunner.Run(listener, filter);
+ }
+
+ public virtual void BeginRun( EventListener listener )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ this.testRunner.BeginRun( listener );
+ }
+
+ public virtual void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ this.testRunner.BeginRun( listener, filter );
+ }
+
+ public virtual TestResult EndRun()
+ {
+ return this.testRunner.EndRun();
+ }
+
+ public virtual void CancelRun()
+ {
+ this.testRunner.CancelRun();
+ }
+
+ public virtual void Wait()
+ {
+ this.testRunner.Wait();
+ }
+ #endregion
+
+ #region InitializeLifetimeService Override
+// public override object InitializeLifetimeService()
+// {
+// return null;
+// }
+ #endregion
+
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/RecentFileEntry.cs b/mcs/nunit24/ClientUtilities/util/RecentFileEntry.cs
new file mode 100644
index 00000000000..0813fd7d76c
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/RecentFileEntry.cs
@@ -0,0 +1,74 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ public class RecentFileEntry
+ {
+ public static readonly char Separator = ',';
+
+ private string path;
+
+ private Version clrVersion;
+
+ public RecentFileEntry( string path )
+ {
+ this.path = path;
+ this.clrVersion = Environment.Version;
+ }
+
+ public RecentFileEntry( string path, Version clrVersion )
+ {
+ this.path = path;
+ this.clrVersion = clrVersion;
+ }
+
+ public string Path
+ {
+ get { return path; }
+ }
+
+ public Version CLRVersion
+ {
+ get { return clrVersion; }
+ }
+
+ public bool Exists
+ {
+ get { return path != null && System.IO.File.Exists( path ); }
+ }
+
+ public bool IsCompatibleCLRVersion
+ {
+ get { return clrVersion.Major <= Environment.Version.Major; }
+ }
+
+ public override string ToString()
+ {
+ return Path + Separator + CLRVersion.ToString();
+ }
+
+ public static RecentFileEntry Parse( string text )
+ {
+ int sepIndex = text.LastIndexOf( Separator );
+
+ if ( sepIndex > 0 )
+ try
+ {
+ return new RecentFileEntry( text.Substring( 0, sepIndex ),
+ new Version( text.Substring( sepIndex + 1 ) ) );
+ }
+ catch
+ {
+ //The last part was not a version, so fall through and return the whole text
+ }
+
+ return new RecentFileEntry( text );
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/RecentFiles.cs b/mcs/nunit24/ClientUtilities/util/RecentFiles.cs
new file mode 100644
index 00000000000..62bc7ff8589
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/RecentFiles.cs
@@ -0,0 +1,55 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// The RecentFiles interface is used to isolate the app
+ /// from various implementations of recent files.
+ /// </summary>
+ public interface RecentFiles
+ {
+ /// <summary>
+ /// The max number of files saved
+ /// </summary>
+ int MaxFiles { get; set; }
+
+ /// <summary>
+ /// The current number of saved files
+ /// </summary>
+ int Count { get; }
+
+ /// <summary>
+ /// Get a list of all the file entries
+ /// </summary>
+ /// <returns>The most recent file list</returns>
+ RecentFilesCollection Entries { get; }
+
+ /// <summary>
+ /// Set the most recent file entry, reordering
+ /// the saved names as needed and removing the oldest
+ /// if the max number of files would be exceeded.
+ /// </summary>
+ void SetMostRecent( RecentFileEntry entry );
+
+ /// <summary>
+ /// Set the most recent file name, reordering
+ /// the saved names as needed and removing the oldest
+ /// if the max number of files would be exceeded.
+ /// The current CLR version is used to create the entry.
+ /// </summary>
+ void SetMostRecent( string fileName );
+
+ /// <summary>
+ /// Remove a file from the list
+ /// </summary>
+ /// <param name="fileName">The name of the file to remove</param>
+ void Remove( string fileName );
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/RecentFilesCollection.cs b/mcs/nunit24/ClientUtilities/util/RecentFilesCollection.cs
new file mode 100644
index 00000000000..317406709e8
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/RecentFilesCollection.cs
@@ -0,0 +1,57 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for RecentFilesCollection.
+ /// </summary>
+ public class RecentFilesCollection : ReadOnlyCollectionBase
+ {
+ public void Add( RecentFileEntry entry )
+ {
+ InnerList.Add( entry );
+ }
+
+ public void Insert( int index, RecentFileEntry entry )
+ {
+ InnerList.Insert( index, entry );
+ }
+
+ public void Remove( string fileName )
+ {
+ int index = IndexOf( fileName );
+ if ( index != -1 )
+ RemoveAt( index );
+ }
+
+ public void RemoveAt( int index )
+ {
+ InnerList.RemoveAt( index );
+ }
+
+ public int IndexOf( string fileName )
+ {
+ for( int index = 0; index < InnerList.Count; index++ )
+ if ( this[index].Path == fileName )
+ return index;
+ return -1;
+ }
+
+ public RecentFileEntry this[int index]
+ {
+ get { return (RecentFileEntry)InnerList[index]; }
+ }
+
+ public void Clear()
+ {
+ InnerList.Clear();
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/RegistrySettingsStorage.cs b/mcs/nunit24/ClientUtilities/util/RegistrySettingsStorage.cs
new file mode 100644
index 00000000000..07f0e88b353
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/RegistrySettingsStorage.cs
@@ -0,0 +1,167 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Diagnostics;
+using Microsoft.Win32;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Implementation of SettingsStorage for NUnit user settings,
+ /// based on storage of settings in the registry.
+ ///
+ /// Setting names containing a dot are interpreted as a
+ /// reference to a subkey. Only the first dot is used
+ /// in this way, since the feature is only intended
+ /// to support legacy registry settings, which are not
+ /// nested any deeper.
+ /// </summary>
+ public class RegistrySettingsStorage : ISettingsStorage
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// If not null, the registry key for this storage
+ /// </summary>
+ private RegistryKey storageKey;
+
+ #endregion
+
+ #region Construction and Disposal
+
+ /// <summary>
+ /// Construct a storage on top of a pre-created registry key
+ /// </summary>
+ /// <param name="storageKey"></param>
+ public RegistrySettingsStorage( RegistryKey storageKey )
+ {
+ this.storageKey = storageKey;
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// The registry key used to hold this storage
+ /// </summary>
+ public RegistryKey StorageKey
+ {
+ get { return storageKey; }
+ }
+
+ #endregion
+
+ #region ISettingsStorage Members
+
+ /// <summary>
+ /// Load a setting from this storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <returns>Value of the setting</returns>
+ public object GetSetting( string settingName )
+ {
+ int dot = settingName.IndexOf( '.' );
+ if ( dot < 0 )
+ return storageKey.GetValue( settingName );
+
+ using( RegistryKey subKey = storageKey.OpenSubKey( settingName.Substring( 0, dot ) ) )
+ {
+ if ( subKey != null )
+ return subKey.GetValue( settingName.Substring( dot + 1 ) );
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Remove a setting from the storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to remove</param>
+ public void RemoveSetting( string settingName )
+ {
+ int dot = settingName.IndexOf( '.' );
+ if ( dot < 0 )
+ storageKey.DeleteValue( settingName, false );
+ else
+ {
+ using( RegistryKey subKey = storageKey.OpenSubKey( settingName.Substring( 0, dot ), true ) )
+ {
+ if ( subKey != null )
+ subKey.DeleteValue( settingName.Substring( dot + 1 ) );
+ }
+ }
+ }
+
+ public void RemoveGroup( string groupName )
+ {
+ storageKey.DeleteSubKeyTree( groupName );
+ }
+
+ /// <summary>
+ /// Save a setting in this storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to save</param>
+ /// <param name="settingValue">Value to be saved</param>
+ public void SaveSetting( string settingName, object settingValue )
+ {
+ object val = settingValue;
+ if ( val is bool )
+ val = ((bool)val) ? 1 : 0;
+
+ int dot = settingName.IndexOf( '.' );
+ if ( dot < 0 )
+ storageKey.SetValue( settingName, val );
+ else
+ {
+ using( RegistryKey subKey = storageKey.CreateSubKey( settingName.Substring( 0, dot ) ) )
+ {
+ subKey.SetValue( settingName.Substring( dot + 1 ), val );
+ }
+ }
+ }
+
+ /// <summary>
+ /// Make a new child storage under this one
+ /// </summary>
+ /// <param name="storageName">Name of the child storage to make</param>
+ /// <returns>New storage</returns>
+ public ISettingsStorage MakeChildStorage( string storageName )
+ {
+ return new RegistrySettingsStorage( storageKey.CreateSubKey( storageName ) );
+ }
+
+ /// <summary>
+ /// LoadSettings does nothing in this implementation, since the
+ /// registry is accessed directly.
+ /// </summary>
+ public void LoadSettings()
+ {
+ }
+
+ /// <summary>
+ /// SaveSettings does nothing in this implementation, since the
+ /// registry is accessed directly.
+ /// </summary>
+ public void SaveSettings()
+ {
+ }
+ #endregion
+
+ #region IDisposable Members
+ /// <summary>
+ /// Dispose of this object by closing the storage key, if any
+ /// </summary>
+ public void Dispose()
+ {
+ if ( storageKey != null )
+ storageKey.Close();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/RemoteTestAgent.cs b/mcs/nunit24/ClientUtilities/util/RemoteTestAgent.cs
new file mode 100644
index 00000000000..8c2589b996a
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/RemoteTestAgent.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Threading;
+using System.Collections;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// RemoteTestAgent represents a remote agent executing in another process
+ /// and communicating with NUnit by TCP. Although it is similar to a
+ /// TestServer, it does not publish a Uri at which clients may connect
+ /// to it. Rather, it reports back to the sponsoring TestAgency upon
+ /// startup so that the agency may in turn provide it to clients for use.
+ /// </summary>
+ public class RemoteTestAgent : MarshalByRefObject, IDisposable
+ {
+ #region Fields
+ /// <summary>
+ /// Url of the agency that controls this agent
+ /// </summary>
+ string agencyUrl;
+
+ /// <summary>
+ /// Reference to the TestAgency that controls this agent
+ /// </summary>
+ TestAgency agency;
+
+ /// <summary>
+ /// Channel used for communications with the agency
+ /// and with clients
+ /// </summary>
+ private TcpChannel channel;
+
+ /// <summary>
+ /// Lock used to avoid thread contention
+ /// </summary>
+ private object theLock = new object();
+
+ #endregion
+
+ #region Constructor
+ /// <summary>
+ /// Construct a RemoteTestAgent given the Url of its agency
+ /// </summary>
+ /// <param name="agencyUrl"></param>
+ public RemoteTestAgent( string agencyUrl )
+ {
+ this.agencyUrl = agencyUrl;
+ }
+ #endregion
+
+ #region Properties
+ public TestAgency Agency
+ {
+ get { return agency; }
+ }
+
+ public int ProcessId
+ {
+ get { return System.Diagnostics.Process.GetCurrentProcess().Id; }
+ }
+ #endregion
+
+ #region Public Methods - Called By local Agent
+ public TestRunner CreateRunner(int runnerID)
+ {
+ return new TestDomain( runnerID );
+ }
+ #endregion
+
+ #region Public Methods
+ public void Start()
+ {
+ NTrace.Info("Starting");
+ this.channel = ServerUtilities.GetTcpChannel();
+ NTrace.Debug("Acquired Tcp Channel");
+
+ try
+ {
+ this.agency = (TestAgency)Activator.GetObject( typeof( TestAgency ), agencyUrl );
+ NTrace.DebugFormat("Connected to TestAgency at {0}", agencyUrl);
+ }
+ catch( Exception ex )
+ {
+ NTrace.ErrorFormat( "Unable to connect to test agency at {0}", agencyUrl );
+ NTrace.Error( ex.Message );
+ }
+
+ try
+ {
+ this.agency.Register( this, ProcessId );
+ NTrace.Debug( "Registered with TestAgency" );
+ }
+ catch( Exception ex )
+ {
+ NTrace.Error( "Failed to register with TestAgency", ex );
+ }
+ }
+
+ [System.Runtime.Remoting.Messaging.OneWay]
+ public void Stop()
+ {
+ NTrace.Info( "Stopping" );
+ lock( theLock )
+ {
+ if ( this.channel != null )
+ ChannelServices.UnregisterChannel( this.channel );
+ Monitor.PulseAll( theLock );
+ }
+ }
+
+ public void WaitForStop()
+ {
+ lock( theLock )
+ {
+ Monitor.Wait( theLock );
+ }
+ }
+ #endregion
+
+ #region IDisposable Members
+
+ public void Dispose()
+ {
+ this.Stop();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ResultSummarizer.cs b/mcs/nunit24/ClientUtilities/util/ResultSummarizer.cs
new file mode 100644
index 00000000000..e48c3063f33
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ResultSummarizer.cs
@@ -0,0 +1,80 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using NUnit.Core;
+
+ /// <summary>
+ /// Summary description for ResultSummarizer.
+ /// </summary>
+ public class ResultSummarizer
+ {
+ private SummaryVisitor visitor = new SummaryVisitor();
+
+ public ResultSummarizer(TestResult result)
+ {
+ result.Accept(visitor);
+ }
+
+ public ResultSummarizer(TestResult[] results)
+ {
+ foreach( TestResult result in results )
+ result.Accept( visitor );
+ }
+
+ public string Name
+ {
+ get { return visitor.Name; }
+ }
+
+ public bool Success
+ {
+ get { return visitor.Success; }
+ }
+
+ public int ResultCount
+ {
+ get { return visitor.ResultCount; }
+ }
+
+// public int Errors
+// {
+// get { return visitor.Errors; }
+// }
+
+ public int FailureCount
+ {
+ get { return visitor.FailureCount; }
+ }
+
+ public int SkipCount
+ {
+ get { return visitor.SkipCount; }
+ }
+
+ public int IgnoreCount
+ {
+ get { return visitor.IgnoreCount; }
+ }
+
+ public double Time
+ {
+ get { return visitor.Time; }
+ }
+
+ public int TestsNotRun
+ {
+ get { return visitor.TestsNotRun; }
+ }
+
+ public int SuitesNotRun
+ {
+ get { return visitor.SuitesNotRun; }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ServerBase.cs b/mcs/nunit24/ClientUtilities/util/ServerBase.cs
new file mode 100644
index 00000000000..19782be0bd1
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ServerBase.cs
@@ -0,0 +1,89 @@
+using System;
+using System.Threading;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Services;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for ServerBase.
+ /// </summary>
+ public abstract class ServerBase : MarshalByRefObject, IDisposable
+ {
+ protected string uri;
+ protected int port;
+
+ private TcpChannel channel;
+ private bool isMarshalled;
+
+ private object theLock = new object();
+
+ protected ServerBase()
+ {
+ }
+
+ /// <summary>
+ /// Constructor used to provide
+ /// </summary>
+ /// <param name="uri"></param>
+ /// <param name="port"></param>
+ protected ServerBase(string uri, int port)
+ {
+ this.uri = uri;
+ this.port = port;
+ }
+
+ public virtual void Start()
+ {
+ if ( uri != null && uri != string.Empty )
+ lock( theLock )
+ {
+ this.channel = ServerUtilities.GetTcpChannel( uri + "Channel", port, 100 );
+
+ RemotingServices.Marshal( this, uri );
+ this.isMarshalled = true;
+ }
+ }
+
+ [System.Runtime.Remoting.Messaging.OneWay]
+ public virtual void Stop()
+ {
+ lock( theLock )
+ {
+ if ( this.isMarshalled )
+ {
+ RemotingServices.Disconnect( this );
+ this.isMarshalled = false;
+ }
+
+ if ( this.channel != null )
+ {
+ ChannelServices.UnregisterChannel( this.channel );
+ this.channel = null;
+ }
+
+ Monitor.PulseAll( theLock );
+ }
+ }
+
+ public void WaitForStop()
+ {
+ lock( theLock )
+ {
+ Monitor.Wait( theLock );
+ }
+ }
+
+ #region IDisposable Members
+
+ public void Dispose()
+ {
+ this.Stop();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/ServerUtilities.cs b/mcs/nunit24/ClientUtilities/util/ServerUtilities.cs
new file mode 100644
index 00000000000..5f779a52f41
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/ServerUtilities.cs
@@ -0,0 +1,128 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using System.Reflection;
+using System.Diagnostics;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for RemotingUtilities.
+ /// </summary>
+ public class ServerUtilities
+ {
+ /// <summary>
+ /// Create a TcpChannel with a given name, on a given port.
+ /// </summary>
+ /// <param name="port"></param>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ private static TcpChannel CreateTcpChannel( string name, int port, int limit )
+ {
+ ListDictionary props = new ListDictionary();
+ props.Add( "port", port );
+ props.Add( "name", name );
+ props.Add( "bindTo", "127.0.0.1" );
+
+ BinaryServerFormatterSinkProvider serverProvider =
+ new BinaryServerFormatterSinkProvider();
+
+ // NOTE: TypeFilterLevel and "clientConnectionLimit" property don't exist in .NET 1.0.
+ Type typeFilterLevelType = typeof(object).Assembly.GetType("System.Runtime.Serialization.Formatters.TypeFilterLevel");
+ if (typeFilterLevelType != null)
+ {
+ PropertyInfo typeFilterLevelProperty = serverProvider.GetType().GetProperty("TypeFilterLevel");
+ object typeFilterLevel = Enum.Parse(typeFilterLevelType, "Full");
+ typeFilterLevelProperty.SetValue(serverProvider, typeFilterLevel, null);
+
+ props.Add("clientConnectionLimit", limit);
+ }
+
+ BinaryClientFormatterSinkProvider clientProvider =
+ new BinaryClientFormatterSinkProvider();
+
+ return new TcpChannel( props, clientProvider, serverProvider );
+ }
+
+ public static TcpChannel GetTcpChannel()
+ {
+ return GetTcpChannel( "", 0, 2 );
+ }
+
+ /// <summary>
+ /// Get a channel by name, casting it to a TcpChannel.
+ /// Otherwise, create, register and return a TcpChannel with
+ /// that name, on the port provided as the second argument.
+ /// </summary>
+ /// <param name="name">The channel name</param>
+ /// <param name="port">The port to use if the channel must be created</param>
+ /// <returns>A TcpChannel or null</returns>
+ public static TcpChannel GetTcpChannel( string name, int port )
+ {
+ return GetTcpChannel( name, port, 2 );
+ }
+
+ /// <summary>
+ /// Get a channel by name, casting it to a TcpChannel.
+ /// Otherwise, create, register and return a TcpChannel with
+ /// that name, on the port provided as the second argument.
+ /// </summary>
+ /// <param name="name">The channel name</param>
+ /// <param name="port">The port to use if the channel must be created</param>
+ /// <param name="limit">The client connection limit or negative for the default</param>
+ /// <returns>A TcpChannel or null</returns>
+ public static TcpChannel GetTcpChannel( string name, int port, int limit )
+ {
+ TcpChannel channel = ChannelServices.GetChannel( name ) as TcpChannel;
+
+ if ( channel == null )
+ {
+ // NOTE: Retries are normally only needed when rapidly creating
+ // and destroying channels, as in running the NUnit tests.
+ int retries = 10;
+ while( --retries > 0 )
+ try
+ {
+ channel = CreateTcpChannel( name, port, limit );
+ ChannelServices.RegisterChannel( channel );
+ break;
+ }
+ catch( Exception e )
+ {
+ Trace.WriteLine(e);
+ System.Threading.Thread.Sleep(300);
+ }
+ }
+
+ return channel;
+ }
+
+ public static void SafeReleaseChannel( IChannel channel )
+ {
+ if( channel != null )
+ try
+ {
+ ChannelServices.UnregisterChannel( channel );
+ }
+ catch( RemotingException )
+ {
+ // Channel was not registered - ignore
+ }
+ }
+
+ public static string MakeUrl( string uri, int port )
+ {
+ return string.Format( "tcp://127.0.0.1:{0}/{1}", port, uri );
+ }
+
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services.cs b/mcs/nunit24/ClientUtilities/util/Services.cs
new file mode 100644
index 00000000000..99dd1446109
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services.cs
@@ -0,0 +1,130 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using NUnit.Core;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for Services
+ /// </summary>
+ public class Services
+ {
+ #region AddinManager
+ private static AddinManager addinManager;
+ public static AddinManager AddinManager
+ {
+ get
+ {
+ if (addinManager == null )
+ addinManager = (AddinManager)ServiceManager.Services.GetService( typeof( AddinManager ) );
+
+ return addinManager;
+ }
+ }
+ #endregion
+
+ #region AddinRegistry
+ private static IAddinRegistry addinRegistry;
+ public static IAddinRegistry AddinRegistry
+ {
+ get
+ {
+ if (addinRegistry == null)
+ addinRegistry = (IAddinRegistry)ServiceManager.Services.GetService( typeof( IAddinRegistry ) );
+
+ return addinRegistry;
+ }
+ }
+ #endregion
+
+ #region DomainManager
+ private static DomainManager domainManager;
+ public static DomainManager DomainManager
+ {
+ get
+ {
+ if ( domainManager == null )
+ domainManager = (DomainManager)ServiceManager.Services.GetService( typeof( DomainManager ) );
+
+ return domainManager;
+ }
+ }
+ #endregion
+
+ #region UserSettings
+ private static SettingsService userSettings;
+ public static SettingsService UserSettings
+ {
+ get
+ {
+ if ( userSettings == null )
+ userSettings = (SettingsService)ServiceManager.Services.GetService( typeof( SettingsService ) );
+
+ // Temporary fix needed to run TestDomain tests in test AppDomain
+ // TODO: Figure out how to set up the test domain correctly
+ if ( userSettings == null )
+ userSettings = new SettingsService();
+
+ return userSettings;
+ }
+ }
+
+ #endregion
+
+ #region RecentFilesService
+ private static RecentFiles recentFiles;
+ public static RecentFiles RecentFiles
+ {
+ get
+ {
+ if ( recentFiles == null )
+ recentFiles = (RecentFiles)ServiceManager.Services.GetService( typeof( RecentFiles ) );
+
+ return recentFiles;
+ }
+ }
+ #endregion
+
+ #region TestLoader
+ private static TestLoader loader;
+ public static TestLoader TestLoader
+ {
+ get
+ {
+ if ( loader == null )
+ loader = (TestLoader)ServiceManager.Services.GetService( typeof( TestLoader ) );
+
+ return loader;
+ }
+ }
+ #endregion
+
+ #region TestAgency
+ private static TestAgency agency;
+ public static TestAgency TestAgency
+ {
+ get
+ {
+ if ( agency == null )
+ agency = (TestAgency)ServiceManager.Services.GetService( typeof( TestAgency ) );
+
+ // Temporary fix needed to run ProcessRunner tests in test AppDomain
+ // TODO: Figure out how to set up the test domain correctly
+// if ( agency == null )
+// {
+// agency = new TestAgency();
+// agency.Start();
+// }
+
+ return agency;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/AddinManager.cs b/mcs/nunit24/ClientUtilities/util/Services/AddinManager.cs
new file mode 100644
index 00000000000..d28b75c6f31
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/AddinManager.cs
@@ -0,0 +1,93 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Collections;
+using System.Reflection;
+using NUnit.Core;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Util
+{
+ public class AddinManager : IService
+ {
+ #region Instance Fields
+ IAddinRegistry addinRegistry;
+ #endregion
+
+ #region Constructor
+ public AddinManager()
+ {
+ }
+ #endregion
+
+ #region Addin Registration
+ public void RegisterAddins()
+ {
+ //Figure out the directory from which NUnit is executing
+ string moduleName = TestFixtureBuilder.GetAssemblyPath( GetType().Assembly );
+ //string moduleName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
+ string nunitDirPath = Path.GetDirectoryName( moduleName );
+ string coreExtensions = Path.Combine( nunitDirPath, "nunit.core.extensions.dll" );
+ string addinsDirPath = Path.Combine( nunitDirPath, "addins" );
+
+ // Load nunit.core.extensions if available
+ if ( File.Exists( coreExtensions ) )
+ Register( coreExtensions );
+
+ // Load any extensions in the addins directory
+ DirectoryInfo dir = new DirectoryInfo( addinsDirPath );
+ if ( dir.Exists )
+ foreach( FileInfo file in dir.GetFiles( "*.dll" ) )
+ Register( file.FullName );
+ }
+
+ public void Register( string path )
+ {
+ try
+ {
+ AssemblyName assemblyName = new AssemblyName();
+ assemblyName.Name = Path.GetFileNameWithoutExtension(path);
+ assemblyName.CodeBase = path;
+ Assembly assembly = Assembly.Load(assemblyName);
+ NTrace.Debug( "Loaded " + Path.GetFileName(path) );
+
+ foreach ( Type type in assembly.GetExportedTypes() )
+ {
+ if ( type.GetCustomAttributes(typeof(NUnitAddinAttribute), false).Length == 1 )
+ {
+ Addin addin = new Addin( type );
+ addinRegistry.Register( addin );
+ NTrace.Debug( "Registered addin: " + addin.Name );
+ }
+ }
+ }
+ catch( Exception ex )
+ {
+ // NOTE: Since the gui isn't loaded at this point,
+ // the trace output will only show up in Visual Studio
+ NTrace.Error( "Failed to load" + path, ex );
+ }
+ }
+ #endregion
+
+ #region IService Members
+
+ public void InitializeService()
+ {
+ addinRegistry = Services.AddinRegistry;
+ RegisterAddins();
+ }
+
+ public void UnloadService()
+ {
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/AddinRegistry.cs b/mcs/nunit24/ClientUtilities/util/Services/AddinRegistry.cs
new file mode 100644
index 00000000000..ba2bf27c474
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/AddinRegistry.cs
@@ -0,0 +1,60 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Reflection;
+using NUnit.Core;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for AddinRegistry.
+ /// </summary>
+ public class AddinRegistry : MarshalByRefObject, IAddinRegistry, IService
+ {
+ #region Instance Fields
+ private ArrayList addins = new ArrayList();
+ #endregion
+
+ #region IAddinRegistry Members
+
+ public void Register(Addin addin)
+ {
+ addins.Add( addin );
+ }
+
+ public IList Addins
+ {
+ get
+ {
+ return addins;
+ }
+ }
+
+ public void SetStatus( string name, AddinStatus status, string message )
+ {
+ foreach( Addin addin in addins )
+ if ( addin.Name == name )
+ {
+ addin.Status = status;
+ addin.Message = message;
+ }
+ }
+ #endregion
+
+ #region IService Members
+ public void InitializeService()
+ {
+ }
+
+ public void UnloadService()
+ {
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/DomainManager.cs b/mcs/nunit24/ClientUtilities/util/Services/DomainManager.cs
new file mode 100644
index 00000000000..a3ad033837b
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/DomainManager.cs
@@ -0,0 +1,261 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Text;
+using System.Configuration;
+using System.Diagnostics;
+using System.Security.Policy;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// The DomainManager class handles the creation and unloading
+ /// of domains as needed and keeps track of all existing domains.
+ /// </summary>
+ public class DomainManager : IService
+ {
+ #region Properties
+ private static string shadowCopyPath;
+ public static string ShadowCopyPath
+ {
+ get
+ {
+ if ( shadowCopyPath == null )
+ {
+ shadowCopyPath = ConfigurationSettings.AppSettings["shadowfiles.path"];
+ if ( shadowCopyPath == "" || shadowCopyPath== null )
+ shadowCopyPath = Path.Combine( Path.GetTempPath(), @"nunit20\ShadowCopyCache" );
+ else
+ shadowCopyPath = Environment.ExpandEnvironmentVariables(shadowCopyPath);
+ }
+
+ return shadowCopyPath;
+ }
+ }
+ #endregion
+
+ #region Create and Unload Domains
+ /// <summary>
+ /// Construct an application domain for running a test package
+ /// </summary>
+ /// <param name="package">The TestPackage to be run</param>
+ public AppDomain CreateDomain( TestPackage package )
+ {
+ FileInfo testFile = new FileInfo( package.FullName );
+
+ AppDomainSetup setup = new AppDomainSetup();
+
+ // We always use the same application name
+ setup.ApplicationName = "Tests";
+
+ string appBase = package.BasePath;
+ if ( appBase == null || appBase == string.Empty )
+ appBase = testFile.DirectoryName;
+ setup.ApplicationBase = appBase;
+
+ string configFile = package.ConfigurationFile;
+ if ( configFile == null || configFile == string.Empty )
+ configFile = NUnitProject.IsProjectFile(testFile.Name)
+ ? Path.GetFileNameWithoutExtension( testFile.Name ) + ".config"
+ : testFile.Name + ".config";
+ // Note: Mono needs full path to config file...
+ setup.ConfigurationFile = Path.Combine( appBase, configFile );
+
+ string binPath = package.PrivateBinPath;
+ if ( package.AutoBinPath )
+ binPath = GetPrivateBinPath( appBase, package.Assemblies );
+ setup.PrivateBinPath = binPath;
+
+ if ( package.GetSetting( "ShadowCopyFiles", true ) )
+ {
+ setup.ShadowCopyFiles = "true";
+ setup.ShadowCopyDirectories = appBase;
+ setup.CachePath = GetCachePath();
+ }
+
+ string domainName = "domain-" + package.Name;
+ Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
+ Evidence evidence = new Evidence(baseEvidence);
+ AppDomain runnerDomain = AppDomain.CreateDomain(domainName, evidence, setup);
+
+ // Inject assembly resolver into remote domain to help locate our assemblies
+ AssemblyResolver assemblyResolver = (AssemblyResolver)runnerDomain.CreateInstanceFromAndUnwrap(
+ typeof(AssemblyResolver).Assembly.CodeBase,
+ typeof(AssemblyResolver).FullName);
+
+ // Tell resolver to use our core assemblies in the test domain
+ assemblyResolver.AddFile( typeof( NUnit.Core.RemoteTestRunner ).Assembly.Location );
+ assemblyResolver.AddFile( typeof( NUnit.Core.ITest ).Assembly.Location );
+
+// No reference to extensions, so we do it a different way
+ string moduleName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
+ string nunitDirPath = Path.GetDirectoryName(moduleName);
+// string coreExtensions = Path.Combine(nunitDirPath, "nunit.core.extensions.dll");
+// assemblyResolver.AddFile( coreExtensions );
+ //assemblyResolver.AddFiles( nunitDirPath, "*.dll" );
+
+ string addinsDirPath = Path.Combine(nunitDirPath, "addins");
+ assemblyResolver.AddDirectory( addinsDirPath );
+
+ // HACK: Only pass down our AddinRegistry one level so that tests of NUnit
+ // itself start without any addins defined.
+ if ( !IsTestDomain( AppDomain.CurrentDomain ) )
+ runnerDomain.SetData("AddinRegistry", Services.AddinRegistry);
+
+ return runnerDomain;
+ }
+
+ public void Unload( AppDomain domain )
+ {
+ bool shadowCopy = domain.ShadowCopyFiles;
+ string cachePath = domain.SetupInformation.CachePath;
+ string domainName = domain.FriendlyName;
+
+ try
+ {
+ AppDomain.Unload(domain);
+ }
+ catch (Exception ex)
+ {
+ // We assume that the tests did something bad and just leave
+ // the orphaned AppDomain "out there".
+ // TODO: Something useful.
+ Trace.WriteLine("Unable to unload AppDomain {0}", domainName);
+ Trace.WriteLine(ex.ToString());
+ }
+ finally
+ {
+ if (shadowCopy)
+ DeleteCacheDir(new DirectoryInfo(cachePath));
+ }
+ }
+ #endregion
+
+ #region Helper Methods
+ /// <summary>
+ /// Get the location for caching and delete any old cache info
+ /// </summary>
+ private string GetCachePath()
+ {
+ int processId = Process.GetCurrentProcess().Id;
+ long ticks = DateTime.Now.Ticks;
+ string cachePath = Path.Combine( ShadowCopyPath, processId.ToString() + "_" + ticks.ToString() );
+
+ try
+ {
+ DirectoryInfo dir = new DirectoryInfo(cachePath);
+ if(dir.Exists) dir.Delete(true);
+ }
+ catch( Exception ex)
+ {
+ throw new ApplicationException(
+ string.Format( "Invalid cache path: {0}",cachePath ),
+ ex );
+ }
+
+ return cachePath;
+ }
+
+ /// <summary>
+ /// Helper method to delete the cache dir. This method deals
+ /// with a bug that occurs when files are marked read-only
+ /// and deletes each file separately in order to give better
+ /// exception information when problems occur.
+ ///
+ /// TODO: This entire method is problematic. Should we be doing it?
+ /// </summary>
+ /// <param name="cacheDir"></param>
+ private void DeleteCacheDir( DirectoryInfo cacheDir )
+ {
+ // Debug.WriteLine( "Modules:");
+ // foreach( ProcessModule module in Process.GetCurrentProcess().Modules )
+ // Debug.WriteLine( module.ModuleName );
+
+
+ if(cacheDir.Exists)
+ {
+ foreach( DirectoryInfo dirInfo in cacheDir.GetDirectories() )
+ DeleteCacheDir( dirInfo );
+
+ foreach( FileInfo fileInfo in cacheDir.GetFiles() )
+ {
+ fileInfo.Attributes = FileAttributes.Normal;
+ try
+ {
+ fileInfo.Delete();
+ }
+ catch( Exception ex )
+ {
+ Debug.WriteLine( string.Format(
+ "Error deleting {0}, {1}", fileInfo.Name, ex.Message ) );
+ }
+ }
+
+ cacheDir.Attributes = FileAttributes.Normal;
+
+ try
+ {
+ cacheDir.Delete();
+ }
+ catch( Exception ex )
+ {
+ Debug.WriteLine( string.Format(
+ "Error deleting {0}, {1}", cacheDir.Name, ex.Message ) );
+ }
+ }
+ }
+
+ private bool IsTestDomain(AppDomain domain)
+ {
+ return domain.FriendlyName.StartsWith( "domain-" );
+ }
+
+ public static string GetPrivateBinPath( string basePath, IList assemblies )
+ {
+ StringBuilder sb = new StringBuilder(200);
+ ArrayList dirList = new ArrayList();
+
+ foreach( string assembly in assemblies )
+ {
+ string dir = PathUtils.RelativePath( basePath, Path.GetDirectoryName( assembly ) );
+ if ( dir != null && dir != "." && !dirList.Contains( dir ) )
+ {
+ dirList.Add( dir );
+ if ( sb.Length > 0 )
+ sb.Append( Path.PathSeparator );
+ sb.Append( dir );
+ }
+ }
+
+ return sb.Length == 0 ? null : sb.ToString();
+ }
+
+ public static void DeleteShadowCopyPath()
+ {
+ if ( Directory.Exists( ShadowCopyPath ) )
+ Directory.Delete( ShadowCopyPath, true );
+ }
+ #endregion
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ // TODO: Add DomainManager.UnloadService implementation
+ }
+
+ public void InitializeService()
+ {
+ // TODO: Add DomainManager.InitializeService implementation
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/RecentFilesService.cs b/mcs/nunit24/ClientUtilities/util/Services/RecentFilesService.cs
new file mode 100644
index 00000000000..abb198021ff
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/RecentFilesService.cs
@@ -0,0 +1,169 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for RecentFilesService.
+ /// </summary>
+ public class RecentFilesService : RecentFiles, NUnit.Core.IService
+ {
+ private RecentFilesCollection fileEntries = new RecentFilesCollection();
+
+ private ISettings settings;
+
+ public static readonly int MinSize = 1;
+
+ public static readonly int MaxSize = 24;
+
+ public static readonly int DefaultSize = 5;
+
+ #region Constructor
+ public RecentFilesService()
+ : this( Services.UserSettings ) { }
+
+ public RecentFilesService( ISettings settings )
+ {
+ this.settings = settings;
+ }
+ #endregion
+
+ #region Properties
+ public int Count
+ {
+ get { return fileEntries.Count; }
+ }
+
+ public int MaxFiles
+ {
+ get
+ {
+ int size = settings.GetSetting( "RecentProjects.MaxFiles", DefaultSize );
+
+ if ( size < MinSize ) size = MinSize;
+ if ( size > MaxSize ) size = MaxSize;
+
+ return size;
+ }
+ set
+ {
+ int oldSize = MaxFiles;
+ int newSize = value;
+
+ if ( newSize < MinSize ) newSize = MinSize;
+ if ( newSize > MaxSize ) newSize = MaxSize;
+
+ settings.SaveSetting( "RecentProjects.MaxFiles", newSize );
+ if ( newSize < oldSize ) SaveEntriesToSettings( this. settings );
+ }
+ }
+ #endregion
+
+ #region Public Methods
+ public RecentFilesCollection Entries
+ {
+ get
+ {
+ return fileEntries;
+ }
+ }
+
+ public void Remove( string fileName )
+ {
+ fileEntries.Remove( fileName );
+ }
+
+ public void SetMostRecent( string fileName )
+ {
+ SetMostRecent( new RecentFileEntry( fileName ) );
+ }
+
+ public void SetMostRecent( RecentFileEntry entry )
+ {
+ int index = fileEntries.IndexOf(entry.Path);
+
+ if(index != -1)
+ fileEntries.RemoveAt(index);
+
+ fileEntries.Insert( 0, entry );
+ if( fileEntries.Count > MaxFiles )
+ fileEntries.RemoveAt( MaxFiles );
+ }
+ #endregion
+
+ #region Helper Methods for saving and restoring the settings
+ private void LoadEntriesFromSettings( ISettings settings )
+ {
+ fileEntries.Clear();
+
+ string prefix = Environment.Version.Major >= 2
+ ? "RecentProjects.V2"
+ : "RecentProjects.V1";
+
+ for ( int index = 1; index <= MaxFiles; index++ )
+ {
+ string fileSpec = settings.GetSetting( GetRecentFileKey( prefix, index ) ) as string;
+ if ( fileSpec != null ) fileEntries.Add( new RecentFileEntry( fileSpec ) );
+ }
+
+ // Try legacy entries if nothing was found
+ if ( fileEntries.Count == 0 )
+ {
+ for ( int index = 1; index <= MaxFiles; index++ )
+ {
+ string fileSpec = settings.GetSetting( GetRecentFileKey( "RecentProjects", index ) ) as string;
+ if ( fileSpec != null )
+ {
+ RecentFileEntry entry = RecentFileEntry.Parse( fileSpec );
+ if ( entry.CLRVersion.Major <= Environment.Version.Major )
+ fileEntries.Add( entry );
+ }
+ }
+ };
+ }
+
+ private void SaveEntriesToSettings( ISettings settings )
+ {
+ string prefix = Environment.Version.Major >= 2
+ ? "RecentProjects.V2"
+ : "RecentProjects.V1";
+
+ while( fileEntries.Count > MaxFiles )
+ fileEntries.RemoveAt( fileEntries.Count - 1 );
+
+ for( int index = 0; index < MaxSize; index++ )
+ {
+ string keyName = GetRecentFileKey( prefix, index + 1 );
+ if ( index < fileEntries.Count )
+ settings.SaveSetting( keyName, fileEntries[index].Path );
+ else
+ settings.RemoveSetting( keyName );
+ }
+ }
+
+ private string GetRecentFileKey( string prefix, int index )
+ {
+ return string.Format( "{0}.File{1}", prefix, index );
+ }
+ #endregion
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ SaveEntriesToSettings( this.settings );
+ }
+
+ public void InitializeService()
+ {
+ LoadEntriesFromSettings( this.settings );
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/ServiceManager.cs b/mcs/nunit24/ClientUtilities/util/Services/ServiceManager.cs
new file mode 100644
index 00000000000..949e2b7db48
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/ServiceManager.cs
@@ -0,0 +1,82 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for ServiceManger.
+ /// </summary>
+ public class ServiceManager
+ {
+ private ArrayList services = new ArrayList();
+ private Hashtable serviceIndex = new Hashtable();
+
+ private static ServiceManager defaultServiceManager = new ServiceManager();
+
+ public static ServiceManager Services
+ {
+ get { return defaultServiceManager; }
+ }
+
+ public void AddService( IService service )
+ {
+ services.Add( service );
+ NTrace.Debug( "Added " + service.GetType().Name );
+ }
+
+ public IService GetService( Type serviceType )
+ {
+ IService theService = (IService)serviceIndex[serviceType];
+ if ( theService == null )
+ foreach( IService service in services )
+ {
+ // TODO: Does this work on Mono?
+ if( serviceType.IsInstanceOfType( service ) )
+ {
+ serviceIndex[serviceType] = service;
+ theService = service;
+ break;
+ }
+ }
+
+ if ( theService == null )
+ NTrace.Error( string.Format( "Requested service {0} was not found", serviceType.FullName ) );
+ else
+ NTrace.Info( string.Format( "Request for service {0} satisfied by {1}", serviceType.Name, theService.GetType().Name ) );
+
+ return theService;
+ }
+
+ public void InitializeServices()
+ {
+ foreach( IService service in services )
+ {
+ NTrace.Info( "Initializing " + service.GetType().Name );
+ service.InitializeService();
+ }
+ }
+
+ public void StopAllServices()
+ {
+ // Stop services in reverse of initialization order
+ // TODO: Deal with dependencies explicitly
+ int index = services.Count;
+ while( --index >= 0 )
+ ((IService)services[index]).UnloadService();
+ }
+
+ public void ClearServices()
+ {
+ services.Clear();
+ }
+
+ private ServiceManager() { }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/SettingsService.cs b/mcs/nunit24/ClientUtilities/util/Services/SettingsService.cs
new file mode 100644
index 00000000000..8965d5a66e1
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/SettingsService.cs
@@ -0,0 +1,140 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using Microsoft.Win32;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for UserSettingsService.
+ /// </summary>
+ public class SettingsService : SettingsGroup, NUnit.Core.IService
+ {
+ static readonly string applicationDirectory =
+ Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData )
+ + Path.DirectorySeparatorChar + "NUnit" + Path.DirectorySeparatorChar;
+
+ static readonly string settingsFileName = "NUnitSettings.xml";
+
+ public SettingsService()
+ {
+ string settingsFile = System.Configuration.ConfigurationSettings.AppSettings["settingsFile"];
+ if ( settingsFile == null )
+ settingsFile = applicationDirectory + settingsFileName;
+
+ this.storage = new XmlSettingsStorage( settingsFile );
+
+ if ( File.Exists( settingsFile ) )
+ storage.LoadSettings();
+ else
+ ConvertLegacySettings();
+ }
+
+ #region IService Implementation
+ public void InitializeService()
+ {
+ }
+
+ public void UnloadService()
+ {
+ storage.SaveSettings();
+ this.Dispose();
+ }
+ #endregion
+
+ #region ConvertLegacySettings
+ void ConvertLegacySettings()
+ {
+ RegistryKey key = Registry.CurrentUser.OpenSubKey( NUnitRegistry.KEY );
+ if ( key == null )
+ key = Registry.CurrentUser.OpenSubKey( NUnitRegistry.LEGACY_KEY );
+
+ if ( key != null )
+ {
+ using( ISettingsStorage legacyStorage = new RegistrySettingsStorage( key ) )
+ {
+ new LegacySettingsConverter( legacyStorage, storage ).Convert();
+ }
+
+ storage.SaveSettings();
+ }
+ }
+
+ private class LegacySettingsConverter : SettingsGroup
+ {
+ private ISettingsStorage legacy;
+ private ISettingsStorage current;
+
+ public LegacySettingsConverter( ISettingsStorage legacy, ISettingsStorage current )
+ : base( current )
+ {
+ this.legacy = legacy;
+ this.current = current;
+ }
+
+ public void Convert()
+ {
+ Convert( "Form.x-location", "Gui.MainForm.Left" );
+ Convert( "Form.x-location", "Gui.MiniForm.Left" );
+ Convert( "Form.y-location", "Gui.MainForm.Top" );
+ Convert( "Form.y-location", "Gui.MiniForm.Top" );
+ Convert( "Form.width", "Gui.MainForm.Width" );
+ Convert( "Form.width", "Gui.MiniForm.Width" );
+ Convert( "Form.height", "Gui.MainForm.Height" );
+ Convert( "Form.height", "Gui.MiniForm.Height" );
+ Convert( "Form.maximized", "Gui.MainForm.Maximized", "False", "True" );
+ Convert( "Form.maximized", "Gui.MiniForm.Maximized", "False", "True" );
+ Convert( "Form.font", "Gui.MainForm.Font" );
+ Convert( "Form.font", "Gui.MiniForm.Font" );
+ Convert( "Form.tree-splitter-position", "Gui.MainForm.SplitPosition");
+ Convert( "Form.tab-splitter-position", "Gui.ResultTabs.ErrorsTabSplitterPosition");
+ Convert( "Options.TestLabels", "Gui.ResultTabs.DisplayTestLabels", "False", "True" );
+ Convert( "Options.FailureToolTips", "Gui.ResultTabs.ErrorTab.ToolTipsEnabled", "False", "True" );
+ Convert( "Options.EnableWordWrapForFailures", "Gui.ResultTabs.ErrorTab.WordWrapEnabled", "False", "True" );
+ Convert( "Options.InitialTreeDisplay", "Gui.TestTree.InitialTreeDisplay", "Auto", "Expand", "Collapse", "HideTests" );
+ Convert( "Options.ShowCheckBoxes", "Gui.TestTree.ShowCheckBoxes", "False", "True" );
+ Convert( "Options.LoadLastProject", "Options.LoadLastProject", "False", "True" );
+ Convert( "Options.ClearResults", "Options.TestLoader.ClearResultsOnReload", "False", "True" );
+ Convert( "Options.ReloadOnChange", "Options.TestLoader.ReloadOnChange", "False", "True" );
+ Convert( "Options.RerunOnChange", "Options.TestLoader.RerunOnChange", "False", "True" );
+ Convert( "Options.ReloadOnRun", "Options.TestLoader.ReloadOnRun", "False", "True" );
+ Convert( "Options.MergeAssemblies", "Options.TestLoader.MergeAssemblies", "False", "True" );
+ Convert( "Options.MultiDomain", "Options.TestLoader.MultiDomain", "False", "True" );
+ Convert( "Options.AutoNamespaceSuites", "Options.TestLoader.AutoNamespaceSuites", "False", "True" );
+ Convert( "Options.VisualStudioSupport", "Options.TestLoader.VisualStudioSupport", "False", "True" );
+ Convert( "Recent-Projects.MaxFiles", "RecentProjects.MaxFiles" );
+
+ int maxFiles = this.GetSetting( "RecentProjects.MaxFiles", 5 );
+ for( int i = 1; i <= maxFiles; i++ )
+ {
+ string fileKey = string.Format( "File{0}", i );
+ object fileEntry = legacy.GetSetting( "Recent-Projects." + fileKey );
+ if ( fileEntry != null )
+ this.SaveSetting( "RecentProjects." + fileKey, fileEntry );
+ }
+ }
+
+ private void Convert( string legacyName, string currentName, params string[]values )
+ {
+ object val = legacy.GetSetting( legacyName );
+ if ( val != null )
+ {
+ if ( val is int && values != null )
+ {
+ int ival = (int)val;
+ if ( ival >= 0 && ival < values.Length )
+ val = values[(int)val];
+ }
+
+ this.SaveSetting( currentName, val );
+ }
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/TestAgency.cs b/mcs/nunit24/ClientUtilities/util/Services/TestAgency.cs
new file mode 100644
index 00000000000..399bf3a8f10
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/TestAgency.cs
@@ -0,0 +1,353 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Diagnostics;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Services;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Enumeration of agent types used to request agents
+ /// </summary>
+ [Flags]
+ public enum AgentType
+ {
+ Default = 0,
+ DomainAgent = 1, // NYI
+ ProcessAgent = 2
+ }
+
+ /// <summary>
+ /// Enumeration used to report AgentStatus
+ /// </summary>
+ public enum AgentStatus
+ {
+ Unknown,
+ Starting,
+ Ready,
+ Busy,
+ Stopping
+ }
+
+ /// <summary>
+ /// The TestAgency class provides RemoteTestAgents
+ /// on request and tracks their status. Agents
+ /// are wrapped in an instance of the TestAgent
+ /// class. Multiple agent types are supported
+ /// but only one, ProcessAgent is implemented
+ /// at this time.
+ /// </summary>
+ public class TestAgency : ServerBase, IService
+ {
+ #region Private Fields
+ private AgentDataBase agentData = new AgentDataBase();
+
+ private AgentType supportedAgentTypes = AgentType.ProcessAgent;
+
+ private AgentType defaultAgentType = AgentType.ProcessAgent;
+ #endregion
+
+ #region Constructors
+ public TestAgency() : this( "TestAgency", 9100 ) { }
+
+ public TestAgency( string uri, int port ) : base( uri, port ) { }
+ #endregion
+
+ #region Static Property - TestAgentExePath
+ public static string TestAgentExePath
+ {
+ get
+ {
+ string agentPath = "nunit-agent.exe";
+
+ if ( !File.Exists(agentPath) )
+ {
+ DirectoryInfo dir = new DirectoryInfo( Environment.CurrentDirectory );
+ if ( dir.Parent.Name == "bin" )
+ dir = dir.Parent.Parent.Parent.Parent;
+
+ string path = PathUtils.Combine( dir.FullName, "NUnitTestServer", "nunit-agent-exe",
+ "bin", NUnitFramework.BuildConfiguration, "nunit-agent.exe" );
+ if( File.Exists( path ) )
+ agentPath = path;
+ }
+
+ return agentPath;
+ }
+ }
+ #endregion
+
+ #region ServerBase Overrides
+ public override void Stop()
+ {
+ foreach( AgentRecord r in agentData )
+ {
+ if ( !r.Process.HasExited )
+ {
+ if ( r.Agent != null )
+ r.Agent.Stop();
+
+ //r.Process.Kill();
+ }
+ }
+
+ agentData.Clear();
+
+ base.Stop ();
+ }
+ #endregion
+
+ #region Public Methods - Called by Agents
+ public void Register( RemoteTestAgent agent, int pid )
+ {
+ AgentRecord r = agentData[pid];
+ if ( r == null )
+ throw new ArgumentException( "Specified process is not in the agency database", "pid" );
+ r.Agent = agent;
+ }
+
+ public void ReportStatus( int pid, AgentStatus status )
+ {
+ AgentRecord r = agentData[pid];
+
+ if ( r == null )
+ throw new ArgumentException( "Specified process is not in the agency database", "pid" );
+
+ r.Status = status;
+ }
+ #endregion
+
+ #region Public Methods - Called by Clients
+ public TestAgent GetAgent()
+ {
+ return GetAgent( AgentType.Default, 5000 );
+ }
+
+ public TestAgent GetAgent( AgentType type )
+ {
+ return GetAgent( type, 5000 );
+ }
+
+ public TestAgent GetAgent(AgentType type, int waitTime)
+ {
+ if ( type == AgentType.Default )
+ type = defaultAgentType;
+
+ if ( (type & supportedAgentTypes) == 0 )
+ throw new ArgumentException(
+ string.Format( "AgentType {0} is not supported by this agency", type ),
+ "type" );
+
+ AgentRecord r = FindAvailableRemoteAgent(type);
+ if ( r == null )
+ r = CreateRemoteAgent(type, waitTime);
+
+ return new TestAgent( this, r.Process.Id, r.Agent );
+ }
+
+ public void ReleaseAgent( TestAgent agent )
+ {
+ AgentRecord r = agentData[agent.Id];
+ if ( r == null )
+ NTrace.Error( string.Format( "Unable to release agent {0} - not in database", agent.Id ) );
+ else
+ {
+ r.Status = AgentStatus.Ready;
+ NTrace.Debug( "Releasing agent " + agent.Id.ToString() );
+ }
+ }
+
+ public void DestroyAgent( TestAgent agent )
+ {
+ AgentRecord r = agentData[agent.Id];
+ if ( r != null )
+ {
+ if( !r.Process.HasExited )
+ r.Agent.Stop();
+ agentData[r.Process.Id] = null;
+ }
+ }
+ #endregion
+
+ #region Helper Methods
+ private int LaunchAgentProcess()
+ {
+ //ProcessStartInfo startInfo = new ProcessStartInfo( TestAgentExePath, ServerUtilities.MakeUrl( this.uri, this.port ) );
+ //startInfo.CreateNoWindow = true;
+ Process p = new Process();
+ if ( Type.GetType( "Mono.Runtime", false ) != null )
+ {
+ p.StartInfo.FileName = @"C:\Program Files\mono-1.2.5\bin\mono.exe";
+ p.StartInfo.Arguments = TestAgentExePath + " " + ServerUtilities.MakeUrl( this.uri, this.port );
+ }
+ else
+ {
+ p.StartInfo.FileName = TestAgentExePath;
+ p.StartInfo.Arguments = ServerUtilities.MakeUrl( this.uri, this.port );
+ }
+
+ //NTrace.Debug( "Launching {0}" p.StartInfo.FileName );
+ p.Start();
+ agentData.Add( new AgentRecord( p.Id, p, null, AgentStatus.Starting ) );
+ return p.Id;
+ }
+
+ private AgentRecord FindAvailableRemoteAgent(AgentType type)
+ {
+ foreach( AgentRecord r in agentData )
+ if ( r.Status == AgentStatus.Ready )
+ {
+ NTrace.DebugFormat( "Reusing agent {0}", r.Id );
+ r.Status = AgentStatus.Busy;
+ return r;
+ }
+
+ return null;
+ }
+
+ private AgentRecord CreateRemoteAgent(AgentType type, int waitTime)
+ {
+ int pid = LaunchAgentProcess();
+
+ NTrace.DebugFormat( "Waiting for agent {0} to register", pid );
+ while( waitTime > 0 )
+ {
+ int pollTime = Math.Min( 200, waitTime );
+ Thread.Sleep( pollTime );
+ waitTime -= pollTime;
+ if ( agentData[pid].Agent != null )
+ {
+ NTrace.DebugFormat( "Returning new agent record {0}", pid );
+ return agentData[pid];
+ }
+ }
+
+ return null;
+ }
+ #endregion
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ this.Stop();
+ }
+
+ public void InitializeService()
+ {
+ this.Start();
+ }
+
+ #endregion
+
+ #region Nested Class - AgentRecord
+ private class AgentRecord
+ {
+ public int Id;
+ public Process Process;
+ public RemoteTestAgent Agent;
+ public AgentStatus Status;
+
+ public AgentRecord( int id, Process p, RemoteTestAgent a, AgentStatus s )
+ {
+ this.Id = id;
+ this.Process = p;
+ this.Agent = a;
+ this.Status = s;
+ }
+
+ }
+ #endregion
+
+ #region Nested Class - AgentDataBase
+ /// <summary>
+ /// A simple class that tracks data about this
+ /// agencies active and available agents
+ /// </summary>
+ private class AgentDataBase : IEnumerable
+ {
+ private ListDictionary agentData = new ListDictionary();
+
+ public AgentRecord this[int id]
+ {
+ get { return (AgentRecord)agentData[id]; }
+ set
+ {
+ if ( value == null )
+ agentData.Remove( id );
+ else
+ agentData[id] = value;
+ }
+ }
+
+ public AgentRecord this[RemoteTestAgent agent]
+ {
+ get
+ {
+ foreach( System.Collections.DictionaryEntry entry in agentData )
+ {
+ AgentRecord r = (AgentRecord)entry.Value;
+ if ( r.Agent == agent )
+ return r;
+ }
+
+ return null;
+ }
+ }
+
+ public void Add( AgentRecord r )
+ {
+ agentData[r.Id] = r;
+ }
+
+ public void Clear()
+ {
+ agentData.Clear();
+ }
+
+ #region IEnumerable Members
+ public IEnumerator GetEnumerator()
+ {
+ return new AgentDataEnumerator( agentData );
+ }
+ #endregion
+
+ #region Nested Class - AgentDataEnumerator
+ public class AgentDataEnumerator : IEnumerator
+ {
+ IEnumerator innerEnum;
+
+ public AgentDataEnumerator( IDictionary list )
+ {
+ innerEnum = list.GetEnumerator();
+ }
+
+ #region IEnumerator Members
+ public void Reset()
+ {
+ innerEnum.Reset();
+ }
+
+ public object Current
+ {
+ get { return ((DictionaryEntry)innerEnum.Current).Value; }
+ }
+
+ public bool MoveNext()
+ {
+ return innerEnum.MoveNext();
+ }
+ #endregion
+ }
+ #endregion
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Services/TestAgentManager.cs b/mcs/nunit24/ClientUtilities/util/Services/TestAgentManager.cs
new file mode 100644
index 00000000000..d137699b397
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Services/TestAgentManager.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Threading;
+using System.Collections.Specialized;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Services;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for TestAgentManager.
+ /// </summary>
+ public class TestAgentManager : ServerBase, IService
+ {
+ private ListDictionary agents = new ListDictionary();
+
+ public TestAgentManager( string uri, int port ) : base( uri, port ) { }
+
+ public void Register( object obj, int id )
+ {
+ agents[id] = obj;
+ }
+
+ public object GetTestRunner( int id )
+ {
+ return agents[id];
+ }
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ // TODO: Add TestAgentManager.UnloadService implementation
+ }
+
+ public void InitializeService()
+ {
+ this.Start();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/SettingsGroup.cs b/mcs/nunit24/ClientUtilities/util/SettingsGroup.cs
new file mode 100644
index 00000000000..28d8f299a1f
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/SettingsGroup.cs
@@ -0,0 +1,256 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+
+ /// <summary>
+ /// SettingsGroup is the base class representing a group
+ /// of user or system settings. All storge of settings
+ /// is delegated to a SettingsStorage.
+ /// </summary>
+ public class SettingsGroup : ISettings, IDisposable
+ {
+ #region Instance Fields
+ protected ISettingsStorage storage;
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Construct a settings group.
+ /// </summary>
+ /// <param name="storage">Storage for the group settings</param>
+ public SettingsGroup( ISettingsStorage storage )
+ {
+ this.storage = storage;
+ }
+
+ /// <summary>
+ /// Protected constructor for use by derived classes that
+ /// set the storage themselves or don't use a storage.
+ /// </summary>
+ protected SettingsGroup()
+ {
+ }
+ #endregion
+
+ #region Properties
+
+ public event SettingsEventHandler Changed;
+
+ /// <summary>
+ /// The storage used for the group settings
+ /// </summary>
+ public ISettingsStorage Storage
+ {
+ get { return storage; }
+ }
+
+ #endregion
+
+ #region ISettings Members
+
+ /// <summary>
+ /// Load the value of one of the group's settings
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <returns>Value of the setting or null</returns>
+ public object GetSetting( string settingName )
+ {
+ return storage.GetSetting( settingName );
+ }
+
+ /// <summary>
+ /// Load the value of one of the group's settings or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <param name="defaultValue">Value to return if the seeting is not present</param>
+ /// <returns>Value of the setting or the default</returns>
+ public object GetSetting( string settingName, object defaultValue )
+ {
+ object result = GetSetting(settingName );
+
+ if ( result == null )
+ result = defaultValue;
+
+ return result;
+ }
+
+ /// <summary>
+ /// Load the value of one of the group's integer settings
+ /// in a type-safe manner or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <param name="defaultValue">Value to return if the seeting is not present</param>
+ /// <returns>Value of the setting or the default</returns>
+ public int GetSetting( string settingName, int defaultValue )
+ {
+ object result = GetSetting(settingName );
+
+ if ( result == null )
+ return defaultValue;
+
+ if ( result is int )
+ return (int) result;
+
+ try
+ {
+ return Int32.Parse( result.ToString() );
+ }
+ catch
+ {
+ return defaultValue;
+ }
+ }
+
+ /// <summary>
+ /// Load the value of one of the group's boolean settings
+ /// in a type-safe manner.
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <param name="defaultValue">Value of the setting or the default</param>
+ /// <returns>Value of the setting</returns>
+ public bool GetSetting( string settingName, bool defaultValue )
+ {
+ object result = GetSetting(settingName );
+
+ if ( result == null )
+ return defaultValue;
+
+ // Handle legacy formats
+// if ( result is int )
+// return (int)result == 1;
+//
+// if ( result is string )
+// {
+// if ( (string)result == "1" ) return true;
+// if ( (string)result == "0" ) return false;
+// }
+
+ if ( result is bool )
+ return (bool) result ;
+
+ try
+ {
+ return Boolean.Parse( result.ToString() );
+ }
+ catch
+ {
+ return defaultValue;
+ }
+ }
+
+ /// <summary>
+ /// Load the value of one of the group's string settings
+ /// in a type-safe manner or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <param name="defaultValue">Value to return if the setting is not present</param>
+ /// <returns>Value of the setting or the default</returns>
+ public string GetSetting( string settingName, string defaultValue )
+ {
+ object result = GetSetting(settingName );
+
+ if ( result == null )
+ return defaultValue;
+
+ if ( result is string )
+ return (string) result;
+ else
+ return result.ToString();
+ }
+
+ /// <summary>
+ /// Load the value of one of the group's enum settings
+ /// in a type-safe manner or return a default value
+ /// </summary>
+ /// <param name="settingName">Name of setting to load</param>
+ /// <param name="defaultValue">Value to return if the setting is not present</param>
+ /// <returns>Value of the setting or the default</returns>
+ public System.Enum GetSetting( string settingName, System.Enum defaultValue )
+ {
+ object result = GetSetting(settingName );
+
+ if ( result == null )
+ return defaultValue;
+
+ if ( result is System.Enum )
+ return (System.Enum) result;
+
+ try
+ {
+ return (System.Enum)System.Enum.Parse( defaultValue.GetType(), result.ToString(), true );
+ }
+ catch
+ {
+ return defaultValue;
+ }
+ }
+
+ /// <summary>
+ /// Remove a setting from the group
+ /// </summary>
+ /// <param name="settingName">Name of the setting to remove</param>
+ public void RemoveSetting( string settingName )
+ {
+ storage.RemoveSetting( settingName );
+
+ if ( Changed != null )
+ Changed( this, new SettingsEventArgs( settingName ) );
+ }
+
+ /// <summary>
+ /// Remove a group of settings
+ /// </summary>
+ /// <param name="GroupName"></param>
+ public void RemoveGroup( string groupName )
+ {
+ storage.RemoveGroup( groupName );
+ }
+
+ /// <summary>
+ /// Save the value of one of the group's settings
+ /// </summary>
+ /// <param name="settingName">Name of the setting to save</param>
+ /// <param name="settingValue">Value to be saved</param>
+ public void SaveSetting( string settingName, object settingValue )
+ {
+ object oldValue = storage.GetSetting( settingName );
+
+ // Avoid signaling "changes" when there is not really a change
+ if ( oldValue != null )
+ {
+ if( oldValue is string && settingValue is string && (string)oldValue == (string)settingValue ||
+ oldValue is int && settingValue is int && (int)oldValue == (int)settingValue ||
+ oldValue is bool && settingValue is bool && (bool)oldValue == (bool)settingValue ||
+ oldValue is Enum && settingValue is Enum && oldValue.Equals(settingValue) )
+ return;
+ }
+
+ storage.SaveSetting( settingName, settingValue );
+
+ if ( Changed != null )
+ Changed( this, new SettingsEventArgs( settingName ) );
+ }
+ #endregion
+
+ #region IDisposable Members
+ /// <summary>
+ /// Dispose of this group by disposing of it's storage implementation
+ /// </summary>
+ public void Dispose()
+ {
+ if ( storage != null )
+ {
+ storage.Dispose();
+ storage = null;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/SettingsStorage.cs b/mcs/nunit24/ClientUtilities/util/SettingsStorage.cs
new file mode 100644
index 00000000000..1aa4246ea61
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/SettingsStorage.cs
@@ -0,0 +1,62 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+
+ /// <summary>
+ /// The ISettingsStorage interface is implemented by all
+ /// types of backing storage for settings.
+ /// </summary>
+ public interface ISettingsStorage : IDisposable
+ {
+ /// <summary>
+ /// Load a setting from the storage.
+ /// </summary>
+ /// <param name="settingName">Name of the setting to load</param>
+ /// <returns>Value of the setting or null</returns>
+ object GetSetting( string settingName );
+
+ /// <summary>
+ /// Remove a setting from the storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to remove</param>
+ void RemoveSetting( string settingName );
+
+ /// <summary>
+ /// Remove a group of settings from the storae
+ /// </summary>
+ /// <param name="groupName">Name of the group to remove</param>
+ void RemoveGroup( string groupName );
+
+ /// <summary>
+ /// Save a setting in the storage
+ /// </summary>
+ /// <param name="settingName">Name of the setting to save</param>
+ /// <param name="settingValue">Value to be saved</param>
+ void SaveSetting( string settingName, object settingValue );
+
+ /// <summary>
+ /// Create a child storage of the same type
+ /// </summary>
+ /// <param name="name">Name of the child storage</param>
+ /// <returns>New child storage</returns>
+ ISettingsStorage MakeChildStorage( string name );
+
+ /// <summary>
+ /// Load settings from external storage if required
+ /// by the implementation.
+ /// </summary>
+ void LoadSettings();
+
+ /// <summary>
+ /// Save settings to external storage if required
+ /// by the implementation.
+ /// </summary>
+ void SaveSettings();
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/StackTraceFilter.cs b/mcs/nunit24/ClientUtilities/util/StackTraceFilter.cs
new file mode 100644
index 00000000000..17d212213f7
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/StackTraceFilter.cs
@@ -0,0 +1,62 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using System.IO;
+
+ /// <summary>
+ /// Summary description for StackTraceFilter.
+ /// </summary>
+ public class StackTraceFilter
+ {
+ public static string Filter(string stack)
+ {
+ if(stack == null) return null;
+ StringWriter sw = new StringWriter();
+ StringReader sr = new StringReader(stack);
+
+ try
+ {
+ string line;
+ while ((line = sr.ReadLine()) != null)
+ {
+ if (!FilterLine(line))
+ sw.WriteLine(line.Trim());
+ }
+ }
+ catch (Exception)
+ {
+ return stack;
+ }
+ return sw.ToString();
+ }
+
+ static bool FilterLine(string line)
+ {
+ string[] patterns = new string[]
+ {
+ "NUnit.Core.TestCase",
+ "NUnit.Core.ExpectedExceptionTestCase",
+ "NUnit.Core.TemplateTestCase",
+ "NUnit.Core.TestResult",
+ "NUnit.Core.TestSuite",
+ "NUnit.Framework.Assertion",
+ "NUnit.Framework.Assert"
+ };
+
+ for (int i = 0; i < patterns.Length; i++)
+ {
+ if (line.IndexOf(patterns[i]) > 0)
+ return true;
+ }
+
+ return false;
+ }
+
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/SummaryVisitor.cs b/mcs/nunit24/ClientUtilities/util/SummaryVisitor.cs
new file mode 100644
index 00000000000..882705cd389
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/SummaryVisitor.cs
@@ -0,0 +1,133 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using NUnit.Core;
+
+ /// <summary>
+ /// SummaryVisitor examines a set of results and calculates
+ /// summary statistics for the run. Note that a test run
+ /// will only produce results for tests that were selected
+ /// to be run. Curently, tests excluded by the Explicit
+ /// attribute produce a result, while those excluded by
+ /// the Platform attribute do not. This anomaly will be
+ /// corrected in a later version.
+ /// </summary>
+ public class SummaryVisitor : ResultVisitor
+ {
+ private int resultCount;
+ private int failureCount;
+ private int skipCount;
+ private int ignoreCount;
+ private int suitesNotRun;
+
+ private double time;
+ private string name;
+ private bool initialized;
+
+ public SummaryVisitor()
+ {
+ resultCount = 0;
+ initialized = false;
+ }
+
+ public void Visit(TestCaseResult caseResult)
+ {
+ SetNameandTime(caseResult.Name, caseResult.Time);
+
+ switch( caseResult.RunState )
+ {
+ case RunState.Executed:
+ resultCount++;
+ if(caseResult.IsFailure)
+ failureCount++;
+ break;
+ case RunState.Ignored:
+ ignoreCount++;
+ break;
+ case RunState.Explicit:
+ case RunState.NotRunnable:
+ case RunState.Runnable:
+ case RunState.Skipped:
+ default:
+ skipCount++;
+ break;
+ }
+ }
+
+ public void Visit(TestSuiteResult suiteResult)
+ {
+ SetNameandTime(suiteResult.Name, suiteResult.Time);
+
+
+
+ foreach (TestResult result in suiteResult.Results)
+ {
+ result.Accept(this);
+ }
+
+ if(!suiteResult.Executed)
+ suitesNotRun++;
+ }
+
+ public double Time
+ {
+ get { return time; }
+ }
+
+ private void SetNameandTime(string name, double time)
+ {
+ if(!initialized)
+ {
+ this.time = time;
+ this.name = name;
+ initialized = true;
+ }
+ }
+
+ public bool Success
+ {
+ get { return (failureCount == 0); }
+ }
+
+ public int ResultCount
+ {
+ get { return resultCount; }
+ }
+
+ public int FailureCount
+ {
+ get { return failureCount; }
+ }
+
+ public int SkipCount
+ {
+ get { return skipCount; }
+ }
+
+ public int IgnoreCount
+ {
+ get { return ignoreCount; }
+ }
+
+ public int TestsNotRun
+ {
+ get { return skipCount + ignoreCount; }
+ }
+
+ public int SuitesNotRun
+ {
+ get { return suitesNotRun; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestAgent.cs b/mcs/nunit24/ClientUtilities/util/TestAgent.cs
new file mode 100644
index 00000000000..3a59c1f62ac
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestAgent.cs
@@ -0,0 +1,58 @@
+using System;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// TestAgent provides a local representation
+ /// for a RemoteTestAgent allowing the lifetime
+ /// of the remote object to be independent of
+ /// its own.
+ /// </summary>
+ public class TestAgent
+ {
+ #region Fields
+ /// <summary>
+ /// Reference to the TestAgency that controls this agent
+ /// </summary>
+ private TestAgency agency;
+
+ /// <summary>
+ /// This agent's assigned id
+ /// </summary>
+ private int agentId;
+
+ /// <summary>
+ /// Reference to the remote agent
+ /// </summary>
+ private RemoteTestAgent remoteAgent;
+ #endregion
+
+ #region Constructor
+ public TestAgent( TestAgency agency, int agentId, RemoteTestAgent remoteAgent )
+ {
+ this.agency = agency;
+ this.agentId = agentId;
+ this.remoteAgent = remoteAgent;
+ }
+ #endregion
+
+ #region Properties
+ public TestAgency Agency
+ {
+ get { return agency; }
+ }
+
+ public int Id
+ {
+ get { return agentId; }
+ }
+ #endregion
+
+ #region Public Methods
+ public NUnit.Core.TestRunner CreateRunner(int runnerId)
+ {
+ return remoteAgent.CreateRunner( runnerId );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestDomain.cs b/mcs/nunit24/ClientUtilities/util/TestDomain.cs
new file mode 100644
index 00000000000..70101494b2f
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestDomain.cs
@@ -0,0 +1,93 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ using System.Diagnostics;
+ using System.Security.Policy;
+ using System.Reflection;
+ using System.Collections;
+ using System.Configuration;
+ using System.IO;
+
+ using NUnit.Core;
+
+ public class TestDomain : ProxyTestRunner, TestRunner
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// The appdomain used to load tests
+ /// </summary>
+ private AppDomain domain;
+
+ #endregion
+
+ #region Constructors
+ public TestDomain() : base( 0 ) { }
+
+ public TestDomain( int runnerID ) : base( runnerID ) { }
+ #endregion
+
+ #region Properties
+ public AppDomain AppDomain
+ {
+ get { return domain; }
+ }
+ #endregion
+
+ #region Loading and Unloading Tests
+ public override bool Load( TestPackage package )
+ {
+ Unload();
+
+ try
+ {
+ if ( this.domain == null )
+ this.domain = Services.DomainManager.CreateDomain( package );
+
+ if ( this.TestRunner == null )
+ this.TestRunner = MakeRemoteTestRunner( domain );
+
+ return TestRunner.Load( package );
+ }
+ catch
+ {
+ Unload();
+ throw;
+ }
+ }
+
+ public override void Unload()
+ {
+ this.TestRunner = null;
+
+ if(domain != null)
+ {
+ Services.DomainManager.Unload(domain);
+ domain = null;
+ }
+ }
+ #endregion
+
+ #region MakeRemoteTestRunner Helper
+ private TestRunner MakeRemoteTestRunner( AppDomain runnerDomain )
+ {
+ Type runnerType = typeof( RemoteTestRunner );
+ object obj = runnerDomain.CreateInstanceAndUnwrap(
+ runnerType.Assembly.FullName,
+ runnerType.FullName,
+ false, BindingFlags.Default,null,new object[] { this.ID },null,null,null);
+
+ RemoteTestRunner runner = (RemoteTestRunner) obj;
+
+ return runner;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestEventArgs.cs b/mcs/nunit24/ClientUtilities/util/TestEventArgs.cs
new file mode 100644
index 00000000000..e2926f0a2d6
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestEventArgs.cs
@@ -0,0 +1,234 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Diagnostics;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ #region TestEventHandler delegate
+
+ /// <summary>
+ /// The delegates for all events related to running tests
+ /// </summary>
+ public delegate void TestEventHandler ( object sender, TestEventArgs args );
+
+ #endregion
+
+ #region TestAction enumeration
+
+ /// <summary>
+ /// Enumeration used to distiguish test events
+ /// </summary>
+ public enum TestAction
+ {
+ // Project Load Events
+ ProjectLoading,
+ ProjectLoaded,
+ ProjectLoadFailed,
+ ProjectUnloading,
+ ProjectUnloaded,
+ ProjectUnloadFailed,
+ // Test Load Events
+ TestLoading,
+ TestLoaded,
+ TestLoadFailed,
+ TestReloading,
+ TestReloaded,
+ TestReloadFailed,
+ TestUnloading,
+ TestUnloaded,
+ TestUnloadFailed,
+ // Test Run Events
+ RunStarting,
+ RunFinished,
+ SuiteStarting,
+ SuiteFinished,
+ TestStarting,
+ TestFinished,
+ TestException,
+ TestOutput
+}
+
+ #endregion
+
+ /// <summary>
+ /// Argument used for all test events
+ /// </summary>
+ public class TestEventArgs : EventArgs
+ {
+ #region Instance Variables
+
+ // The action represented by the event
+ private TestAction action;
+
+ // The name of the test or other item
+ private string name;
+
+ // The name of the test we are running
+ private ITest test;
+
+ private TestName testName;
+
+ // The results from our tests
+ private TestResult testResult;
+
+ // The exception causing a failure
+ private Exception exception;
+
+ // The test output
+ private TestOutput testOutput;
+
+ // The number of tests we are running
+ private int testCount;
+
+ #endregion
+
+ #region Constructors
+
+ // TestLoaded, TestReloaded
+ public TestEventArgs( TestAction action,
+ string name, ITest test )
+ {
+ Debug.Assert(
+ action == TestAction.TestLoaded || action == TestAction.TestReloaded,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.name = name;
+ this.test = test;
+ if ( test != null )
+ this.testCount = test.TestCount;
+ }
+
+ // ProjectLoading, ProjectLoaded, ProjectUnloading, ProjectUnloaded,
+ // TestLoading, TestUnloading, TestUnloaded, TestReloading
+ public TestEventArgs( TestAction action, string name )
+ {
+ Debug.Assert(
+ action == TestAction.ProjectLoading || action == TestAction.ProjectLoaded ||
+ action == TestAction.ProjectUnloading || action == TestAction.ProjectUnloaded ||
+ action == TestAction.TestLoading || action == TestAction.TestUnloading ||
+ action == TestAction.TestUnloaded || action == TestAction.TestReloading,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.name = name;
+ }
+
+ public TestEventArgs( TestAction action, string name, int testCount )
+ {
+ Debug.Assert( action == TestAction.RunStarting,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.name = name;
+ this.testCount = testCount;
+ }
+
+ // ProjectLoadFailed, ProjectUnloadFailed, TestLoadFailed, TestUnloadFailed, TestReloadFailed, TestException
+ public TestEventArgs( TestAction action,
+ string name, Exception exception )
+ {
+ Debug.Assert(
+ action == TestAction.ProjectLoadFailed || action == TestAction.ProjectUnloadFailed ||
+ action == TestAction.TestLoadFailed || action == TestAction.TestUnloadFailed ||
+ action == TestAction.TestReloadFailed || action == TestAction.TestException,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.name = name;
+ this.exception = exception;
+ }
+
+ // TestStarting, SuiteStarting
+ public TestEventArgs( TestAction action, TestName testName )
+ {
+ Debug.Assert( action == TestAction.TestStarting || action == TestAction.SuiteStarting,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.testName = testName;
+ }
+
+ // TestFinished, SuiteFinished, RunFinished
+ public TestEventArgs( TestAction action, TestResult testResult )
+ {
+ Debug.Assert( action == TestAction.TestFinished || action == TestAction.SuiteFinished ||
+ action == TestAction.RunFinished,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.testResult = testResult;
+ }
+
+ // RunFinished
+ public TestEventArgs( TestAction action, Exception exception )
+ {
+ Debug.Assert( action == TestAction.RunFinished,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.exception = exception;
+ }
+
+ // TestOutput
+ public TestEventArgs( TestAction action, TestOutput testOutput )
+ {
+ Debug.Assert( action == TestAction.TestOutput,
+ "Invalid TestAction argument to TestEventArgs constructor" );
+
+ this.action = action;
+ this.testOutput = testOutput;
+ }
+ #endregion
+
+ #region Properties
+
+ public TestAction Action
+ {
+ get { return action; }
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public ITest Test
+ {
+ get { return test; }
+ }
+
+ public TestName TestName
+ {
+ get { return testName; }
+ }
+
+ public int TestCount
+ {
+ get { return testCount; }
+ }
+
+ public TestResult Result
+ {
+ get { return testResult; }
+ }
+
+ public Exception Exception
+ {
+ get { return exception; }
+ }
+
+ public TestOutput TestOutput
+ {
+ get { return testOutput; }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestEventDispatcher.cs b/mcs/nunit24/ClientUtilities/util/TestEventDispatcher.cs
new file mode 100644
index 00000000000..d1a5edb9f94
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestEventDispatcher.cs
@@ -0,0 +1,234 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Helper class used to dispatch test events
+ /// </summary>
+ public class TestEventDispatcher : ITestEvents
+ {
+ #region Events
+
+ // Project loading events
+ public event TestEventHandler ProjectLoading;
+ public event TestEventHandler ProjectLoaded;
+ public event TestEventHandler ProjectLoadFailed;
+ public event TestEventHandler ProjectUnloading;
+ public event TestEventHandler ProjectUnloaded;
+ public event TestEventHandler ProjectUnloadFailed;
+
+ // Test loading events
+ public event TestEventHandler TestLoading;
+ public event TestEventHandler TestLoaded;
+ public event TestEventHandler TestLoadFailed;
+
+ public event TestEventHandler TestReloading;
+ public event TestEventHandler TestReloaded;
+ public event TestEventHandler TestReloadFailed;
+
+ public event TestEventHandler TestUnloading;
+ public event TestEventHandler TestUnloaded;
+ public event TestEventHandler TestUnloadFailed;
+
+ // Test running events
+ public event TestEventHandler RunStarting;
+ public event TestEventHandler RunFinished;
+
+ public event TestEventHandler SuiteStarting;
+ public event TestEventHandler SuiteFinished;
+
+ public event TestEventHandler TestStarting;
+ public event TestEventHandler TestFinished;
+
+ public event TestEventHandler TestException;
+ public event TestEventHandler TestOutput;
+
+ #endregion
+
+ #region Methods for Firing Events
+
+ protected virtual void Fire( TestEventHandler handler, TestEventArgs e )
+ {
+ if ( handler != null )
+ handler( this, e );
+ }
+
+ public void FireProjectLoading( string fileName )
+ {
+ Fire(
+ ProjectLoading,
+ new TestEventArgs( TestAction.ProjectLoading, fileName ) );
+ }
+
+ public void FireProjectLoaded( string fileName )
+ {
+ Fire(
+ ProjectLoaded,
+ new TestEventArgs( TestAction.ProjectLoaded, fileName ) );
+ }
+
+ public void FireProjectLoadFailed( string fileName, Exception exception )
+ {
+ Fire(
+ ProjectLoadFailed,
+ new TestEventArgs( TestAction.ProjectLoadFailed, fileName, exception ) );
+ }
+
+ public void FireProjectUnloading( string fileName )
+ {
+ Fire(
+ ProjectUnloading,
+ new TestEventArgs( TestAction.ProjectUnloading, fileName ) );
+ }
+
+ public void FireProjectUnloaded( string fileName )
+ {
+ Fire(
+ ProjectUnloaded,
+ new TestEventArgs( TestAction.ProjectUnloaded, fileName ) );
+ }
+
+ public void FireProjectUnloadFailed( string fileName, Exception exception )
+ {
+ Fire(
+ ProjectUnloadFailed,
+ new TestEventArgs( TestAction.ProjectUnloadFailed, fileName, exception ) );
+ }
+
+ public void FireTestLoading( string fileName )
+ {
+ Fire(
+ TestLoading,
+ new TestEventArgs( TestAction.TestLoading, fileName ) );
+ }
+
+ public void FireTestLoaded( string fileName, ITest test )
+ {
+ Fire(
+ TestLoaded,
+ new TestEventArgs( TestAction.TestLoaded, fileName, test ) );
+ }
+
+ public void FireTestLoadFailed( string fileName, Exception exception )
+ {
+ Fire(
+ TestLoadFailed,
+ new TestEventArgs( TestAction.TestLoadFailed, fileName, exception ) );
+ }
+
+ public void FireTestUnloading( string fileName )
+ {
+ Fire(
+ TestUnloading,
+ new TestEventArgs( TestAction.TestUnloading, fileName ) );
+ }
+
+ public void FireTestUnloaded( string fileName )
+ {
+ Fire(
+ TestUnloaded,
+ new TestEventArgs( TestAction.TestUnloaded, fileName ) );
+ }
+
+ public void FireTestUnloadFailed( string fileName, Exception exception )
+ {
+ Fire(
+ TestUnloadFailed,
+ new TestEventArgs( TestAction.TestUnloadFailed, fileName, exception ) );
+ }
+
+ public void FireTestReloading( string fileName )
+ {
+ Fire(
+ TestReloading,
+ new TestEventArgs( TestAction.TestReloading, fileName ) );
+ }
+
+ public void FireTestReloaded( string fileName, ITest test )
+ {
+ Fire(
+ TestReloaded,
+ new TestEventArgs( TestAction.TestReloaded, fileName, test ) );
+ }
+
+ public void FireTestReloadFailed( string fileName, Exception exception )
+ {
+ Fire(
+ TestReloadFailed,
+ new TestEventArgs( TestAction.TestReloadFailed, fileName, exception ) );
+ }
+
+ public void FireRunStarting( string name, int testCount )
+ {
+ Fire(
+ RunStarting,
+ new TestEventArgs( TestAction.RunStarting, name, testCount ) );
+ }
+
+ public void FireRunFinished( TestResult result )
+ {
+ Fire(
+ RunFinished,
+ new TestEventArgs( TestAction.RunFinished, result ) );
+ }
+
+ public void FireRunFinished( Exception exception )
+ {
+ Fire(
+ RunFinished,
+ new TestEventArgs( TestAction.RunFinished, exception ) );
+ }
+
+ public void FireTestStarting( TestName testName )
+ {
+ Fire(
+ TestStarting,
+ new TestEventArgs( TestAction.TestStarting, testName ) );
+ }
+
+ public void FireTestFinished( TestResult result )
+ {
+ Fire(
+ TestFinished,
+ new TestEventArgs( TestAction.TestFinished, result ) );
+ }
+
+ public void FireSuiteStarting( TestName testName )
+ {
+ Fire(
+ SuiteStarting,
+ new TestEventArgs( TestAction.SuiteStarting, testName ) );
+ }
+
+ public void FireSuiteFinished( TestResult result )
+ {
+ Fire(
+ SuiteFinished,
+ new TestEventArgs( TestAction.SuiteFinished, result ) );
+ }
+
+ public void FireTestException( string name, Exception exception )
+ {
+ Fire(
+ TestException,
+ new TestEventArgs( TestAction.TestException, name, exception ) );
+ }
+
+ public void FireTestOutput( TestOutput testOutput )
+ {
+ Fire(
+ TestOutput,
+ new TestEventArgs( TestAction.TestOutput, testOutput ) );
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestExceptionHandler.cs b/mcs/nunit24/ClientUtilities/util/TestExceptionHandler.cs
new file mode 100644
index 00000000000..789af074234
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestExceptionHandler.cs
@@ -0,0 +1,46 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for UnhandledExceptionCatcher.
+ /// </summary>
+ public class TestExceptionHandler : IDisposable
+ {
+ private UnhandledExceptionEventHandler handler;
+
+ public TestExceptionHandler( UnhandledExceptionEventHandler handler )
+ {
+ this.handler = handler;
+ AppDomain.CurrentDomain.UnhandledException += handler;
+ }
+
+ ~TestExceptionHandler()
+ {
+ if ( handler != null )
+ {
+ AppDomain.CurrentDomain.UnhandledException -= handler;
+ handler = null;
+ }
+ }
+
+
+
+ public void Dispose()
+ {
+ if ( handler != null )
+ {
+ AppDomain.CurrentDomain.UnhandledException -= handler;
+ handler = null;
+ }
+
+ System.GC.SuppressFinalize( this );
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestLoader.cs b/mcs/nunit24/ClientUtilities/util/TestLoader.cs
new file mode 100644
index 00000000000..f3a32dac419
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestLoader.cs
@@ -0,0 +1,786 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using System.IO;
+ using System.Collections;
+ using System.Threading;
+ using System.Configuration;
+ using NUnit.Core;
+ using NUnit.Core.Filters;
+
+
+ /// <summary>
+ /// TestLoader handles interactions between a test runner and a
+ /// client program - typically the user interface - for the
+ /// purpose of loading, unloading and running tests.
+ ///
+ /// It implemements the EventListener interface which is used by
+ /// the test runner and repackages those events, along with
+ /// others as individual events that clients may subscribe to
+ /// in collaboration with a TestEventDispatcher helper object.
+ ///
+ /// TestLoader is quite handy for use with a gui client because
+ /// of the large number of events it supports. However, it has
+ /// no dependencies on ui components and can be used independently.
+ /// </summary>
+ public class TestLoader : MarshalByRefObject, NUnit.Core.EventListener, ITestLoader, IService
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// Our event dispatching helper object
+ /// </summary>
+ private TestEventDispatcher events;
+
+ /// <summary>
+ /// Use MuiltipleTestDomainRunner if true
+ /// </summary>
+ private bool multiDomain;
+
+ /// <summary>
+ /// Merge namespaces across multiple assemblies
+ /// </summary>
+ private bool mergeAssemblies;
+
+ /// <summary>
+ /// Generate suites for each level of namespace containing tests
+ /// </summary>
+ private bool autoNamespaceSuites;
+
+ private bool shadowCopyFiles;
+
+ /// <summary>
+ /// Loads and executes tests. Non-null when
+ /// we have loaded a test.
+ /// </summary>
+ private TestRunner testRunner = null;
+
+ /// <summary>
+ /// Our current test project, if we have one.
+ /// </summary>
+ private NUnitProject testProject = null;
+
+ /// <summary>
+ /// The currently loaded test, returned by the testrunner
+ /// </summary>
+ private ITest loadedTest = null;
+
+ /// <summary>
+ /// The test name that was specified when loading
+ /// </summary>
+ private string loadedTestName = null;
+
+ /// <summary>
+ /// The currently executing test
+ /// </summary>
+ private string currentTestName;
+
+ /// <summary>
+ /// Result of the last test run
+ /// </summary>
+ private TestResult testResult = null;
+
+ /// <summary>
+ /// The last exception received when trying to load, unload or run a test
+ /// </summary>
+ private Exception lastException = null;
+
+ /// <summary>
+ /// Watcher fires when the assembly changes
+ /// </summary>
+ private AssemblyWatcher watcher;
+
+ /// <summary>
+ /// Assembly changed during a test and
+ /// needs to be reloaded later
+ /// </summary>
+ private bool reloadPending = false;
+
+ /// <summary>
+ /// Indicates whether to watch for changes
+ /// and reload the tests when a change occurs.
+ /// </summary>
+ private bool reloadOnChange = false;
+
+ /// <summary>
+ /// Indicates whether to automatically rerun
+ /// the tests when a change occurs.
+ /// </summary>
+ private bool rerunOnChange = false;
+
+ /// <summary>
+ /// The last filter used for a run - used to
+ /// rerun tests when a change occurs
+ /// </summary>
+ private ITestFilter lastFilter;
+
+ /// <summary>
+ /// Indicates whether to reload the tests
+ /// before each run.
+ /// </summary>
+ private bool reloadOnRun = false;
+
+ #endregion
+
+ #region Constructors
+
+ public TestLoader()
+ : this( new TestEventDispatcher() ) { }
+
+ public TestLoader(TestEventDispatcher eventDispatcher )
+ {
+ this.events = eventDispatcher;
+
+ ISettings settings = Services.UserSettings;
+ this.ReloadOnRun = settings.GetSetting( "Options.TestLoader.ReloadOnRun", true );
+ this.ReloadOnChange = settings.GetSetting( "Options.TestLoader.ReloadOnChange", true );
+ this.RerunOnChange = settings.GetSetting( "Options.TestLoader.RerunOnChange", false );
+ this.MultiDomain = settings.GetSetting( "Options.TestLoader.MultiDomain", false );
+ this.MergeAssemblies = settings.GetSetting( "Options.TestLoader.MergeAssemblies", false );
+ this.AutoNamespaceSuites = settings.GetSetting( "Options.TestLoader.AutoNamespaceSuites", true );
+ this.ShadowCopyFiles = settings.GetSetting( "Options.TestLoader.ShadowCopyFiles", true );
+
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler( OnUnhandledException );
+ }
+
+ #endregion
+
+ #region Properties
+ public bool IsProjectLoaded
+ {
+ get { return testProject != null; }
+ }
+
+ public bool IsTestLoaded
+ {
+ get { return loadedTest != null; }
+ }
+
+ public bool Running
+ {
+ get { return testRunner != null && testRunner.Running; }
+ }
+
+ public NUnitProject TestProject
+ {
+ get { return testProject; }
+ set { OnProjectLoad( value ); }
+ }
+
+ public ITestEvents Events
+ {
+ get { return events; }
+ }
+
+ public string TestFileName
+ {
+ get { return testProject.ProjectPath; }
+ }
+
+ public TestResult TestResult
+ {
+ get { return testResult; }
+ }
+
+ public Exception LastException
+ {
+ get { return lastException; }
+ }
+
+ public bool ReloadOnChange
+ {
+ get { return reloadOnChange; }
+ set { reloadOnChange = value; }
+ }
+
+ public bool RerunOnChange
+ {
+ get { return rerunOnChange; }
+ set { rerunOnChange = value; }
+ }
+
+ public bool ReloadOnRun
+ {
+ get { return reloadOnRun; }
+ set { reloadOnRun = value; }
+ }
+
+ public bool MultiDomain
+ {
+ get { return multiDomain; }
+ set { multiDomain = value; }
+ }
+
+ public bool MergeAssemblies
+ {
+ get { return mergeAssemblies; }
+ set { mergeAssemblies = value; }
+ }
+
+ public bool AutoNamespaceSuites
+ {
+ get { return autoNamespaceSuites; }
+ set { autoNamespaceSuites = value; }
+ }
+
+ public bool ShadowCopyFiles
+ {
+ get { return shadowCopyFiles; }
+ set { shadowCopyFiles = value; }
+ }
+
+ public IList AssemblyInfo
+ {
+ get { return testRunner == null ? null : testRunner.AssemblyInfo; }
+ }
+
+ public int TestCount
+ {
+ get { return loadedTest == null ? 0 : loadedTest.TestCount; }
+ }
+ #endregion
+
+ #region EventListener Handlers
+
+ void EventListener.RunStarted(string name, int testCount)
+ {
+ events.FireRunStarting( name, testCount );
+ }
+
+ void EventListener.RunFinished(NUnit.Core.TestResult testResult)
+ {
+ this.testResult = testResult;
+
+ try
+ {
+ this.SaveLastResult(
+ Path.Combine( Path.GetDirectoryName( this.TestFileName ), "TestResult.xml" ) );
+ events.FireRunFinished( testResult );
+ }
+ catch( Exception ex )
+ {
+ this.lastException = ex;
+ events.FireRunFinished( ex );
+ }
+ }
+
+ void EventListener.RunFinished(Exception exception)
+ {
+ this.lastException = exception;
+ events.FireRunFinished( exception );
+ }
+
+ /// <summary>
+ /// Trigger event when each test starts
+ /// </summary>
+ /// <param name="testCase">TestCase that is starting</param>
+ void EventListener.TestStarted(TestName testName)
+ {
+ this.currentTestName = testName.FullName;
+ events.FireTestStarting( testName );
+ }
+
+ /// <summary>
+ /// Trigger event when each test finishes
+ /// </summary>
+ /// <param name="result">Result of the case that finished</param>
+ void EventListener.TestFinished(TestCaseResult result)
+ {
+ events.FireTestFinished( result );
+ }
+
+ /// <summary>
+ /// Trigger event when each suite starts
+ /// </summary>
+ /// <param name="suite">Suite that is starting</param>
+ void EventListener.SuiteStarted(TestName suiteName)
+ {
+ events.FireSuiteStarting( suiteName );
+ }
+
+ /// <summary>
+ /// Trigger event when each suite finishes
+ /// </summary>
+ /// <param name="result">Result of the suite that finished</param>
+ void EventListener.SuiteFinished(TestSuiteResult result)
+ {
+ events.FireSuiteFinished( result );
+ }
+
+ /// <summary>
+ /// Trigger event when an unhandled exception (other than ThreadAbordException) occurs during a test
+ /// </summary>
+ /// <param name="exception">The unhandled exception</param>
+ void EventListener.UnhandledException(Exception exception)
+ {
+ events.FireTestException( this.currentTestName, exception );
+ }
+
+ void OnUnhandledException( object sender, UnhandledExceptionEventArgs args )
+ {
+ switch( args.ExceptionObject.GetType().FullName )
+ {
+ case "System.Threading.ThreadAbortException":
+ break;
+ case "NUnit.Framework.AssertionException":
+ default:
+ events.FireTestException( this.currentTestName, (Exception)args.ExceptionObject );
+ break;
+ }
+ }
+
+ /// <summary>
+ /// Trigger event when output occurs during a test
+ /// </summary>
+ /// <param name="testOutput">The test output</param>
+ void EventListener.TestOutput(TestOutput testOutput)
+ {
+ events.FireTestOutput( testOutput );
+ }
+
+ #endregion
+
+ #region Methods for Loading and Unloading Projects
+
+ /// <summary>
+ /// Create a new project with default naming
+ /// </summary>
+ public void NewProject()
+ {
+ try
+ {
+ events.FireProjectLoading( "New Project" );
+
+ OnProjectLoad( NUnitProject.NewProject() );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireProjectLoadFailed( "New Project", exception );
+ }
+ }
+
+ /// <summary>
+ /// Create a new project using a given path
+ /// </summary>
+ public void NewProject( string filePath )
+ {
+ try
+ {
+ events.FireProjectLoading( filePath );
+
+ NUnitProject project = new NUnitProject( filePath );
+
+ project.Configs.Add( "Debug" );
+ project.Configs.Add( "Release" );
+ project.IsDirty = false;
+
+ OnProjectLoad( project );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireProjectLoadFailed( filePath, exception );
+ }
+ }
+
+ /// <summary>
+ /// Load a new project, optionally selecting the config and fire events
+ /// </summary>
+ public void LoadProject( string filePath, string configName )
+ {
+ try
+ {
+ events.FireProjectLoading( filePath );
+
+ NUnitProject newProject = NUnitProject.LoadProject( filePath );
+ if ( configName != null )
+ {
+ newProject.SetActiveConfig( configName );
+ newProject.IsDirty = false;
+ }
+
+ OnProjectLoad( newProject );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireProjectLoadFailed( filePath, exception );
+ }
+ }
+
+ /// <summary>
+ /// Load a new project using the default config and fire events
+ /// </summary>
+ public void LoadProject( string filePath )
+ {
+ LoadProject( filePath, null );
+ }
+
+ /// <summary>
+ /// Load a project from a list of assemblies and fire events
+ /// </summary>
+ public void LoadProject( string[] assemblies )
+ {
+ try
+ {
+ events.FireProjectLoading( "New Project" );
+
+ NUnitProject newProject = NUnitProject.FromAssemblies( assemblies );
+
+ OnProjectLoad( newProject );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireProjectLoadFailed( "New Project", exception );
+ }
+ }
+
+ /// <summary>
+ /// Unload the current project and fire events
+ /// </summary>
+ public void UnloadProject()
+ {
+ string testFileName = TestFileName;
+
+ try
+ {
+ events.FireProjectUnloading( testFileName );
+
+ if ( IsTestLoaded )
+ UnloadTest();
+
+ testProject.Changed -= new ProjectEventHandler( OnProjectChanged );
+ testProject = null;
+
+ events.FireProjectUnloaded( testFileName );
+ }
+ catch (Exception exception )
+ {
+ lastException = exception;
+ events.FireProjectUnloadFailed( testFileName, exception );
+ }
+
+ }
+
+ /// <summary>
+ /// Common operations done each time a project is loaded
+ /// </summary>
+ /// <param name="testProject">The newly loaded project</param>
+ private void OnProjectLoad( NUnitProject testProject )
+ {
+ if ( IsProjectLoaded )
+ UnloadProject();
+
+ this.testProject = testProject;
+ testProject.Changed += new ProjectEventHandler( OnProjectChanged );
+
+ events.FireProjectLoaded( TestFileName );
+ }
+
+ private void OnProjectChanged( object sender, ProjectEventArgs e )
+ {
+ switch ( e.type )
+ {
+ case ProjectChangeType.ActiveConfig:
+ case ProjectChangeType.Other:
+ if( TestProject.IsLoadable )
+ TryToLoadOrReloadTest();
+ break;
+
+ case ProjectChangeType.AddConfig:
+ case ProjectChangeType.UpdateConfig:
+ if ( e.configName == TestProject.ActiveConfigName && TestProject.IsLoadable )
+ TryToLoadOrReloadTest();
+ break;
+
+ case ProjectChangeType.RemoveConfig:
+ if ( IsTestLoaded && TestProject.Configs.Count == 0 )
+ UnloadTest();
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ private void TryToLoadOrReloadTest()
+ {
+ if ( IsTestLoaded )
+ ReloadTest();
+ else
+ LoadTest();
+ }
+
+ #endregion
+
+ #region Methods for Loading and Unloading Tests
+
+ public void LoadTest()
+ {
+ LoadTest( null );
+ }
+
+ public void LoadTest( string testName )
+ {
+ long startTime = DateTime.Now.Ticks;
+
+ try
+ {
+ events.FireTestLoading( TestFileName );
+
+ testRunner = CreateRunner();
+
+ bool loaded = testRunner.Load( MakeTestPackage( testName ) );
+
+ loadedTest = testRunner.Test;
+ loadedTestName = testName;
+ testResult = null;
+ reloadPending = false;
+
+ if ( ReloadOnChange )
+ InstallWatcher( );
+
+ if ( loaded )
+ events.FireTestLoaded( TestFileName, loadedTest );
+ else
+ {
+ lastException = new ApplicationException( string.Format ( "Unable to find test {0} in assembly", testName ) );
+ events.FireTestLoadFailed( TestFileName, lastException );
+ }
+ }
+ catch( FileNotFoundException exception )
+ {
+ lastException = exception;
+
+ foreach( string assembly in TestProject.ActiveConfig.Assemblies )
+ {
+ if ( Path.GetFileNameWithoutExtension( assembly ) == exception.FileName &&
+ !PathUtils.SamePathOrUnder( testProject.ActiveConfig.BasePath, assembly ) )
+ {
+ lastException = new ApplicationException( string.Format( "Unable to load {0} because it is not located under the AppBase", exception.FileName ), exception );
+ break;
+ }
+ }
+
+ events.FireTestLoadFailed( TestFileName, lastException );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireTestLoadFailed( TestFileName, exception );
+ }
+
+ double loadTime = (double)(DateTime.Now.Ticks - startTime) / (double)TimeSpan.TicksPerSecond;
+ System.Diagnostics.Trace.WriteLine(string.Format("TestLoader: Loaded in {0} seconds", loadTime));
+ }
+
+ /// <summary>
+ /// Unload the current test suite and fire the Unloaded event
+ /// </summary>
+ public void UnloadTest( )
+ {
+ if( IsTestLoaded )
+ {
+ // Hold the name for notifications after unload
+ string fileName = TestFileName;
+
+ try
+ {
+ events.FireTestUnloading( fileName );
+
+ RemoveWatcher();
+
+ testRunner.Unload();
+
+ testRunner = null;
+
+ loadedTest = null;
+ loadedTestName = null;
+ testResult = null;
+ reloadPending = false;
+
+ events.FireTestUnloaded( fileName );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireTestUnloadFailed( fileName, exception );
+ }
+ }
+ }
+
+ /// <summary>
+ /// Reload the current test on command
+ /// </summary>
+ public void ReloadTest()
+ {
+ try
+ {
+ events.FireTestReloading( TestFileName );
+
+ testRunner.Load( MakeTestPackage( loadedTestName ) );
+
+ loadedTest = testRunner.Test;
+ reloadPending = false;
+
+ events.FireTestReloaded( TestFileName, loadedTest );
+ }
+ catch( Exception exception )
+ {
+ lastException = exception;
+ events.FireTestReloadFailed( TestFileName, exception );
+ }
+ }
+
+ /// <summary>
+ /// Handle watcher event that signals when the loaded assembly
+ /// file has changed. Make sure it's a real change before
+ /// firing the SuiteChangedEvent. Since this all happens
+ /// asynchronously, we use an event to let ui components
+ /// know that the failure happened.
+ /// </summary>
+ public void OnTestChanged( string testFileName )
+ {
+ if ( Running )
+ reloadPending = true;
+ else
+ {
+ ReloadTest();
+
+ if ( rerunOnChange && lastFilter != null )
+ testRunner.BeginRun( this, lastFilter );
+ }
+ }
+ #endregion
+
+ #region Methods for Running Tests
+ /// <summary>
+ /// Run all the tests
+ /// </summary>
+ public void RunTests()
+ {
+ RunTests( TestFilter.Empty );
+ }
+
+ /// <summary>
+ /// Run selected tests using a filter
+ /// </summary>
+ /// <param name="filter">The filter to be used</param>
+ public void RunTests( ITestFilter filter )
+ {
+ if ( !Running )
+ {
+ if ( reloadPending || ReloadOnRun )
+ ReloadTest();
+
+ this.lastFilter = filter;
+ testRunner.BeginRun( this, filter );
+ }
+ }
+
+ /// <summary>
+ /// Cancel the currently running test.
+ /// Fail silently if there is none to
+ /// allow for latency in the UI.
+ /// </summary>
+ public void CancelTestRun()
+ {
+ if ( Running )
+ testRunner.CancelRun();
+ }
+
+ public IList GetCategories()
+ {
+ CategoryManager categoryManager = new CategoryManager();
+ categoryManager.AddAllCategories( this.loadedTest );
+ ArrayList list = new ArrayList( categoryManager.Categories );
+ list.Sort();
+ return list;
+ }
+ #endregion
+
+ public void SaveLastResult( string fileName )
+ {
+ XmlResultVisitor resultVisitor
+ = new XmlResultVisitor( fileName, this.testResult );
+ this.testResult.Accept(resultVisitor);
+ resultVisitor.Write();
+ }
+
+ #region Helper Methods
+
+ /// <summary>
+ /// Install our watcher object so as to get notifications
+ /// about changes to a test.
+ /// </summary>
+ private void InstallWatcher()
+ {
+ if(watcher!=null) watcher.Stop();
+
+ watcher = new AssemblyWatcher( 1000, TestProject.ActiveConfig.Assemblies.ToArray() );
+ watcher.AssemblyChangedEvent += new AssemblyWatcher.AssemblyChangedHandler( OnTestChanged );
+ watcher.Start();
+ }
+
+ /// <summary>
+ /// Stop and remove our current watcher object.
+ /// </summary>
+ private void RemoveWatcher()
+ {
+ if ( watcher != null )
+ {
+ watcher.Stop();
+ watcher = null;
+ }
+ }
+
+ private TestRunner CreateRunner()
+ {
+ TestRunner runner = multiDomain
+ ? (TestRunner)new MultipleTestDomainRunner()
+ : (TestRunner)new TestDomain();
+
+ return runner;
+ }
+
+ private TestPackage MakeTestPackage( string testName )
+ {
+ TestPackage package = TestProject.ActiveConfig.MakeTestPackage();
+ package.TestName = testName;
+ package.Settings["MergeAssemblies"] = mergeAssemblies;
+ package.Settings["AutoNamespaceSuites"] = autoNamespaceSuites;
+ package.Settings["ShadowCopyFiles"] = shadowCopyFiles;
+ return package;
+ }
+ #endregion
+
+ #region InitializeLifetimeService Override
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ #endregion
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ // TODO: Add TestLoader.UnloadService implementation
+ }
+
+ public void InitializeService()
+ {
+ // TODO: Add TestLoader.InitializeService implementation
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestObserver.cs b/mcs/nunit24/ClientUtilities/util/TestObserver.cs
new file mode 100644
index 00000000000..dc56dafc548
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestObserver.cs
@@ -0,0 +1,20 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// The TestObserver interface is implemented by a class that
+ /// subscribes to the events generated in loading and running
+ /// tests and uses that information in some way.
+ /// </summary>
+ public interface TestObserver
+ {
+ void Subscribe( ITestEvents events );
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestResultItem.cs b/mcs/nunit24/ClientUtilities/util/TestResultItem.cs
new file mode 100644
index 00000000000..36a97ce3a7c
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestResultItem.cs
@@ -0,0 +1,76 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Util
+{
+ using NUnit.Core;
+
+ /// <summary>
+ /// Summary description for TestResultItem.
+ /// </summary>
+ public class TestResultItem
+ {
+ private string testName;
+ private string message;
+ private string stackTrace;
+
+ public TestResultItem(TestResult result )
+ {
+ testName = result.Test.TestName.FullName;
+ message = result.Message;
+ stackTrace = result.StackTrace;
+
+ if ( result.Test.IsSuite && result.FailureSite == FailureSite.SetUp )
+ testName += " (TestFixtureSetUp)";
+ }
+
+ public TestResultItem( string testName, string message, string stackTrace )
+ {
+ this.testName = testName;
+ this.message = message;
+ this.stackTrace = stackTrace;
+ }
+
+ public override string ToString()
+ {
+ if ( message.Length > 64000 )
+ return string.Format( "{0}:{1}{2}", testName, Environment.NewLine, message.Substring( 0, 64000 ) );
+
+ return GetMessage();
+ }
+
+ public string GetMessage()
+ {
+ return String.Format("{0}:{1}{2}", testName, Environment.NewLine, message);
+ }
+
+ public string GetToolTipMessage() //NRG 05/28/03 - Substitute spaces for tab characters
+ {
+ return (ReplaceTabs(GetMessage(), 8)); // Change each tab to 8 space characters
+ }
+
+ public string ReplaceTabs(string strOriginal, int nSpaces) //NRG 05/28/03
+ {
+ string strSpaces = string.Empty;
+ strSpaces = strSpaces.PadRight(nSpaces, ' ');
+ return(strOriginal.Replace("\t", strSpaces));
+ }
+
+ public string StackTrace
+ {
+ get
+ {
+ string trace = "No stack trace is available";
+ if(stackTrace != null)
+ trace = StackTraceFilter.Filter(stackTrace);
+
+ return trace;
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/TestServer.cs b/mcs/nunit24/ClientUtilities/util/TestServer.cs
new file mode 100644
index 00000000000..0df5d469c97
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/TestServer.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Threading;
+using System.Runtime.Remoting;
+using System.Runtime.Remoting.Services;
+using System.Runtime.Remoting.Channels;
+using System.Runtime.Remoting.Channels.Tcp;
+using NUnit.Core;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Base class for servers
+ /// </summary>
+ public class TestServer : ServerBase
+ {
+ private TestRunner runner;
+
+ public TestServer( string uri, int port ) : base( uri, port )
+ {
+ this.runner = new TestDomain();
+ }
+
+ public TestRunner TestRunner
+ {
+ get { return runner; }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/Transform.resx b/mcs/nunit24/ClientUtilities/util/Transform.resx
new file mode 100644
index 00000000000..479cdacf570
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/Transform.resx
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 1.3
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">1.3</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1">this is my long string</data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ [base64 mime encoded serialized .NET Framework object]
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ [base64 mime encoded string representing a byte array form of the .NET Framework object]
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>1.3</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Summary.xslt">
+ <value>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
+&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
+&lt;xsl:output method='text'/&gt;
+
+&lt;xsl:template match="/"&gt;
+ &lt;xsl:apply-templates/&gt;
+&lt;/xsl:template&gt;
+
+&lt;xsl:template match="test-results"&gt;
+&lt;xsl:text&gt;Tests run: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="@total"/&gt;
+&lt;xsl:text&gt;, Failures: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="@failures"/&gt;
+&lt;xsl:text&gt;, Not run: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="@not-run"/&gt;
+&lt;xsl:text&gt;, Time: &lt;/xsl:text&gt;
+&lt;xsl:value-of select="test-suite/@time"/&gt;
+&lt;xsl:text&gt; seconds
+&lt;/xsl:text&gt;
+&lt;xsl:text&gt;
+&lt;/xsl:text&gt;
+
+&lt;xsl:if test="//test-suite[failure]"&gt;&lt;xsl:text&gt;Test Fixture SetUp Failures:
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;
+&lt;xsl:apply-templates select="//test-suite[failure]"/&gt;
+&lt;xsl:if test="//test-case[failure]"&gt;&lt;xsl:text&gt;Test Case Failures:
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;
+&lt;xsl:apply-templates select="//test-case[failure]"/&gt;
+&lt;xsl:if test="//test-case[@executed='False']"&gt;&lt;xsl:text&gt;Tests not run:
+&lt;/xsl:text&gt;&lt;/xsl:if&gt;
+&lt;xsl:apply-templates select="//test-case[@executed='False']"/&gt;
+&lt;xsl:text disable-output-escaping='yes'&gt;&amp;#xD;&amp;#xA;&lt;/xsl:text&gt;
+&lt;/xsl:template&gt;
+
+&lt;xsl:template match="test-case|test-suite"&gt;
+ &lt;xsl:value-of select="position()"/&gt;&lt;xsl:text&gt;) &lt;/xsl:text&gt;
+ &lt;xsl:value-of select="@name"/&gt;
+ &lt;xsl:text&gt; : &lt;/xsl:text&gt;
+ &lt;xsl:value-of select="child::node()/message"/&gt;
+&lt;xsl:text disable-output-escaping='yes'&gt;&amp;#xD;&amp;#xA;&lt;/xsl:text&gt;
+ &lt;xsl:if test="failure"&gt;
+ &lt;xsl:value-of select="failure/stack-trace"/&gt;
+&lt;xsl:text&gt;
+&lt;/xsl:text&gt;
+ &lt;/xsl:if&gt;
+&lt;/xsl:template&gt;
+
+&lt;/xsl:stylesheet&gt;
+
+ </value>
+ </data>
+</root> \ No newline at end of file
diff --git a/mcs/nunit24/ClientUtilities/util/VSProject.cs b/mcs/nunit24/ClientUtilities/util/VSProject.cs
new file mode 100644
index 00000000000..3d2fe3e98f8
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/VSProject.cs
@@ -0,0 +1,328 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Text.RegularExpressions;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// This class allows loading information about
+ /// configurations and assemblies in a Visual
+ /// Studio project file and inspecting them.
+ /// Only the most common project types are
+ /// supported and an exception is thrown if
+ /// an attempt is made to load an invalid
+ /// file or one of an unknown type.
+ /// </summary>
+ public class VSProject
+ {
+ #region Static and Instance Variables
+
+ /// <summary>
+ /// VS Project extentions
+ /// </summary>
+ private static readonly string[] validExtensions = { ".csproj", ".vbproj", ".vjsproj", ".vcproj" };
+
+ /// <summary>
+ /// VS Solution extension
+ /// </summary>
+ private static readonly string solutionExtension = ".sln";
+
+ /// <summary>
+ /// Path to the file storing this project
+ /// </summary>
+ private string projectPath;
+
+ /// <summary>
+ /// Collection of configs for the project
+ /// </summary>
+ private VSProjectConfigCollection configs;
+
+ #endregion
+
+ #region Constructor
+
+ public VSProject( string projectPath )
+ {
+ this.projectPath = Path.GetFullPath( projectPath );
+ configs = new VSProjectConfigCollection();
+
+ Load();
+ }
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// The name of the project.
+ /// </summary>
+ public string Name
+ {
+ get { return Path.GetFileNameWithoutExtension( projectPath ); }
+ }
+
+ /// <summary>
+ /// The path to the project
+ /// </summary>
+ public string ProjectPath
+ {
+ get { return projectPath; }
+ }
+
+ /// <summary>
+ /// Our collection of configurations
+ /// </summary>
+ public VSProjectConfigCollection Configs
+ {
+ get { return configs; }
+ }
+
+ #endregion
+
+ #region Static Methods
+
+ public static bool IsProjectFile( string path )
+ {
+ if ( path.IndexOfAny( Path.InvalidPathChars ) >= 0 )
+ return false;
+
+ if ( path.ToLower().IndexOf( "http:" ) >= 0 )
+ return false;
+
+ string extension = Path.GetExtension( path );
+
+ foreach( string validExtension in validExtensions )
+ if ( extension == validExtension )
+ return true;
+
+ return false;
+ }
+
+ public static bool IsSolutionFile( string path )
+ {
+ return Path.GetExtension( path ) == solutionExtension;
+ }
+
+ #endregion
+
+ #region Instance Methods
+
+ private void Load()
+ {
+ if ( !IsProjectFile( projectPath ) )
+ ThrowInvalidFileType( projectPath );
+
+ string projectDirectory = Path.GetFullPath( Path.GetDirectoryName( projectPath ) );
+ StreamReader rdr = new StreamReader( projectPath, System.Text.Encoding.UTF8 );
+ string[] extensions = {"", ".exe", ".dll", ".lib", "" };
+
+ try
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load( rdr );
+
+ string extension = Path.GetExtension( projectPath );
+ string assemblyName = null;
+
+ switch ( extension )
+ {
+ case ".vcproj":
+ XmlNode topNode = doc.SelectSingleNode( "/VisualStudioProject" );
+
+ // TODO: This is all very hacked up... replace it.
+ foreach ( XmlNode configNode in doc.SelectNodes( "/VisualStudioProject/Configurations/Configuration" ) )
+ {
+ string name = RequiredAttributeValue( configNode, "Name" );
+ int config_type = System.Convert.ToInt32(RequiredAttributeValue(configNode, "ConfigurationType" ) );
+ string dirName = name;
+ int bar = dirName.IndexOf( '|' );
+ if ( bar >= 0 )
+ dirName = dirName.Substring( 0, bar );
+ string outputPath = RequiredAttributeValue( configNode, "OutputDirectory" );
+ outputPath = outputPath.Replace( "$(SolutionDir)", Path.GetFullPath( Path.GetDirectoryName( projectPath ) ) + Path.DirectorySeparatorChar );
+ outputPath = outputPath.Replace( "$(ConfigurationName)", dirName );
+
+ string outputDirectory = Path.Combine( projectDirectory, outputPath );
+ XmlNode toolNode = configNode.SelectSingleNode( "Tool[@Name='VCLinkerTool']" );
+ if ( toolNode != null )
+ {
+ assemblyName = SafeAttributeValue( toolNode, "OutputFile" );
+ if ( assemblyName != null )
+ assemblyName = Path.GetFileName( assemblyName );
+ else
+ assemblyName = Path.GetFileNameWithoutExtension(projectPath) + extensions[config_type];
+ }
+ else
+ {
+ toolNode = configNode.SelectSingleNode( "Tool[@Name='VCNMakeTool']" );
+ if ( toolNode != null )
+ assemblyName = Path.GetFileName( RequiredAttributeValue( toolNode, "Output" ) );
+ }
+
+ assemblyName = assemblyName.Replace( "$(OutDir)", outputPath );
+ assemblyName = assemblyName.Replace( "$(ProjectName)", this.Name );
+
+ VSProjectConfig config = new VSProjectConfig ( name );
+ if ( assemblyName != null )
+ config.Assemblies.Add( Path.Combine( outputDirectory, assemblyName ) );
+
+ this.configs.Add( config );
+ }
+
+ break;
+
+ case ".csproj":
+ case ".vbproj":
+ case ".vjsproj":
+ LoadProject( projectDirectory, doc );
+ break;
+
+ default:
+ break;
+ }
+ }
+ catch( FileNotFoundException )
+ {
+ throw;
+ }
+ catch( Exception e )
+ {
+ ThrowInvalidFormat( projectPath, e );
+ }
+ finally
+ {
+ rdr.Close();
+ }
+ }
+
+ private bool LoadProject(string projectDirectory, XmlDocument doc)
+ {
+ bool loaded = LoadVS2003Project(projectDirectory, doc);
+ if (loaded) return true;
+
+ loaded = LoadMSBuildProject(projectDirectory, doc);
+ if (loaded) return true;
+
+ return false;
+ }
+
+ private bool LoadVS2003Project(string projectDirectory, XmlDocument doc)
+ {
+ XmlNode settingsNode = doc.SelectSingleNode("/VisualStudioProject/*/Build/Settings");
+ if (settingsNode == null)
+ return false;
+
+ string assemblyName = RequiredAttributeValue( settingsNode, "AssemblyName" );
+ string outputType = RequiredAttributeValue( settingsNode, "OutputType" );
+
+ if (outputType == "Exe" || outputType == "WinExe")
+ assemblyName = assemblyName + ".exe";
+ else
+ assemblyName = assemblyName + ".dll";
+
+ XmlNodeList nodes = settingsNode.SelectNodes("Config");
+ if (nodes != null)
+ foreach (XmlNode configNode in nodes)
+ {
+ string name = RequiredAttributeValue( configNode, "Name" );
+ string outputPath = RequiredAttributeValue( configNode, "OutputPath" );
+ string outputDirectory = Path.Combine(projectDirectory, outputPath);
+ string assemblyPath = Path.Combine(outputDirectory, assemblyName);
+
+ VSProjectConfig config = new VSProjectConfig(name);
+ config.Assemblies.Add(assemblyPath);
+
+ configs.Add(config);
+ }
+
+ return true;
+ }
+
+ private bool LoadMSBuildProject(string projectDirectory, XmlDocument doc)
+ {
+ XmlNamespaceManager namespaceManager = new XmlNamespaceManager(doc.NameTable);
+ namespaceManager.AddNamespace("msbuild", "http://schemas.microsoft.com/developer/msbuild/2003");
+
+ XmlNodeList nodes = doc.SelectNodes("/msbuild:Project/msbuild:PropertyGroup", namespaceManager);
+ if (nodes == null) return false;
+
+ XmlElement assemblyNameElement = (XmlElement)doc.SelectSingleNode("/msbuild:Project/msbuild:PropertyGroup/msbuild:AssemblyName", namespaceManager);
+ string assemblyName = assemblyNameElement.InnerText;
+
+ XmlElement outputTypeElement = (XmlElement)doc.SelectSingleNode("/msbuild:Project/msbuild:PropertyGroup/msbuild:OutputType", namespaceManager);
+ string outputType = outputTypeElement.InnerText;
+
+ if (outputType == "Exe" || outputType == "WinExe")
+ assemblyName = assemblyName + ".exe";
+ else
+ assemblyName = assemblyName + ".dll";
+
+ foreach (XmlElement configNode in nodes)
+ {
+ if (configNode.Name != "PropertyGroup")
+ continue;
+
+ XmlAttribute conditionAttribute = configNode.Attributes["Condition"];
+ if (conditionAttribute == null) continue;
+
+ string condition = conditionAttribute.Value;
+ int start = condition.IndexOf( "==" );
+ if ( start < 0 ) continue;
+
+ string configurationName = condition.Substring( start + 2 ).Trim(new char[] {' ', '\'' } );
+ if ( configurationName.EndsWith( "|AnyCPU" ) )
+ configurationName = configurationName.Substring( 0, configurationName.Length - 7 );
+
+ XmlElement outputPathElement = (XmlElement)configNode.SelectSingleNode("msbuild:OutputPath", namespaceManager);
+ string outputPath = outputPathElement.InnerText;
+
+ string outputDirectory = Path.Combine(projectDirectory, outputPath);
+ string assemblyPath = Path.Combine(outputDirectory, assemblyName);
+
+ VSProjectConfig config = new VSProjectConfig(configurationName);
+ config.Assemblies.Add(assemblyPath);
+
+ configs.Add(config);
+ }
+
+ return true;
+ }
+
+ private void ThrowInvalidFileType(string projectPath)
+ {
+ throw new ArgumentException(
+ string.Format( "Invalid project file type: {0}",
+ Path.GetFileName( projectPath ) ) );
+ }
+
+ private void ThrowInvalidFormat( string projectPath, Exception e )
+ {
+ throw new ArgumentException(
+ string.Format( "Invalid project file format: {0}",
+ Path.GetFileName( projectPath ) ), e );
+ }
+
+ private string SafeAttributeValue( XmlNode node, string attrName )
+ {
+ XmlNode attrNode = node.Attributes[attrName];
+ return attrNode == null ? null : attrNode.Value;
+ }
+
+ private string RequiredAttributeValue( XmlNode node, string name )
+ {
+ string result = SafeAttributeValue( node, name );
+ if ( result != null )
+ return result;
+
+ throw new ApplicationException( "Missing required attribute " + name );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/VSProjectConfig.cs b/mcs/nunit24/ClientUtilities/util/VSProjectConfig.cs
new file mode 100644
index 00000000000..75770157745
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/VSProjectConfig.cs
@@ -0,0 +1,39 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections.Specialized;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Originally, we used the same ProjectConfig class for both
+ /// NUnit and Visual Studio projects. Since we really do very
+ /// little with VS Projects, this class has been created to
+ /// hold the name and the collection of assembly paths.
+ /// </summary>
+ public class VSProjectConfig
+ {
+ private string name;
+
+ private StringCollection assemblies = new StringCollection();
+
+ public VSProjectConfig( string name )
+ {
+ this.name = name;
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public StringCollection Assemblies
+ {
+ get { return assemblies; }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/VSProjectConfigCollection.cs b/mcs/nunit24/ClientUtilities/util/VSProjectConfigCollection.cs
new file mode 100644
index 00000000000..46a1bafd27c
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/VSProjectConfigCollection.cs
@@ -0,0 +1,48 @@
+// ****************************************************************
+// Copyright 2002-2003, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// A simple collection to hold VSProjectConfigs. Originally,
+ /// we used the (NUnit) ProjectConfigCollection, but the
+ /// classes have since diverged.
+ /// </summary>
+ public class VSProjectConfigCollection : CollectionBase
+ {
+ public VSProjectConfig this[int index]
+ {
+ get { return List[index] as VSProjectConfig; }
+ }
+
+ public VSProjectConfig this[string name]
+ {
+ get
+ {
+ foreach ( VSProjectConfig config in InnerList )
+ if ( config.Name == name ) return config;
+
+ return null;
+ }
+ }
+
+ public void Add( VSProjectConfig config )
+ {
+ List.Add( config );
+ }
+
+ public bool Contains( string name )
+ {
+ foreach( VSProjectConfig config in InnerList )
+ if ( config.Name == name ) return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/XmlResultTransform.cs b/mcs/nunit24/ClientUtilities/util/XmlResultTransform.cs
new file mode 100644
index 00000000000..5344e74efa5
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/XmlResultTransform.cs
@@ -0,0 +1,65 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Xml.XPath;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for XmlResultTransform.
+ /// </summary>
+ public class XmlResultTransform
+ {
+ private XslTransform xslTransform = new XslTransform();
+
+ public XmlResultTransform() { }
+
+ public XmlResultTransform( string stylesheet )
+ {
+ Load( stylesheet );
+ }
+
+ public XmlResultTransform( XmlReader reader )
+ {
+ Load( reader );
+ }
+
+ public void Load( string stylesheet )
+ {
+ xslTransform.Load( stylesheet );
+ }
+
+ public void Load( XmlReader reader )
+ {
+ // NOTE: Not compatable with .NET 1.0.
+ // xslTransform.Load(reader, null, null);
+
+ xslTransform.Load(reader);
+ }
+
+ public void Transform( string inputFile, string outputFile )
+ {
+ Transform( new StreamReader( inputFile ), new StreamWriter( outputFile ) );
+ }
+
+ public void Transform( TextReader reader, TextWriter writer )
+ {
+ Transform( new XPathDocument( reader ), writer );
+ }
+
+ public void Transform( IXPathNavigable xpnav, TextWriter writer )
+ {
+ // NOTE: Not compatable with .NET 1.0.
+ // xslTransform.Transform(xpnav, null, writer, null);
+
+ xslTransform.Transform(xpnav, null, writer);
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/XmlResultVisitor.cs b/mcs/nunit24/ClientUtilities/util/XmlResultVisitor.cs
new file mode 100644
index 00000000000..4714a360c46
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/XmlResultVisitor.cs
@@ -0,0 +1,277 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Util
+{
+ using System;
+ using System.Globalization;
+ using System.IO;
+ using System.Xml;
+ using System.Reflection;
+ using NUnit.Core;
+
+ /// <summary>
+ /// Summary description for XmlResultVisitor.
+ /// </summary>
+ public class XmlResultVisitor : ResultVisitor
+ {
+ private XmlTextWriter xmlWriter;
+ private TextWriter writer;
+ private MemoryStream memoryStream;
+
+ public XmlResultVisitor(string fileName, TestResult result)
+ {
+ xmlWriter = new XmlTextWriter( new StreamWriter(fileName, false, System.Text.Encoding.UTF8) );
+ Initialize(result);
+ }
+
+ public XmlResultVisitor( TextWriter writer, TestResult result )
+ {
+ this.memoryStream = new MemoryStream();
+ this.writer = writer;
+ this.xmlWriter = new XmlTextWriter( new StreamWriter( memoryStream, System.Text.Encoding.UTF8 ) );
+ Initialize( result );
+ }
+
+ private void Initialize(TestResult result)
+ {
+ ResultSummarizer summaryResults = new ResultSummarizer(result);
+
+ xmlWriter.Formatting = Formatting.Indented;
+ xmlWriter.WriteStartDocument(false);
+ xmlWriter.WriteComment("This file represents the results of running a test suite");
+
+ xmlWriter.WriteStartElement("test-results");
+
+ xmlWriter.WriteAttributeString("name", summaryResults.Name);
+ xmlWriter.WriteAttributeString("total", summaryResults.ResultCount.ToString());
+ xmlWriter.WriteAttributeString("failures", summaryResults.FailureCount.ToString());
+ xmlWriter.WriteAttributeString("not-run", summaryResults.TestsNotRun.ToString());
+
+ DateTime now = DateTime.Now;
+ xmlWriter.WriteAttributeString("date", XmlConvert.ToString( now, "yyyy-MM-dd" ) );
+ xmlWriter.WriteAttributeString("time", XmlConvert.ToString( now, "HH:mm:ss" ));
+ WriteEnvironment();
+ WriteCultureInfo();
+ }
+
+ private void WriteCultureInfo() {
+ xmlWriter.WriteStartElement("culture-info");
+ xmlWriter.WriteAttributeString("current-culture",
+ CultureInfo.CurrentCulture.ToString());
+ xmlWriter.WriteAttributeString("current-uiculture",
+ CultureInfo.CurrentUICulture.ToString());
+ xmlWriter.WriteEndElement();
+ }
+
+ private void WriteEnvironment() {
+ xmlWriter.WriteStartElement("environment");
+ xmlWriter.WriteAttributeString("nunit-version",
+ Assembly.GetExecutingAssembly().GetName().Version.ToString());
+ xmlWriter.WriteAttributeString("clr-version",
+ Environment.Version.ToString());
+ xmlWriter.WriteAttributeString("os-version",
+ Environment.OSVersion.ToString());
+ xmlWriter.WriteAttributeString("platform",
+ Environment.OSVersion.Platform.ToString());
+ xmlWriter.WriteAttributeString("cwd",
+ Environment.CurrentDirectory);
+ xmlWriter.WriteAttributeString("machine-name",
+ Environment.MachineName);
+ xmlWriter.WriteAttributeString("user",
+ Environment.UserName);
+ xmlWriter.WriteAttributeString("user-domain",
+ Environment.UserDomainName);
+ xmlWriter.WriteEndElement();
+ }
+
+ public void Visit(TestCaseResult caseResult)
+ {
+ xmlWriter.WriteStartElement("test-case");
+ xmlWriter.WriteAttributeString("name",caseResult.Name);
+
+ if(caseResult.Description != null)
+ xmlWriter.WriteAttributeString("description", caseResult.Description);
+
+ xmlWriter.WriteAttributeString("executed", caseResult.Executed.ToString());
+ if(caseResult.Executed)
+ {
+ xmlWriter.WriteAttributeString("success", caseResult.IsSuccess.ToString() );
+
+ xmlWriter.WriteAttributeString("time", caseResult.Time.ToString("#####0.000", NumberFormatInfo.InvariantInfo));
+
+ xmlWriter.WriteAttributeString("asserts", caseResult.AssertCount.ToString() );
+ WriteCategories(caseResult);
+ WriteProperties(caseResult);
+ if(caseResult.IsFailure)
+ {
+ if(caseResult.IsFailure)
+ xmlWriter.WriteStartElement("failure");
+ else
+ xmlWriter.WriteStartElement("error");
+
+ xmlWriter.WriteStartElement("message");
+ xmlWriter.WriteCData( EncodeCData( caseResult.Message ) );
+ xmlWriter.WriteEndElement();
+
+ xmlWriter.WriteStartElement("stack-trace");
+ if(caseResult.StackTrace != null)
+ xmlWriter.WriteCData( EncodeCData( StackTraceFilter.Filter( caseResult.StackTrace ) ) );
+ xmlWriter.WriteEndElement();
+
+ xmlWriter.WriteEndElement();
+ }
+
+ }
+ else
+ {
+ WriteCategories(caseResult);
+ WriteProperties(caseResult);
+ xmlWriter.WriteStartElement("reason");
+ xmlWriter.WriteStartElement("message");
+ xmlWriter.WriteCData(caseResult.Message);
+ xmlWriter.WriteEndElement();
+ xmlWriter.WriteEndElement();
+ }
+
+ xmlWriter.WriteEndElement();
+ }
+
+ /// <summary>
+ /// Makes string safe for xml parsing, replacing control chars with '?'
+ /// </summary>
+ /// <param name="encodedString">string to make safe</param>
+ /// <returns>xml safe string</returns>
+ private static string CharacterSafeString(string encodedString)
+ {
+ /*The default code page for the system will be used.
+ Since all code pages use the same lower 128 bytes, this should be sufficient
+ for finding uprintable control characters that make the xslt processor error.
+ We use characters encoded by the default code page to avoid mistaking bytes as
+ individual characters on non-latin code pages.*/
+ char[] encodedChars = System.Text.Encoding.Default.GetChars(System.Text.Encoding.Default.GetBytes(encodedString));
+
+ System.Collections.ArrayList pos = new System.Collections.ArrayList();
+ for(int x = 0 ; x < encodedChars.Length ; x++)
+ {
+ char currentChar = encodedChars[x];
+ //unprintable characters are below 0x20 in Unicode tables
+ //some control characters are acceptable. (carriage return 0x0D, line feed 0x0A, horizontal tab 0x09)
+ if(currentChar < 32 && (currentChar != 9 && currentChar != 10 && currentChar != 13))
+ {
+ //save the array index for later replacement.
+ pos.Add(x);
+ }
+ }
+ foreach(int index in pos)
+ {
+ encodedChars[index] = '?';//replace unprintable control characters with ?(3F)
+ }
+ return System.Text.Encoding.Default.GetString(System.Text.Encoding.Default.GetBytes(encodedChars));
+ }
+
+ private string EncodeCData( string text )
+ {
+ return CharacterSafeString( text ).Replace( "]]>", "]]&gt;" );
+ }
+
+ public void WriteCategories(TestResult result)
+ {
+ if (result.Test.Categories != null && result.Test.Categories.Count > 0)
+ {
+ xmlWriter.WriteStartElement("categories");
+ foreach (string category in result.Test.Categories)
+ {
+ xmlWriter.WriteStartElement("category");
+ xmlWriter.WriteAttributeString("name", category);
+ xmlWriter.WriteEndElement();
+ }
+ xmlWriter.WriteEndElement();
+ }
+ }
+
+ public void WriteProperties(TestResult result)
+ {
+ if (result.Test.Properties != null && result.Test.Properties.Count > 0)
+ {
+ xmlWriter.WriteStartElement("properties");
+ foreach (string key in result.Test.Properties.Keys)
+ {
+ xmlWriter.WriteStartElement("property");
+ xmlWriter.WriteAttributeString("name", key);
+ xmlWriter.WriteAttributeString("value", result.Test.Properties[key].ToString() );
+ xmlWriter.WriteEndElement();
+ }
+ xmlWriter.WriteEndElement();
+ }
+ }
+
+ public void Visit(TestSuiteResult suiteResult)
+ {
+ xmlWriter.WriteStartElement("test-suite");
+ xmlWriter.WriteAttributeString("name",suiteResult.Name);
+ if(suiteResult.Description != null)
+ xmlWriter.WriteAttributeString("description", suiteResult.Description);
+
+ xmlWriter.WriteAttributeString("success", suiteResult.IsSuccess.ToString());
+ xmlWriter.WriteAttributeString("time", suiteResult.Time.ToString("#####0.000", NumberFormatInfo.InvariantInfo));
+ xmlWriter.WriteAttributeString("asserts", suiteResult.AssertCount.ToString() );
+
+ WriteCategories(suiteResult);
+ WriteProperties(suiteResult);
+
+ if ( suiteResult.IsFailure && suiteResult.FailureSite == FailureSite.SetUp )
+ {
+ xmlWriter.WriteStartElement("failure");
+
+ xmlWriter.WriteStartElement("message");
+ xmlWriter.WriteCData( EncodeCData( suiteResult.Message ) );
+ xmlWriter.WriteEndElement();
+
+ xmlWriter.WriteStartElement("stack-trace");
+ if(suiteResult.StackTrace != null)
+ xmlWriter.WriteCData( EncodeCData( StackTraceFilter.Filter( suiteResult.StackTrace ) ) );
+ xmlWriter.WriteEndElement();
+
+ xmlWriter.WriteEndElement();
+ }
+
+ xmlWriter.WriteStartElement("results");
+ foreach (TestResult result in suiteResult.Results)
+ {
+ result.Accept(this);
+ }
+ xmlWriter.WriteEndElement();
+
+ xmlWriter.WriteEndElement();
+ }
+
+ public void Write()
+ {
+ try
+ {
+ xmlWriter.WriteEndElement();
+ xmlWriter.WriteEndDocument();
+ xmlWriter.Flush();
+
+ if ( memoryStream != null && writer != null )
+ {
+ memoryStream.Position = 0;
+ using ( StreamReader rdr = new StreamReader( memoryStream ) )
+ {
+ writer.Write( rdr.ReadToEnd() );
+ }
+ }
+
+ xmlWriter.Close();
+ }
+ finally
+ {
+ //writer.Close();
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/XmlSettingsStorage.cs b/mcs/nunit24/ClientUtilities/util/XmlSettingsStorage.cs
new file mode 100644
index 00000000000..78dfd799019
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/XmlSettingsStorage.cs
@@ -0,0 +1,91 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Collections;
+using System.ComponentModel;
+
+namespace NUnit.Util
+{
+ /// <summary>
+ /// Summary description for XmlSettingsStorage.
+ /// </summary>
+ public class XmlSettingsStorage : MemorySettingsStorage
+ {
+ private string filePath;
+
+ public XmlSettingsStorage( string filePath )
+ {
+ this.filePath = filePath;
+ }
+
+ public override void LoadSettings()
+ {
+ FileInfo info = new FileInfo(filePath);
+ if ( !info.Exists || info.Length == 0 )
+ return;
+
+ try
+ {
+ XmlDocument doc = new XmlDocument();
+ doc.Load( filePath );
+
+ foreach( XmlElement element in doc.DocumentElement["Settings"].ChildNodes )
+ {
+ if ( element.Name != "Setting" )
+ throw new ApplicationException( "Unknown element in settings file: " + element.Name );
+
+ if ( !element.HasAttribute( "name" ) )
+ throw new ApplicationException( "Setting must have 'name' attribute" );
+
+ if ( !element.HasAttribute( "value" ) )
+ throw new ApplicationException( "Setting must have 'value' attribute" );
+
+ settings[ element.GetAttribute( "name" ) ] = element.GetAttribute( "value" );
+ }
+ }
+ catch( Exception ex )
+ {
+ throw new ApplicationException( "Error loading settings file", ex );
+ }
+ }
+
+ public override void SaveSettings()
+ {
+ string dirPath = Path.GetDirectoryName( filePath );
+ if ( !Directory.Exists( dirPath ) )
+ Directory.CreateDirectory( dirPath );
+
+ XmlTextWriter writer = new XmlTextWriter( filePath, System.Text.Encoding.UTF8 );
+ writer.Formatting = Formatting.Indented;
+
+ writer.WriteProcessingInstruction( "xml", "version=\"1.0\"" );
+ writer.WriteStartElement( "NUnitSettings" );
+ writer.WriteStartElement( "Settings" );
+
+ ArrayList keys = new ArrayList( settings.Keys );
+ keys.Sort();
+
+ foreach( string name in keys )
+ {
+ object val = settings[name];
+ if ( val != null )
+ {
+ writer.WriteStartElement( "Setting");
+ writer.WriteAttributeString( "name", name );
+ writer.WriteAttributeString( "value", val.ToString() );
+ writer.WriteEndElement();
+ }
+ }
+
+ writer.WriteEndElement();
+ writer.WriteEndElement();
+ writer.Close();
+ }
+ }
+}
diff --git a/mcs/nunit24/ClientUtilities/util/nunit.util.build b/mcs/nunit24/ClientUtilities/util/nunit.util.build
new file mode 100644
index 00000000000..03536b54d5b
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/nunit.util.build
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<project name="NUnitUtil" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.util.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="AggregatingTestRunner.cs"/>
+ <include name="AssemblyInfo.cs"/>
+ <include name="AssemblyList.cs"/>
+ <include name="AssemblyWatcher.cs"/>
+ <include name="CategoryExpression.cs"/>
+ <include name="CategoryManager.cs"/>
+ <include name="CommandLineOptions.cs"/>
+ <include name="ConsoleWriter.cs"/>
+ <include name="ISettings.cs"/>
+ <include name="ITestEvents.cs"/>
+ <include name="ITestLoader.cs"/>
+ <include name="MemorySettingsStorage.cs"/>
+ <include name="MultipleTestDomainRunner.cs"/>
+ <include name="NUnitProject.cs"/>
+ <include name="NUnitRegistry.cs"/>
+ <include name="PathUtils.cs"/>
+ <include name="ProcessRunner.cs"/>
+ <include name="ProjectConfig.cs"/>
+ <include name="ProjectConfigCollection.cs"/>
+ <include name="ProjectFormatException.cs"/>
+ <include name="RecentFileEntry.cs"/>
+ <include name="RecentFiles.cs"/>
+ <include name="RecentFilesCollection.cs"/>
+ <include name="RegistrySettingsStorage.cs"/>
+ <include name="RemoteTestAgent.cs"/>
+ <include name="ResultSummarizer.cs"/>
+ <include name="ServerBase.cs"/>
+ <include name="ServerUtilities.cs"/>
+ <include name="Services.cs"/>
+ <include name="SettingsGroup.cs"/>
+ <include name="SettingsStorage.cs"/>
+ <include name="StackTraceFilter.cs"/>
+ <include name="SummaryVisitor.cs"/>
+ <include name="TestAgent.cs"/>
+ <include name="TestDomain.cs"/>
+ <include name="TestEventArgs.cs"/>
+ <include name="TestEventDispatcher.cs"/>
+ <include name="TestExceptionHandler.cs"/>
+ <include name="TestLoader.cs"/>
+ <include name="TestObserver.cs"/>
+ <include name="TestResultItem.cs"/>
+ <include name="TestServer.cs"/>
+ <include name="VSProject.cs"/>
+ <include name="VSProjectConfig.cs"/>
+ <include name="VSProjectConfigCollection.cs"/>
+ <include name="XmlResultTransform.cs"/>
+ <include name="XmlResultVisitor.cs"/>
+ <include name="XmlSettingsStorage.cs"/>
+ <include name="Services/AddinManager.cs"/>
+ <include name="Services/AddinRegistry.cs"/>
+ <include name="Services/DomainManager.cs"/>
+ <include name="Services/RecentFilesService.cs"/>
+ <include name="Services/ServiceManager.cs"/>
+ <include name="Services/SettingsService.cs"/>
+ <include name="Services/TestAgency.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="618"/>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <resources prefix="NUnit.Util">
+ <include name="Transform.resx"/>
+ </resources>
+ <references basedir="${current.build.dir}">
+ <include name="System.Runtime.Remoting.dll"/>
+ <include name="nunit.core.interfaces.dll"/>
+ <include name="nunit.core.dll"/>
+ <include name="nunit.framework.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/ClientUtilities/util">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project>
diff --git a/mcs/nunit24/ClientUtilities/util/nunit.util.dll.csproj b/mcs/nunit24/ClientUtilities/util/nunit.util.dll.csproj
new file mode 100644
index 00000000000..6eedbd145f1
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/nunit.util.dll.csproj
@@ -0,0 +1,395 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{61CE9CE5-943E-44D4-A381-814DC1406767}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.util"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Util"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = "618"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = "618"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "System.Runtime.Remoting"
+ AssemblyName = "System.Runtime.Remoting"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Runtime.Remoting.dll"
+ />
+ <Reference
+ Name = "nunit.core.dll"
+ Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.interfaces.dll"
+ Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "System.Drawing"
+ AssemblyName = "System.Drawing"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AggregatingTestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyList.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyWatcher.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CategoryExpression.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CategoryManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommandLineOptions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConsoleWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ISettings.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestEvents.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MemorySettingsStorage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MultipleTestDomainRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitProject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitRegistry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PathUtils.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProcessRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProjectConfig.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProjectConfigCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProjectFormatException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RecentFileEntry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RecentFiles.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RecentFilesCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RegistrySettingsStorage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RemoteTestAgent.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ResultSummarizer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ServerBase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ServerUtilities.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SettingsGroup.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SettingsStorage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StackTraceFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SummaryVisitor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestAgent.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestDomain.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestEventArgs.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestEventDispatcher.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestExceptionHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestLoader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestObserver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestResultItem.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestServer.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Transform.resx"
+ BuildAction = "EmbeddedResource"
+ />
+ <File
+ RelPath = "VSProject.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "VSProjectConfig.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "VSProjectConfigCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlResultTransform.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlResultVisitor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "XmlSettingsStorage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\AddinManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\AddinRegistry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\DomainManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\RecentFilesService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\ServiceManager.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\SettingsService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Services\TestAgency.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/ClientUtilities/util/nunit.util.dll.sources b/mcs/nunit24/ClientUtilities/util/nunit.util.dll.sources
new file mode 100644
index 00000000000..8e31fd3b7a3
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/nunit.util.dll.sources
@@ -0,0 +1,59 @@
+../../CommonAssemblyInfo.cs
+AggregatingTestRunner.cs
+AssemblyInfo.cs
+AssemblyItem.cs
+AssemblyList.cs
+AssemblyWatcher.cs
+CategoryExpression.cs
+CategoryManager.cs
+CommandLineOptions.cs
+ConsoleWriter.cs
+ISettings.cs
+ITestEvents.cs
+ITestLoader.cs
+MemorySettingsStorage.cs
+MultipleTestDomainRunner.cs
+NUnitProject.cs
+NUnitRegistry.cs
+PathUtils.cs
+ProcessRunner.cs
+ProjectConfig.cs
+ProjectConfigCollection.cs
+ProjectFormatException.cs
+ProxyTestRunner.cs
+RecentFileEntry.cs
+RecentFiles.cs
+RecentFilesCollection.cs
+RegistrySettingsStorage.cs
+RemoteTestAgent.cs
+ResultSummarizer.cs
+ServerBase.cs
+ServerUtilities.cs
+Services.cs
+Services/AddinManager.cs
+Services/AddinRegistry.cs
+Services/DomainManager.cs
+Services/RecentFilesService.cs
+Services/ServiceManager.cs
+Services/SettingsService.cs
+Services/TestAgency.cs
+Services/TestAgentManager.cs
+SettingsGroup.cs
+SettingsStorage.cs
+StackTraceFilter.cs
+SummaryVisitor.cs
+TestAgent.cs
+TestDomain.cs
+TestEventArgs.cs
+TestEventDispatcher.cs
+TestExceptionHandler.cs
+TestLoader.cs
+TestObserver.cs
+TestResultItem.cs
+TestServer.cs
+VSProject.cs
+VSProjectConfig.cs
+VSProjectConfigCollection.cs
+XmlResultTransform.cs
+XmlResultVisitor.cs
+XmlSettingsStorage.cs
diff --git a/mcs/nunit24/ClientUtilities/util/nunit.util.dll_VS2005.csproj b/mcs/nunit24/ClientUtilities/util/nunit.util.dll_VS2005.csproj
new file mode 100644
index 00000000000..0a152f68b6d
--- /dev/null
+++ b/mcs/nunit24/ClientUtilities/util/nunit.util.dll_VS2005.csproj
@@ -0,0 +1,208 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{61CE9CE5-943E-44D4-A381-814DC1406767}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.util</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Util</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <SignAssembly>false</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <NoWarn>618,1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <NoWarn>618,1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Runtime.Remoting">
+ <Name>System.Runtime.Remoting</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="AggregatingTestRunner.cs" />
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssemblyList.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssemblyWatcher.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="CategoryExpression.cs" />
+ <Compile Include="CategoryManager.cs" />
+ <Compile Include="CommandLineOptions.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ConsoleWriter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ISettings.cs" />
+ <Compile Include="ITestEvents.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ITestLoader.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MemorySettingsStorage.cs" />
+ <Compile Include="MultipleTestDomainRunner.cs" />
+ <Compile Include="NUnitProject.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NUnitRegistry.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="PathUtils.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ProcessRunner.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ProjectConfig.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ProjectConfigCollection.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ProjectFormatException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="RecentFileEntry.cs" />
+ <Compile Include="RecentFiles.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="RecentFilesCollection.cs" />
+ <Compile Include="RegistrySettingsStorage.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="RemoteTestAgent.cs" />
+ <Compile Include="ResultSummarizer.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ServerBase.cs" />
+ <Compile Include="ServerUtilities.cs" />
+ <Compile Include="Services.cs" />
+ <Compile Include="Services\AddinManager.cs" />
+ <Compile Include="Services\AddinRegistry.cs" />
+ <Compile Include="Services\DomainManager.cs" />
+ <Compile Include="Services\RecentFilesService.cs" />
+ <Compile Include="Services\ServiceManager.cs" />
+ <Compile Include="Services\SettingsService.cs" />
+ <Compile Include="Services\TestAgency.cs" />
+ <Compile Include="SettingsGroup.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SettingsStorage.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="StackTraceFilter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SummaryVisitor.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestAgent.cs" />
+ <Compile Include="TestDomain.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestEventArgs.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestEventDispatcher.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestExceptionHandler.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestLoader.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestObserver.cs" />
+ <Compile Include="TestResultItem.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestServer.cs" />
+ <Compile Include="VSProject.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="VSProjectConfig.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="VSProjectConfigCollection.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlResultTransform.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlResultVisitor.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="XmlSettingsStorage.cs" />
+ <EmbeddedResource Include="Transform.resx">
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\NUnitCore\core\nunit.core.dll_VS2005.csproj">
+ <Project>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</Project>
+ <Name>nunit.core.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
+ <Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
+ <Name>nunit.core.interfaces.dll_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Services\CVS\Entries" />
+ <None Include="Services\CVS\Repository" />
+ <None Include="Services\CVS\Root" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/CommonAssemblyInfo.cs b/mcs/nunit24/CommonAssemblyInfo.cs
new file mode 100644
index 00000000000..6ad5996526b
--- /dev/null
+++ b/mcs/nunit24/CommonAssemblyInfo.cs
@@ -0,0 +1,34 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Reflection;
+
+//
+// Common Information about all NUnit assemblies is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+//[assembly: AssemblyTitle("")]
+//[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("NUnit.org")]
+[assembly: AssemblyProduct("NUnit")]
+[assembly: AssemblyCopyright("Copyright (C) 2002-2007 Charlie Poole.\r\nCopyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\nCopyright (C) 2000-2002 Philip Craig.\r\nAll Rights Reserved.")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("2.4.8")]
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/App.config b/mcs/nunit24/ConsoleRunner/nunit-console-exe/App.config
new file mode 100644
index 00000000000..dbae728e9bb
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/App.config
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<configuration>
+
+ <!-- Do not remove. Sets up configsectionhandler section for log4net -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+
+ <!--
+ Application settings for NUnit-console.exe. Do NOT put settings
+ for use by your tests here.
+ -->
+ <appSettings>
+
+ <!--
+ Specify the location to be used by .NET for the cache
+ -->
+ <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
+
+ </appSettings>
+
+ <system.diagnostics>
+ <switches>
+ <add name="NTrace" value="4" />
+ </switches>
+ <trace autoflush="true" indentsize="4">
+ <listeners>
+ <add name="NUnitInternalTrace" type="System.Diagnostics.TextWriterTraceListener"
+ initializeData="C:\NUnitPrimaryTrace.txt"/>
+ </listeners>
+ </trace>
+ </system.diagnostics>
+
+ <!--
+ The startup section may be used to specify the runtime versions
+ supported in the order that they will be used if more than one
+ is present. As supplied, this section is commented out, which
+ causes nunit-console to use the version of the framework with
+ which it was built.
+
+ Since .NET 1.0 does not recognize the <supportedRuntime> elements,
+ a <requiredRuntime> element is used in case it is the only version
+ of the framework that is installed.
+ -->
+ <!--
+ <startup>
+ <supportedRuntime version="v2.0.50727" />
+ <supportedRuntime version="v2.0.50215" />
+ <supportedRuntime version="v2.0.40607" />
+ <supportedRuntime version="v1.1.4322" />
+ <supportedRuntime version="v1.0.3705" />
+
+ <requiredRuntime version="v1.0.3705" />
+ </startup>
+ -->
+
+ <!--
+ The following <runtime> section allows running nunit under
+ .NET 1.0 by redirecting assemblies. The appliesTo attribute
+ causes the section to be ignored except under .NET 1.0version 1
+ on a machine with only the .NET version 1.0 runtime installed.
+ If application and its tests were built for .NET 1.1 you will
+ also need to redirect system assemblies in the test config file.
+ -->
+
+ <runtime>
+
+ <legacyUnhandledExceptionPolicy enabled="1" />
+
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
+ appliesTo="v1.0.3705">
+
+ <dependentAssembly>
+ <assemblyIdentity name="System"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Data"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Drawing"
+ publicKeyToken="b03f5f7f11d50a3a"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Windows.Forms"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ </assemblyBinding>
+
+ </runtime>
+
+</configuration> \ No newline at end of file
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/App.ico b/mcs/nunit24/ConsoleRunner/nunit-console-exe/App.ico
new file mode 100644
index 00000000000..3a5525fd794
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/App.ico
Binary files differ
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/Class1.cs b/mcs/nunit24/ConsoleRunner/nunit-console-exe/Class1.cs
new file mode 100644
index 00000000000..4c55206a32b
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/Class1.cs
@@ -0,0 +1,25 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.ConsoleRunner
+{
+ /// <summary>
+ /// Summary description for Class1.
+ /// </summary>
+ class Class1
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ public static int Main(string[] args)
+ {
+ return Runner.Main( args );
+ }
+ }
+}
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile b/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile
new file mode 100644
index 00000000000..5dd58936f42
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/Makefile
@@ -0,0 +1,13 @@
+thisdir = nunit24/ConsoleRunner/nunit-console-exe
+SUBDIRS =
+include ../../../build/rules.make
+
+PROGRAM = $(topdir)/class/lib/$(PROFILE)/nunit-console.exe
+LOCAL_MCS_FLAGS = \
+ /r:nunit.framework.dll /r:nunit.util.dll /r:nunit.core.dll \
+ /r:nunit-console-runner.dll
+EXTRA_DISTFILES = App.ico nunit-console.csproj \
+ nunit-console.exe.config.net_2_0 \
+ nunit-console.exe.config.net_3_5
+
+include ../../../build/executable.make
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/assemblyinfo.cs b/mcs/nunit24/ConsoleRunner/nunit-console-exe/assemblyinfo.cs
new file mode 100644
index 00000000000..1df6de23016
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/assemblyinfo.cs
@@ -0,0 +1,11 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+[assembly: AssemblyTitle("NUnit-Console")]
+[assembly: AssemblyDescription("")] \ No newline at end of file
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.build b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.build
new file mode 100644
index 00000000000..102dd2f94ca
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.build
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<project name="NUnit-Console" default="build">
+
+ <target name="build">
+ <csc target="exe"
+ output="${current.build.dir}/${nunit.console.name}"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="Class1.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.core.dll"/>
+ <include name="nunit.util.dll"/>
+ <include name="nunit-console-runner.dll"/>
+ </references>
+ </csc>
+
+ <copy file="App.config"
+ tofile="${current.build.dir}/${nunit.console.name}.config"/>
+
+ <csc target="exe"
+ output="${current.build.dir}/${nunit.console.name.x86}"
+ debug="${build.debug}" define="${build.defines}"
+ platform="x86" if="${build.x86}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="Class1.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.core.dll"/>
+ <include name="nunit.util.dll"/>
+ <include name="nunit-console-runner.dll"/>
+ </references>
+ </csc>
+
+ <copy file="App.config" if="${build.x86}"
+ tofile="${current.build.dir}/${nunit.console.name.x86}.config"/>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/ConsoleRunner/nunit-console-exe">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project>
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config
new file mode 100644
index 00000000000..dbae728e9bb
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<configuration>
+
+ <!-- Do not remove. Sets up configsectionhandler section for log4net -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+
+ <!--
+ Application settings for NUnit-console.exe. Do NOT put settings
+ for use by your tests here.
+ -->
+ <appSettings>
+
+ <!--
+ Specify the location to be used by .NET for the cache
+ -->
+ <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
+
+ </appSettings>
+
+ <system.diagnostics>
+ <switches>
+ <add name="NTrace" value="4" />
+ </switches>
+ <trace autoflush="true" indentsize="4">
+ <listeners>
+ <add name="NUnitInternalTrace" type="System.Diagnostics.TextWriterTraceListener"
+ initializeData="C:\NUnitPrimaryTrace.txt"/>
+ </listeners>
+ </trace>
+ </system.diagnostics>
+
+ <!--
+ The startup section may be used to specify the runtime versions
+ supported in the order that they will be used if more than one
+ is present. As supplied, this section is commented out, which
+ causes nunit-console to use the version of the framework with
+ which it was built.
+
+ Since .NET 1.0 does not recognize the <supportedRuntime> elements,
+ a <requiredRuntime> element is used in case it is the only version
+ of the framework that is installed.
+ -->
+ <!--
+ <startup>
+ <supportedRuntime version="v2.0.50727" />
+ <supportedRuntime version="v2.0.50215" />
+ <supportedRuntime version="v2.0.40607" />
+ <supportedRuntime version="v1.1.4322" />
+ <supportedRuntime version="v1.0.3705" />
+
+ <requiredRuntime version="v1.0.3705" />
+ </startup>
+ -->
+
+ <!--
+ The following <runtime> section allows running nunit under
+ .NET 1.0 by redirecting assemblies. The appliesTo attribute
+ causes the section to be ignored except under .NET 1.0version 1
+ on a machine with only the .NET version 1.0 runtime installed.
+ If application and its tests were built for .NET 1.1 you will
+ also need to redirect system assemblies in the test config file.
+ -->
+
+ <runtime>
+
+ <legacyUnhandledExceptionPolicy enabled="1" />
+
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
+ appliesTo="v1.0.3705">
+
+ <dependentAssembly>
+ <assemblyIdentity name="System"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Data"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Drawing"
+ publicKeyToken="b03f5f7f11d50a3a"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Windows.Forms"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ </assemblyBinding>
+
+ </runtime>
+
+</configuration> \ No newline at end of file
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config.net_2_0 b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config.net_2_0
new file mode 100644
index 00000000000..5a7e1c352af
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.config.net_2_0
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<configuration>
+
+ <!-- Do not remove. Sets up configsectionhandler section for log4net -->
+ <configSections>
+ <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
+ </configSections>
+
+ <!--
+ Application settings for NUnit-console.exe. Do NOT put settings
+ for use by your tests here.
+ -->
+ <appSettings>
+
+ <!--
+ Specify the location to be used by .NET for the cache
+ -->
+ <add key="shadowfiles.path" value="%temp%\nunit20\ShadowCopyCache" />
+
+ </appSettings>
+
+ <system.diagnostics>
+ <switches>
+ <add name="NTrace" value="4" />
+ </switches>
+ <trace autoflush="true" indentsize="4">
+ <listeners>
+ <add name="NUnitInternalTrace" type="System.Diagnostics.TextWriterTraceListener"
+ initializeData="C:\NUnitPrimaryTrace.txt"/>
+ </listeners>
+ </trace>
+ </system.diagnostics>
+
+ <!--
+ The startup section may be used to specify the runtime versions
+ supported in the order that they will be used if more than one
+ is present. As supplied, this section is commented out, which
+ causes nunit-console to use the version of the framework with
+ which it was built.
+
+ Since .NET 1.0 does not recognize the <supportedRuntime> elements,
+ a <requiredRuntime> element is used in case it is the only version
+ of the framework that is installed.
+ -->
+ <startup>
+ <supportedRuntime version="v2.0.50727" />
+ </startup>
+
+ <!--
+ The following <runtime> section allows running nunit under
+ .NET 1.0 by redirecting assemblies. The appliesTo attribute
+ causes the section to be ignored except under .NET 1.0version 1
+ on a machine with only the .NET version 1.0 runtime installed.
+ If application and its tests were built for .NET 1.1 you will
+ also need to redirect system assemblies in the test config file.
+ -->
+
+ <runtime>
+
+ <legacyUnhandledExceptionPolicy enabled="1" />
+
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
+ appliesTo="v1.0.3705">
+
+ <dependentAssembly>
+ <assemblyIdentity name="System"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Data"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Drawing"
+ publicKeyToken="b03f5f7f11d50a3a"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Windows.Forms"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ <dependentAssembly>
+ <assemblyIdentity name="System.Xml"
+ publicKeyToken="b77a5c561934e089"
+ culture="neutral"/>
+ <bindingRedirect oldVersion="1.0.5000.0"
+ newVersion="1.0.3300.0"/>
+ </dependentAssembly>
+
+ </assemblyBinding>
+
+ </runtime>
+
+</configuration>
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.csproj b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.csproj
new file mode 100644
index 00000000000..5da2ecad932
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.csproj
@@ -0,0 +1,124 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = "App.ico"
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit-console"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Exe"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.ConsoleRunner"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit-console"
+ Project = "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.extensions.dll"
+ Project = "{98B10E98-003C-45A0-9587-119142E39986}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "app.config"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "App.ico"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "assemblyinfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Class1.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.sources b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.sources
new file mode 100644
index 00000000000..287078927cb
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe.sources
@@ -0,0 +1,3 @@
+../../CommonAssemblyInfo.cs
+Class1.cs
+assemblyinfo.cs
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe_VS2005.csproj b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe_VS2005.csproj
new file mode 100644
index 00000000000..1646b44202b
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console-exe/nunit-console.exe_VS2005.csproj
@@ -0,0 +1,79 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>App.ico</ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit-console</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>NUnit.ConsoleRunner</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <Content Include="App.ico" />
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="Class1.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\NUnitExtensions\core\nunit.core.extensions.dll_VS2005.csproj">
+ <Project>{98B10E98-003C-45A0-9587-119142E39986}</Project>
+ <Name>nunit.core.extensions.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\nunit-console\nunit-console_VS2005.csproj">
+ <Project>{9367EC89-6A38-42BA-9607-0DC288E4BC3A}</Project>
+ <Name>nunit-console_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/App.ico b/mcs/nunit24/ConsoleRunner/nunit-console/App.ico
new file mode 100644
index 00000000000..3a5525fd794
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/App.ico
Binary files differ
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs b/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs
new file mode 100644
index 00000000000..919ca07ace3
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/AssemblyInfo.cs
@@ -0,0 +1,11 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Reflection;
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/ConsoleOptions.cs b/mcs/nunit24/ConsoleRunner/nunit-console/ConsoleOptions.cs
new file mode 100644
index 00000000000..1df69aa69a2
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/ConsoleOptions.cs
@@ -0,0 +1,127 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.ConsoleRunner
+{
+ using System;
+ using Codeblast;
+ using NUnit.Util;
+
+ public class ConsoleOptions : CommandLineOptions
+ {
+ public enum DomainUsage
+ {
+ Default,
+ None,
+ Single,
+ Multiple
+ }
+
+ [Option(Short="load", Description = "Test fixture to be loaded")]
+ public string fixture;
+
+ [Option(Description = "Name of the test to run")]
+ public string run;
+
+ [Option(Description = "Project configuration to load")]
+ public string config;
+
+ [Option(Description = "Name of XML output file")]
+ public string xml;
+
+ [Option(Description = "Name of transform file")]
+ public string transform;
+
+ [Option(Description = "Display XML to the console")]
+ public bool xmlConsole;
+
+ [Option(Short="out", Description = "File to receive test output")]
+ public string output;
+
+ [Option(Description = "File to receive test error output")]
+ public string err;
+
+ [Option(Description = "Label each test in stdOut")]
+ public bool labels = false;
+
+ [Option(Description = "List of categories to include")]
+ public string include;
+
+ [Option(Description = "List of categories to exclude")]
+ public string exclude;
+
+// [Option(Description = "Run in a separate process")]
+// public bool process;
+
+ [Option(Description = "AppDomain Usage for Tests")]
+ public DomainUsage domain;
+
+ [Option(Description = "Disable shadow copy when running in separate domain")]
+ public bool noshadow;
+
+ [Option (Description = "Disable use of a separate thread for tests")]
+ public bool nothread;
+
+ [Option(Description = "Wait for input before closing console window")]
+ public bool wait = false;
+
+ [Option(Description = "Do not display the logo")]
+ public bool nologo = false;
+
+ [Option(Description = "Do not display progress" )]
+ public bool nodots = false;
+
+ [Option(Short="?", Description = "Display help")]
+ public bool help = false;
+
+ public ConsoleOptions( params string[] args ) : base( args ) {}
+
+ public ConsoleOptions( bool allowForwardSlash, params string[] args ) : base( allowForwardSlash, args ) {}
+
+ public bool Validate()
+ {
+ if(isInvalid) return false;
+
+ if(NoArgs) return true;
+
+ if(ParameterCount >= 1) return true;
+
+ return false;
+ }
+
+ protected override bool IsValidParameter(string parm)
+ {
+ return NUnitProject.CanLoadAsProject( parm ) || PathUtils.IsAssemblyFileType( parm );
+ }
+
+
+ public bool IsTestProject
+ {
+ get
+ {
+ return ParameterCount == 1 && NUnitProject.CanLoadAsProject((string)Parameters[0]);
+ }
+ }
+
+ public override void Help()
+ {
+ Console.WriteLine();
+ Console.WriteLine( "NUNIT-CONSOLE [inputfiles] [options]" );
+ Console.WriteLine();
+ Console.WriteLine( "Runs a set of NUnit tests from the console." );
+ Console.WriteLine();
+ Console.WriteLine( "You may specify one or more assemblies or a single" );
+ Console.WriteLine( "project file of type .nunit." );
+ Console.WriteLine();
+ Console.WriteLine( "Options:" );
+ base.Help();
+ Console.WriteLine();
+ Console.WriteLine( "Options that take values may use an equal sign, a colon" );
+ Console.WriteLine( "or a space to separate the option from its value." );
+ Console.WriteLine();
+ }
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/ConsoleUi.cs b/mcs/nunit24/ConsoleRunner/nunit-console/ConsoleUi.cs
new file mode 100644
index 00000000000..7cfc1e3bab7
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/ConsoleUi.cs
@@ -0,0 +1,275 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.ConsoleRunner
+{
+ using System;
+ using System.IO;
+ using System.Reflection;
+ using System.Xml;
+ using System.Resources;
+ using System.Text;
+ using NUnit.Core;
+ using NUnit.Core.Filters;
+ using NUnit.Util;
+
+ /// <summary>
+ /// Summary description for ConsoleUi.
+ /// </summary>
+ public class ConsoleUi
+ {
+ public static readonly int OK = 0;
+ public static readonly int INVALID_ARG = -1;
+ public static readonly int FILE_NOT_FOUND = -2;
+ public static readonly int FIXTURE_NOT_FOUND = -3;
+ public static readonly int TRANSFORM_ERROR = -4;
+ public static readonly int UNEXPECTED_ERROR = -100;
+
+ public ConsoleUi()
+ {
+ }
+
+ public int Execute( ConsoleOptions options )
+ {
+ XmlTextReader transformReader = GetTransformReader(options);
+ if(transformReader == null) return FILE_NOT_FOUND;
+
+ TextWriter outWriter = Console.Out;
+ bool redirectOutput = options.output != null && options.output != string.Empty;
+ if ( redirectOutput )
+ {
+ StreamWriter outStreamWriter = new StreamWriter( options.output );
+ outStreamWriter.AutoFlush = true;
+ outWriter = outStreamWriter;
+ }
+
+ TextWriter errorWriter = Console.Error;
+ bool redirectError = options.err != null && options.err != string.Empty;
+ if ( redirectError )
+ {
+ StreamWriter errorStreamWriter = new StreamWriter( options.err );
+ errorStreamWriter.AutoFlush = true;
+ errorWriter = errorStreamWriter;
+ }
+
+ TestRunner testRunner = MakeRunnerFromCommandLine( options );
+
+ try
+ {
+ if (testRunner.Test == null)
+ {
+ testRunner.Unload();
+ Console.Error.WriteLine("Unable to locate fixture {0}", options.fixture);
+ return FIXTURE_NOT_FOUND;
+ }
+
+ EventCollector collector = new EventCollector( options, outWriter, errorWriter );
+
+ TestFilter testFilter = TestFilter.Empty;
+ if ( options.run != null && options.run != string.Empty )
+ {
+ Console.WriteLine( "Selected test: " + options.run );
+ testFilter = new SimpleNameFilter( options.run );
+ }
+
+ if ( options.include != null && options.include != string.Empty )
+ {
+ Console.WriteLine( "Included categories: " + options.include );
+ TestFilter includeFilter = new CategoryExpression( options.include ).Filter;
+ if ( testFilter.IsEmpty )
+ testFilter = includeFilter;
+ else
+ testFilter = new AndFilter( testFilter, includeFilter );
+ }
+
+ if ( options.exclude != null && options.exclude != string.Empty )
+ {
+ Console.WriteLine( "Excluded categories: " + options.exclude );
+ TestFilter excludeFilter = new NotFilter( new CategoryExpression( options.exclude ).Filter );
+ if ( testFilter.IsEmpty )
+ testFilter = excludeFilter;
+ else if ( testFilter is AndFilter )
+ ((AndFilter)testFilter).Add( excludeFilter );
+ else
+ testFilter = new AndFilter( testFilter, excludeFilter );
+ }
+
+ TestResult result = null;
+ string savedDirectory = Environment.CurrentDirectory;
+ TextWriter savedOut = Console.Out;
+ TextWriter savedError = Console.Error;
+
+ try
+ {
+ result = testRunner.Run( collector, testFilter );
+ }
+ finally
+ {
+ outWriter.Flush();
+ errorWriter.Flush();
+
+ if ( redirectOutput )
+ outWriter.Close();
+ if ( redirectError )
+ errorWriter.Close();
+
+ Environment.CurrentDirectory = savedDirectory;
+ Console.SetOut( savedOut );
+ Console.SetError( savedError );
+ }
+
+ Console.WriteLine();
+
+ string xmlOutput = CreateXmlOutput( result );
+
+ if (options.xmlConsole)
+ {
+ Console.WriteLine(xmlOutput);
+ }
+ else
+ {
+ try
+ {
+ //CreateSummaryDocument(xmlOutput, transformReader );
+ XmlResultTransform xform = new XmlResultTransform( transformReader );
+ xform.Transform( new StringReader( xmlOutput ), Console.Out );
+ }
+ catch( Exception ex )
+ {
+ Console.WriteLine( "Error: {0}", ex.Message );
+ return TRANSFORM_ERROR;
+ }
+ }
+
+ // Write xml output here
+ string xmlResultFile = options.xml == null || options.xml == string.Empty
+ ? "TestResult.xml" : options.xml;
+
+ using ( StreamWriter writer = new StreamWriter( xmlResultFile ) )
+ {
+ writer.Write(xmlOutput);
+ }
+
+ //if ( testRunner != null )
+ // testRunner.Unload();
+
+ if ( collector.HasExceptions )
+ {
+ collector.WriteExceptions();
+ return UNEXPECTED_ERROR;
+ }
+
+ if ( !result.IsFailure ) return OK;
+
+ ResultSummarizer summ = new ResultSummarizer( result );
+ return summ.FailureCount;
+ }
+ finally
+ {
+ testRunner.Unload();
+ }
+ }
+
+ #region Helper Methods
+ private static XmlTextReader GetTransformReader(ConsoleOptions parser)
+ {
+ XmlTextReader reader = null;
+ if(parser.transform == null || parser.transform == string.Empty)
+ {
+ Assembly assembly = Assembly.GetAssembly(typeof(XmlResultVisitor));
+ ResourceManager resourceManager = new ResourceManager("NUnit.Util.Transform",assembly);
+ string xmlData = (string)resourceManager.GetObject("Summary.xslt");
+
+ reader = new XmlTextReader(new StringReader(xmlData));
+ }
+ else
+ {
+ FileInfo xsltInfo = new FileInfo(parser.transform);
+ if(!xsltInfo.Exists)
+ {
+ Console.Error.WriteLine("Transform file: {0} does not exist", xsltInfo.FullName);
+ reader = null;
+ }
+ else
+ {
+ reader = new XmlTextReader(xsltInfo.FullName);
+ }
+ }
+
+ return reader;
+ }
+
+ private static TestRunner MakeRunnerFromCommandLine( ConsoleOptions options )
+ {
+ TestPackage package;
+ ConsoleOptions.DomainUsage domainUsage = ConsoleOptions.DomainUsage.Default;
+
+ if (options.IsTestProject)
+ {
+ NUnitProject project = NUnitProject.LoadProject((string)options.Parameters[0]);
+ string configName = options.config;
+ if (configName != null)
+ project.SetActiveConfig(configName);
+
+ package = project.ActiveConfig.MakeTestPackage();
+ package.TestName = options.fixture;
+
+ domainUsage = ConsoleOptions.DomainUsage.Single;
+ }
+ else if (options.Parameters.Count == 1)
+ {
+ package = new TestPackage((string)options.Parameters[0]);
+ domainUsage = ConsoleOptions.DomainUsage.Single;
+ }
+ else
+ {
+ package = new TestPackage("UNNAMED", options.Parameters);
+ domainUsage = ConsoleOptions.DomainUsage.Multiple;
+ }
+
+ if (options.domain != ConsoleOptions.DomainUsage.Default)
+ domainUsage = options.domain;
+
+ TestRunner testRunner = null;
+
+ switch( domainUsage )
+ {
+ case ConsoleOptions.DomainUsage.None:
+ testRunner = new NUnit.Core.RemoteTestRunner();
+ // Make sure that addins are available
+ CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
+ break;
+
+ case ConsoleOptions.DomainUsage.Single:
+ testRunner = new TestDomain();
+ break;
+
+ case ConsoleOptions.DomainUsage.Multiple:
+ testRunner = new MultipleTestDomainRunner();
+ break;
+ }
+
+ package.TestName = options.fixture;
+ package.Settings["ShadowCopyFiles"] = !options.noshadow;
+ package.Settings["UseThreadedRunner"] = !options.nothread;
+ testRunner.Load( package );
+
+ return testRunner;
+ }
+
+ private static string CreateXmlOutput( TestResult result )
+ {
+ StringBuilder builder = new StringBuilder();
+ XmlResultVisitor resultVisitor = new XmlResultVisitor(new StringWriter( builder ), result);
+ result.Accept(resultVisitor);
+ resultVisitor.Write();
+
+ return builder.ToString();
+ }
+ #endregion
+ }
+}
+
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/EventCollector.cs b/mcs/nunit24/ConsoleRunner/nunit-console/EventCollector.cs
new file mode 100644
index 00000000000..7e3d582688a
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/EventCollector.cs
@@ -0,0 +1,209 @@
+using System;
+using System.IO;
+using System.Diagnostics;
+using System.Text.RegularExpressions;
+using System.Collections;
+using System.Collections.Specialized;
+using NUnit.Core;
+using NUnit.Util;
+
+namespace NUnit.ConsoleRunner
+{
+ /// <summary>
+ /// Summary description for EventCollector.
+ /// </summary>
+ public class EventCollector : MarshalByRefObject, EventListener
+ {
+ private int testRunCount;
+ private int testIgnoreCount;
+ private int failureCount;
+ private int level;
+
+ private ConsoleOptions options;
+ private TextWriter outWriter;
+ private TextWriter errorWriter;
+
+ StringCollection messages;
+
+ private bool progress = false;
+ private string currentTestName;
+
+ private ArrayList unhandledExceptions = new ArrayList();
+
+ public EventCollector( ConsoleOptions options, TextWriter outWriter, TextWriter errorWriter )
+ {
+ level = 0;
+ this.options = options;
+ this.outWriter = outWriter;
+ this.errorWriter = errorWriter;
+ this.currentTestName = string.Empty;
+ this.progress = !options.xmlConsole && !options.labels && !options.nodots;
+
+ AppDomain.CurrentDomain.UnhandledException +=
+ new UnhandledExceptionEventHandler(OnUnhandledException);
+ }
+
+ public bool HasExceptions
+ {
+ get { return unhandledExceptions.Count > 0; }
+ }
+
+ public void WriteExceptions()
+ {
+ Console.WriteLine();
+ Console.WriteLine("Unhandled exceptions:");
+ int index = 1;
+ foreach( string msg in unhandledExceptions )
+ Console.WriteLine( "{0}) {1}", index++, msg );
+ }
+
+ public void RunStarted(string name, int testCount)
+ {
+ }
+
+ public void RunFinished(TestResult result)
+ {
+ }
+
+ public void RunFinished(Exception exception)
+ {
+ }
+
+ public void TestFinished(TestCaseResult testResult)
+ {
+ if(testResult.Executed)
+ {
+ testRunCount++;
+
+ if(testResult.IsFailure)
+ {
+ failureCount++;
+
+ if ( progress )
+ Console.Write("F");
+
+ messages.Add( string.Format( "{0}) {1} :", failureCount, testResult.Test.TestName.FullName ) );
+ messages.Add( testResult.Message.Trim( Environment.NewLine.ToCharArray() ) );
+
+ string stackTrace = StackTraceFilter.Filter( testResult.StackTrace );
+ if ( stackTrace != null && stackTrace != string.Empty )
+ {
+ string[] trace = stackTrace.Split( System.Environment.NewLine.ToCharArray() );
+ foreach( string s in trace )
+ {
+ if ( s != string.Empty )
+ {
+ string link = Regex.Replace( s.Trim(), @".* in (.*):line (.*)", "$1($2)");
+ messages.Add( string.Format( "at\n{0}", link ) );
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ testIgnoreCount++;
+
+ if ( progress )
+ Console.Write("N");
+ }
+
+ currentTestName = string.Empty;
+ }
+
+ public void TestStarted(TestName testName)
+ {
+ currentTestName = testName.FullName;
+
+ if ( options.labels )
+ outWriter.WriteLine("***** {0}", currentTestName );
+
+ if ( progress )
+ Console.Write(".");
+ }
+
+ public void SuiteStarted(TestName testName)
+ {
+ if ( level++ == 0 )
+ {
+ messages = new StringCollection();
+ testRunCount = 0;
+ testIgnoreCount = 0;
+ failureCount = 0;
+ Trace.WriteLine( "################################ UNIT TESTS ################################" );
+ Trace.WriteLine( "Running tests in '" + testName.FullName + "'..." );
+ }
+ }
+
+ public void SuiteFinished(TestSuiteResult suiteResult)
+ {
+ if ( --level == 0)
+ {
+ Trace.WriteLine( "############################################################################" );
+
+ if (messages.Count == 0)
+ {
+ Trace.WriteLine( "############## S U C C E S S #################" );
+ }
+ else
+ {
+ Trace.WriteLine( "############## F A I L U R E S #################" );
+
+ foreach ( string s in messages )
+ {
+ Trace.WriteLine(s);
+ }
+ }
+
+ Trace.WriteLine( "############################################################################" );
+ Trace.WriteLine( "Executed tests : " + testRunCount );
+ Trace.WriteLine( "Ignored tests : " + testIgnoreCount );
+ Trace.WriteLine( "Failed tests : " + failureCount );
+ Trace.WriteLine( "Unhandled exceptions : " + unhandledExceptions.Count);
+ Trace.WriteLine( "Total time : " + suiteResult.Time + " seconds" );
+ Trace.WriteLine( "############################################################################");
+ }
+ }
+
+ private void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ if (e.ExceptionObject.GetType() != typeof(System.Threading.ThreadAbortException))
+ {
+ this.UnhandledException((Exception)e.ExceptionObject);
+ }
+ }
+
+
+ public void UnhandledException( Exception exception )
+ {
+ // If we do labels, we already have a newline
+ unhandledExceptions.Add(currentTestName + " : " + exception.ToString());
+ //if (!options.labels) outWriter.WriteLine();
+ string msg = string.Format("##### Unhandled Exception while running {0}", currentTestName);
+ //outWriter.WriteLine(msg);
+ //outWriter.WriteLine(exception.ToString());
+
+ Trace.WriteLine(msg);
+ Trace.WriteLine(exception.ToString());
+ }
+
+ public void TestOutput( TestOutput output)
+ {
+ switch ( output.Type )
+ {
+ case TestOutputType.Out:
+ outWriter.Write( output.Text );
+ break;
+ case TestOutputType.Error:
+ errorWriter.Write( output.Text );
+ break;
+ }
+ }
+
+
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ }
+}
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/Makefile b/mcs/nunit24/ConsoleRunner/nunit-console/Makefile
new file mode 100644
index 00000000000..9b9332980f6
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/Makefile
@@ -0,0 +1,30 @@
+thisdir = nunit24/ConsoleRunner/nunit-console
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit-console-runner.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LOCAL_MCS_FLAGS= \
+ -r:nunit.core.dll -r:nunit.core.interfaces.dll -r:nunit.util.dll \
+ -r:System.dll -r:System.Xml.dll \
+ /d:MONO /d:StronglyNamedAssembly
+NO_TEST = yo
+
+EXTRA_DISTFILES = nunit-console-runner.dll.csproj
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/Runner.cs b/mcs/nunit24/ConsoleRunner/nunit-console/Runner.cs
new file mode 100644
index 00000000000..c603c532df2
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/Runner.cs
@@ -0,0 +1,117 @@
+using System;
+using System.IO;
+using System.Reflection;
+using NUnit.Core;
+using NUnit.Util;
+
+
+namespace NUnit.ConsoleRunner
+{
+ /// <summary>
+ /// Summary description for Runner.
+ /// </summary>
+ public class Runner
+ {
+ [STAThread]
+ public static int Main(string[] args)
+ {
+ NTrace.Info( "NUnit-console.exe starting" );
+
+ ConsoleOptions options = new ConsoleOptions(args);
+
+ if(!options.nologo)
+ WriteCopyright();
+
+ if(options.help)
+ {
+ options.Help();
+ return ConsoleUi.OK;
+ }
+
+ if(options.NoArgs)
+ {
+ Console.Error.WriteLine("fatal error: no inputs specified");
+ options.Help();
+ return ConsoleUi.OK;
+ }
+
+ if(!options.Validate())
+ {
+ foreach( string arg in options.InvalidArguments )
+ Console.Error.WriteLine("fatal error: invalid argument: {0}", arg );
+ options.Help();
+ return ConsoleUi.INVALID_ARG;
+ }
+
+ // Add Standard Services to ServiceManager
+ ServiceManager.Services.AddService( new SettingsService() );
+ ServiceManager.Services.AddService( new DomainManager() );
+ //ServiceManager.Services.AddService( new RecentFilesService() );
+ //ServiceManager.Services.AddService( new TestLoader() );
+ ServiceManager.Services.AddService( new AddinRegistry() );
+ ServiceManager.Services.AddService( new AddinManager() );
+ // TODO: Resolve conflict with gui testagency when running
+ // console tests under the gui.
+ //ServiceManager.Services.AddService( new TestAgency() );
+
+ // Initialize Services
+ ServiceManager.Services.InitializeServices();
+
+ try
+ {
+ ConsoleUi consoleUi = new ConsoleUi();
+ return consoleUi.Execute( options );
+ }
+ catch( FileNotFoundException ex )
+ {
+ Console.WriteLine( ex.Message );
+ return ConsoleUi.FILE_NOT_FOUND;
+ }
+ catch( Exception ex )
+ {
+ Console.WriteLine( "Unhandled Exception:\n{0}", ex.ToString() );
+ return ConsoleUi.UNEXPECTED_ERROR;
+ }
+ finally
+ {
+ if(options.wait)
+ {
+ Console.Out.WriteLine("\nHit <enter> key to continue");
+ Console.ReadLine();
+ }
+
+ NTrace.Info( "NUnit-console.exe terminating" );
+ }
+
+ }
+
+ private static void WriteCopyright()
+ {
+ Assembly executingAssembly = Assembly.GetExecutingAssembly();
+ System.Version version = executingAssembly.GetName().Version;
+
+ string productName = "NUnit";
+ string copyrightText = "Copyright (C) 2002-2007 Charlie Poole.\r\nCopyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.\r\nCopyright (C) 2000-2002 Philip Craig.\r\nAll Rights Reserved.";
+
+ object[] objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
+ if ( objectAttrs.Length > 0 )
+ productName = ((AssemblyProductAttribute)objectAttrs[0]).Product;
+
+ objectAttrs = executingAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
+ if ( objectAttrs.Length > 0 )
+ copyrightText = ((AssemblyCopyrightAttribute)objectAttrs[0]).Copyright;
+
+ Console.WriteLine(String.Format("{0} version {1}", productName, version.ToString(3)));
+ Console.WriteLine(copyrightText);
+ Console.WriteLine();
+
+ Console.WriteLine( "Runtime Environment - " );
+ RuntimeFramework framework = RuntimeFramework.CurrentFramework;
+ Console.WriteLine( string.Format(" OS Version: {0}", Environment.OSVersion ) );
+ Console.WriteLine( string.Format(" CLR Version: {0} ( {1} )",
+ Environment.Version, framework.GetDisplayName() ) );
+
+ Console.WriteLine();
+ }
+ }
+}
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console-runner.dll.sources b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console-runner.dll.sources
new file mode 100644
index 00000000000..35d840f1f97
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console-runner.dll.sources
@@ -0,0 +1,6 @@
+../../CommonAssemblyInfo.cs
+AssemblyInfo.cs
+ConsoleOptions.cs
+ConsoleUi.cs
+EventCollector.cs
+Runner.cs
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.build b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.build
new file mode 100644
index 00000000000..4a5af18e47e
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.build
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<project name="NUnit-Console" default="build">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit-console-runner.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="ConsoleOptions.cs"/>
+ <include name="ConsoleUi.cs"/>
+ <include name="EventCollector.cs"/>
+ <include name="Runner.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.core.interfaces.dll"/>
+ <include name="nunit.core.dll"/>
+ <include name="nunit.util.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/ConsoleRunner/nunit-console">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project>
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.csproj b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.csproj
new file mode 100644
index 00000000000..9e1ef9e1c91
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console.csproj
@@ -0,0 +1,140 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit-console-runner"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.ConsoleRunner"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = "618"
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = "618"
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.util.dll"
+ Project = "{61CE9CE5-943E-44D4-A381-814DC1406767}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.interfaces.dll"
+ Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.dll"
+ Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "App.ico"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConsoleOptions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ConsoleUi.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventCollector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Runner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console_VS2005.csproj b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console_VS2005.csproj
new file mode 100644
index 00000000000..e27886af6bd
--- /dev/null
+++ b/mcs/nunit24/ConsoleRunner/nunit-console/nunit-console_VS2005.csproj
@@ -0,0 +1,94 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9367EC89-6A38-42BA-9607-0DC288E4BC3A}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit-console-runner</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.ConsoleRunner</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <SignAssembly>false</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <NoWarn>618;1701;1702;1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <NoWarn>618;1701;1702;1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="App.ico" />
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ConsoleOptions.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ConsoleUi.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="EventCollector.cs" />
+ <Compile Include="Runner.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\ClientUtilities\util\nunit.util.dll_VS2005.csproj">
+ <Project>{61CE9CE5-943E-44D4-A381-814DC1406767}</Project>
+ <Name>nunit.util.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\core\nunit.core.dll_VS2005.csproj">
+ <Project>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</Project>
+ <Name>nunit.core.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
+ <Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
+ <Name>nunit.core.interfaces.dll_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/Makefile b/mcs/nunit24/Makefile
new file mode 100644
index 00000000000..3d762f4f093
--- /dev/null
+++ b/mcs/nunit24/Makefile
@@ -0,0 +1,14 @@
+thisdir = nunit24
+SUBDIRS = NUnitFramework/framework NUnitCore/interfaces NUnitCore/core \
+ ClientUtilities/util NUnitMocks/mocks \
+ NUnitExtensions/framework NUnitExtensions/core \
+ ConsoleRunner/nunit-console ConsoleRunner/nunit-console-exe
+include ../build/rules.make
+
+DISTFILES = license.rtf nunit.sln nunit_VS2005.sln nunit.snk README \
+ NUnitExtensions/docs/RowTest/*
+
+all-local install-local test-local run-test-local run-test-ondotnet-local clean-local uninstall-local doc-update-local:
+
+dist-local: dist-default
+
diff --git a/mcs/nunit24/NUnitCore/core/AbstractTestCaseDecoration.cs b/mcs/nunit24/NUnitCore/core/AbstractTestCaseDecoration.cs
new file mode 100644
index 00000000000..8aa2b45c9f5
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/AbstractTestCaseDecoration.cs
@@ -0,0 +1,41 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestCaseDecorator is used to add functionality to
+ /// another TestCase, which it aggregates.
+ /// </summary>
+ public abstract class AbstractTestCaseDecoration : TestCase
+ {
+ protected TestCase testCase;
+
+ public AbstractTestCaseDecoration( TestCase testCase )
+ : base( (TestName)testCase.TestName.Clone() )
+ {
+ this.testCase = testCase;
+ this.RunState = testCase.RunState;
+ this.IgnoreReason = testCase.IgnoreReason;
+ this.Description = testCase.Description;
+ this.Categories = new System.Collections.ArrayList(testCase.Categories);
+ if (testCase.Properties != null)
+ {
+ this.Properties = new ListDictionary();
+ foreach (DictionaryEntry entry in testCase.Properties)
+ this.Properties.Add(entry.Key, entry.Value);
+ }
+ }
+
+ public override int TestCount
+ {
+ get { return testCase.TestCount; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs b/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs
new file mode 100644
index 00000000000..747032c7e63
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/AssemblyInfo.cs
@@ -0,0 +1,13 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitCore/core/AssemblyReader.cs b/mcs/nunit24/NUnitCore/core/AssemblyReader.cs
new file mode 100644
index 00000000000..ef854991022
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/AssemblyReader.cs
@@ -0,0 +1,168 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+using System.Text;
+using System.IO;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// AssemblyReader knows how to find various things in an assembly header
+ /// </summary>
+ public class AssemblyReader : IDisposable
+ {
+ private string assemblyPath;
+ private BinaryReader rdr;
+ private FileStream fs;
+
+ UInt16 dos_magic = 0xffff;
+ uint pe_signature = 0xffffffff;
+ UInt16 numDataSections;
+ UInt16 optionalHeaderSize;
+
+ private uint peHeader = 0;
+ private uint fileHeader = 0;
+ private uint optionalHeader = 0;
+ private uint dataDirectory = 0;
+ private uint dataSections = 0;
+
+ private struct Section
+ {
+ public uint virtualAddress;
+ public uint virtualSize;
+ public uint fileOffset;
+ };
+
+ private Section[] sections;
+
+ public AssemblyReader( string assemblyPath )
+ {
+ this.assemblyPath = assemblyPath;
+ CalcHeaderOffsets();
+ }
+
+ public AssemblyReader( Assembly assembly )
+ {
+ this.assemblyPath = TestFixtureBuilder.GetAssemblyPath( assembly );
+ CalcHeaderOffsets();
+ }
+
+ private void CalcHeaderOffsets()
+ {
+ this.fs = new FileStream( assemblyPath, FileMode.Open, FileAccess.Read );
+ this.rdr = new BinaryReader( fs );
+ dos_magic = rdr.ReadUInt16();
+ if ( dos_magic == 0x5a4d )
+ {
+ fs.Position = 0x3c;
+ peHeader = rdr.ReadUInt32();
+ fileHeader = peHeader + 4;
+ optionalHeader = fileHeader + 20;
+ dataDirectory = optionalHeader + 96;
+ // dotNetDirectoryEntry = dataDirectory + 14 * 8;
+
+ fs.Position = peHeader;
+ pe_signature = rdr.ReadUInt32();
+ rdr.ReadUInt16(); // machine
+ numDataSections = rdr.ReadUInt16();
+ fs.Position += 12;
+ optionalHeaderSize = rdr.ReadUInt16();
+ dataSections = optionalHeader + optionalHeaderSize;
+
+ sections = new Section[numDataSections];
+ fs.Position = dataSections;
+ for( int i = 0; i < numDataSections; i++ )
+ {
+ fs.Position += 8;
+ sections[i].virtualSize = rdr.ReadUInt32();
+ sections[i].virtualAddress = rdr.ReadUInt32();
+ uint rawDataSize = rdr.ReadUInt32();
+ sections[i].fileOffset = rdr.ReadUInt32();
+ if ( sections[i].virtualSize == 0 )
+ sections[i].virtualSize = rawDataSize;
+
+ fs.Position += 16;
+ }
+ }
+ }
+
+ private uint DataDirectoryRva( int n )
+ {
+ fs.Position = dataDirectory + n * 8;
+ return rdr.ReadUInt32();
+ }
+
+ private uint RvaToLfa( uint rva )
+ {
+ for( int i = 0; i < numDataSections; i++ )
+ if ( rva >= sections[i].virtualAddress && rva < sections[i].virtualAddress + sections[i].virtualSize )
+ return rva - sections[i].virtualAddress + sections[i].fileOffset;
+
+ return 0;
+ }
+
+ public string AssemblyPath
+ {
+ get { return assemblyPath; }
+ }
+
+ public bool IsValidPeFile
+ {
+ get { return dos_magic == 0x5a4d && pe_signature == 0x00004550; }
+ }
+
+ public bool IsDotNetFile
+ {
+ get { return IsValidPeFile && DataDirectoryRva(14) != 0; }
+ }
+
+ public string ImageRuntimeVersion
+ {
+ get
+ {
+ string runtimeVersion = string.Empty;
+
+ uint rva = DataDirectoryRva(14);
+ if ( rva != 0 )
+ {
+ fs.Position = RvaToLfa( rva ) + 8;
+ uint metadata = rdr.ReadUInt32();
+ fs.Position = RvaToLfa( metadata );
+ if ( rdr.ReadUInt32() == 0x424a5342 )
+ {
+ // Copy string representing runtime version
+ fs.Position += 12;
+ StringBuilder sb = new StringBuilder();
+ char c;
+ while ((c = rdr.ReadChar())!= '\0')
+ sb.Append(c);
+
+ if (sb[0] == 'v') // Last sanity check
+ runtimeVersion = sb.ToString();
+
+ // Could do fixups here for bad values in older files
+ // like 1.x86, 1.build, etc. But we are only using
+ // the major version anyway
+ }
+ }
+
+ return runtimeVersion;
+ }
+ }
+
+ public void Dispose()
+ {
+ if ( fs != null )
+ fs.Close();
+ if ( rdr != null )
+ rdr.Close();
+
+ fs = null;
+ rdr = null;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/AssemblyResolver.cs b/mcs/nunit24/NUnitCore/core/AssemblyResolver.cs
new file mode 100644
index 00000000000..5785c03c394
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/AssemblyResolver.cs
@@ -0,0 +1,122 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.IO;
+ using System.Reflection;
+ using System.Collections;
+
+ /// <summary>
+ /// Class adapted from NUnitAddin for use in handling assemblies that are not
+ /// found in the test AppDomain.
+ /// </summary>
+ public class AssemblyResolver : MarshalByRefObject, IDisposable
+ {
+ private class AssemblyCache
+ {
+ private Hashtable _resolved = new Hashtable();
+
+ public bool Contains( string name )
+ {
+ return _resolved.ContainsKey( name );
+ }
+
+ public Assembly Resolve( string name )
+ {
+ if ( _resolved.ContainsKey( name ) )
+ return (Assembly)_resolved[name];
+
+ return null;
+ }
+
+ public void Add( string name, Assembly assembly )
+ {
+ _resolved[name] = assembly;
+ }
+ }
+
+ private AssemblyCache _cache = new AssemblyCache();
+
+ private ArrayList _dirs = new ArrayList();
+
+ public AssemblyResolver()
+ {
+ AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
+ }
+
+ public void Dispose()
+ {
+ AppDomain.CurrentDomain.AssemblyResolve -= new ResolveEventHandler(CurrentDomain_AssemblyResolve);
+ }
+
+ public void AddFile( string file )
+ {
+ Assembly assembly = Assembly.LoadFrom( file );
+ _cache.Add(assembly.GetName().FullName, assembly);
+ }
+
+ public void AddFiles( string directory, string pattern )
+ {
+ if ( Directory.Exists( directory ) )
+ foreach( string file in Directory.GetFiles( directory, pattern ) )
+ AddFile( file );
+ }
+
+ public void AddDirectory( string directory )
+ {
+ if ( Directory.Exists( directory ) )
+ _dirs.Add( directory );
+ }
+
+ private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
+ {
+ string fullName = args.Name;
+ int index = fullName.IndexOf(',');
+ if(index == -1) // Only resolve using full name.
+ {
+ NTrace.Debug( string.Format("Not a strong name: {0}", fullName ),
+ "'AssemblyResolver'" );
+ return null;
+ }
+
+ if ( _cache.Contains( fullName ) )
+ {
+ NTrace.Info( string.Format( "Resolved from Cache: {0}", fullName ),
+ "'AssemblyResolver'" );
+ return _cache.Resolve(fullName);
+ }
+
+ foreach( string dir in _dirs )
+ {
+ foreach( string file in Directory.GetFiles( dir, "*.dll" ) )
+ {
+ string fullFile = Path.Combine( dir, file );
+ try
+ {
+ if ( AssemblyName.GetAssemblyName( fullFile ).FullName == fullName )
+ {
+ NTrace.Info( string.Format( "Added to Cache: {0}", fullFile ),
+ "'AssemblyResolver'" );
+ AddFile( fullFile );
+ return _cache.Resolve( fullName );
+ }
+ }
+ catch
+ {
+ // Keep going if there's a bad assembly
+ NTrace.Debug( string.Format( "Bad assembly: {0}", fullFile ), "AssemblyResolver");
+ }
+ }
+ }
+
+ NTrace.Debug( string.Format( "Not in Cache: {0}", fullName),
+ "'AssemblyResolver'");
+ return null;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/AbstractFixtureBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/AbstractFixtureBuilder.cs
new file mode 100644
index 00000000000..a546bbaa0ac
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/AbstractFixtureBuilder.cs
@@ -0,0 +1,201 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Core.Builders
+{
+ /// <summary>
+ /// AbstractFixtureBuilder may serve as a base class for
+ /// implementing a suite builder. It provides a templated
+ /// implementation of the BuildFrom method as well as a
+ /// number of useful methods that derived classes may use.
+ /// </summary>
+ public abstract class AbstractFixtureBuilder : Extensibility.ISuiteBuilder
+ {
+ #region Instance Fields
+ /// <summary>
+ /// The TestSuite being constructed;
+ /// </summary>
+ protected TestSuite suite;
+
+ /// <summary>
+ /// The fixture builder's own test case builder collection
+ /// </summary>
+ protected Extensibility.TestCaseBuilderCollection testCaseBuilders =
+ new Extensibility.TestCaseBuilderCollection(CoreExtensions.Host);
+ #endregion
+
+ #region Abstract Methods
+ /// <summary>
+ /// Examine the type and determine if it is suitable for
+ /// this builder to use in building a TestSuite.
+ ///
+ /// Note that returning false will cause the type to be ignored
+ /// in loading the tests. If it is desired to load the suite
+ /// but label it as non-runnable, ignored, etc., then this
+ /// method must return true.
+ /// </summary>
+ /// <param name="type">The type of the fixture to be used</param>
+ /// <returns>True if the type can be used to build a TestSuite</returns>
+ public abstract bool CanBuildFrom(Type type);
+
+ /// <summary>
+ /// Method that actually creates a new TestSuite object
+ ///
+ /// Derived classes must override this method.
+ /// </summary>
+ /// <param name="type">The user fixture type</param>
+ /// <returns></returns>
+ protected abstract TestSuite MakeSuite( Type type );
+ #endregion
+
+ #region Virtual Methods
+ /// <summary>
+ /// Templated implementaton of ISuiteBuilder.BuildFrom. Any
+ /// derived builder may choose to override this method in
+ /// it's entirety or to let it stand and override some of
+ /// the virtual methods that it calls.
+ /// </summary>
+ /// <param name="type"></param>
+ /// <returns></returns>
+ public virtual Test BuildFrom(Type type)
+ {
+ this.suite = MakeSuite(type);
+
+ SetTestSuiteProperties(type, suite);
+
+ AddTestCases(type);
+
+ if ( this.suite.RunState != RunState.NotRunnable && this.suite.TestCount == 0)
+ {
+ this.suite.RunState = RunState.NotRunnable;
+ this.suite.IgnoreReason = suite.TestName.Name + " does not have any tests";
+ }
+
+ return this.suite;
+ }
+
+ /// <summary>
+ /// Method that sets properties of the test suite based on the
+ /// information in the provided Type.
+ ///
+ /// Derived classes normally override this method and should
+ /// call the base method or include equivalent code.
+ /// </summary>
+ /// <param name="type">The type to examine</param>
+ /// <param name="suite">The test suite being constructed</param>
+ protected virtual void SetTestSuiteProperties( Type type, TestSuite suite )
+ {
+ string reason = null;
+ if (!IsValidFixtureType(type, ref reason) )
+ {
+ this.suite.RunState = RunState.NotRunnable;
+ this.suite.IgnoreReason = reason;
+ }
+ }
+
+ /// <summary>
+ /// Virtual method that returns true if the fixture type is valid
+ /// for use by the builder. If not, it returns false and sets
+ /// reason to an appropriate message. As implemented in this class,
+ /// the method checks that a default constructor is available. You
+ /// may override this method in a derived class in order to make
+ /// different or additional checks.
+ /// </summary>
+ /// <param name="fixtureType">The fixture type</param>
+ /// <param name="reason">The reason this fixture is not valid</param>
+ /// <returns>True if the fixture type is valid, false if not</returns>
+ protected virtual bool IsValidFixtureType( Type fixtureType, ref string reason )
+ {
+ if (fixtureType.IsAbstract)
+ {
+ reason = string.Format("{0} is an abstract class", fixtureType.FullName);
+ return false;
+ }
+
+ if (Reflect.GetConstructor(fixtureType) == null)
+ {
+ reason = string.Format( "{0} does not have a valid constructor", fixtureType.FullName );
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Method to add test cases to the newly constructed suite.
+ /// The default implementation looks at each candidate method
+ /// and tries to build a test case from it. It will only need
+ /// to be overridden if some other approach, such as reading a
+ /// datafile is used to generate test cases.
+ /// </summary>
+ /// <param name="fixtureType"></param>
+ protected virtual void AddTestCases( Type fixtureType )
+ {
+ IList methods = GetCandidateTestMethods( fixtureType );
+ foreach(MethodInfo method in methods)
+ {
+ Test test = BuildTestCase(method);
+
+ if(test != null)
+ {
+ this.suite.Add( test );
+ }
+ }
+ }
+
+ /// <summary>
+ /// Method to create a test case from a MethodInfo and add
+ /// it to the suite being built. It first checks to see if
+ /// any global TestCaseBuilder addin wants to build the
+ /// test case. If not, it uses the internal builder
+ /// collection maintained by this fixture builder. After
+ /// building the test case, it applies any decorators
+ /// that have been installed.
+ ///
+ /// The default implementation has no test case builders.
+ /// Derived classes should add builders to the collection
+ /// in their constructor.
+ /// </summary>
+ /// <param name="method"></param>
+ /// <returns></returns>
+ protected virtual Test BuildTestCase( MethodInfo method )
+ {
+ // TODO: Review order of using builders
+ Test test = CoreExtensions.Host.TestBuilders.BuildFrom( method );
+
+ if ( test == null && this.testCaseBuilders.CanBuildFrom( method ) )
+ test = this.testCaseBuilders.BuildFrom( method );
+
+ if ( test != null )
+ test = CoreExtensions.Host.TestDecorators.Decorate( test, method );
+
+ return test;
+ }
+
+ /// <summary>
+ /// Method to return all methods in a fixture that should be examined
+ /// to see if they are test methods. The default returns all methods
+ /// of the fixture: public and private, instance and static, declared
+ /// and inherited.
+ ///
+ /// While this method may be overridden, it should normally not be.
+ /// If it is overridden to eliminate certain methods, they will be
+ /// silently ignored. Generally, it is better to include them in the
+ /// list and let the TestCaseBuilders decide how to handle them.
+ /// </summary>
+ /// <param name="fixtureType"></param>
+ /// <returns></returns>
+ protected IList GetCandidateTestMethods( Type fixtureType )
+ {
+ return fixtureType.GetMethods( BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/AbstractTestCaseBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/AbstractTestCaseBuilder.cs
new file mode 100644
index 00000000000..7e22b674645
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/AbstractTestCaseBuilder.cs
@@ -0,0 +1,105 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Reflection;
+
+namespace NUnit.Core.Builders
+{
+ /// <summary>
+ /// AbstractTestCaseBuilder may serve as a base class for
+ /// implementing a test case builder. It provides a templated
+ /// implementation of the BuildFrom method.
+ ///
+ /// Developers of extended test cases may choose to inherit
+ /// from this class, although NUnitTestCaseBuilder will
+ /// probably be more useful if the extension is intended
+ /// to work like an NUnit test case.
+ /// </summary>
+ public abstract class AbstractTestCaseBuilder : Extensibility.ITestCaseBuilder
+ {
+ #region Instance Fields
+ protected int runnerID;
+ protected TestCase testCase;
+ #endregion
+
+ #region Abstract Methods
+ /// <summary>
+ /// Examine the method and determine if it is suitable for
+ /// this builder to use in building a TestCase.
+ ///
+ /// Note that returning false will cause the method to be ignored
+ /// in loading the tests. If it is desired to load the method
+ /// but label it as non-runnable, ignored, etc., then this
+ /// method must return true.
+ ///
+ /// Derived classes must override this method.
+ /// </summary>
+ /// <param name="method">The test method to examine</param>
+ /// <returns>True is the builder can use this method</returns>
+ public abstract bool CanBuildFrom(System.Reflection.MethodInfo method);
+
+ /// <summary>
+ /// Method that actually creates a new test case object.
+ ///
+ /// Derived classes must override this method.
+ /// </summary>
+ /// <param name="method">The test method to examine</param>
+ /// <returns>An object derived from TestCase</returns>
+ protected abstract TestCase MakeTestCase( MethodInfo method );
+
+ /// <summary>
+ /// Method that sets properties of the test case based on the
+ /// information in the provided MethodInfo.
+ ///
+ /// Derived classes must override this method.
+ /// </summary>
+ /// <param name="method">The test method to examine</param>
+ /// <param name="testCase">The test case being constructed</param>
+ protected abstract void SetTestProperties( MethodInfo method, TestCase testCase );
+ #endregion
+
+ #region Virtual Methods
+ /// <summary>
+ /// Templated implementaton of ITestCaseBuilder.BuildFrom.
+ ///
+ /// Any derived builder may choose to override this method in
+ /// it's entirety or to let it stand and override some of
+ /// the virtual methods that it calls.
+ /// </summary>
+ /// <param name="method">The method for which a test case is to be built</param>
+ /// <returns>A TestCase or null</returns>
+ public virtual Test BuildFrom(System.Reflection.MethodInfo method)
+ {
+ if ( !HasValidTestCaseSignature( method ) )
+ return new NotRunnableTestCase( method );
+
+ TestCase testCase = MakeTestCase( method );
+ if ( testCase != null )
+ SetTestProperties( method , testCase );
+
+ return testCase;
+ }
+
+ /// <summary>
+ /// Virtual method that checks the signature of a potential test case to
+ /// determine if it is valid. The default implementation requires methods
+ /// to be public, non-abstract instance methods, taking no parameters and
+ /// returning void. Methods not meeting these criteria will be marked by
+ /// NUnit as non-runnable.
+ /// </summary>
+ /// <param name="method">The method to be checked</param>
+ /// <returns>True if the method signature is valid, false if not</returns>
+ protected virtual bool HasValidTestCaseSignature( MethodInfo method )
+ {
+ return !method.IsStatic
+ && !method.IsAbstract
+ && method.IsPublic
+ && method.GetParameters().Length == 0
+ && method.ReturnType.Equals(typeof(void) );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/LegacySuiteBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/LegacySuiteBuilder.cs
new file mode 100644
index 00000000000..4255a910230
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/LegacySuiteBuilder.cs
@@ -0,0 +1,26 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core.Builders
+{
+ /// <summary>
+ /// Built-in SuiteBuilder for LegacySuite
+ /// </summary>
+ public class LegacySuiteBuilder : Extensibility.ISuiteBuilder
+ {
+ public bool CanBuildFrom( Type type )
+ {
+ return LegacySuite.GetSuiteProperty( type ) != null;
+ }
+
+ public Test BuildFrom( Type type )
+ {
+ return new LegacySuite( type );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/MultiCultureDecorator.cs b/mcs/nunit24/NUnitCore/core/Builders/MultiCultureDecorator.cs
new file mode 100644
index 00000000000..1b7a57e5d4d
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/MultiCultureDecorator.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Reflection;
+
+namespace NUnit.Core.Builders
+{
+ public class MultiCultureDecorator : Extensibility.ITestDecorator
+ {
+ public Test Decorate(Test test, MemberInfo member)
+ {
+ Attribute attr = Reflect.GetAttribute( member, "NUnit.Framework.MultiCultureAttribute", true );
+ if (attr == null) return test;
+
+ string cultures = Reflect.GetPropertyValue( attr, "Cultures" ) as string;
+ if ( cultures == null ) return test;
+
+ return new MultiCultureTestSuite(test, cultures);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/NUnitTestCaseBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/NUnitTestCaseBuilder.cs
new file mode 100644
index 00000000000..4fa6af089e6
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/NUnitTestCaseBuilder.cs
@@ -0,0 +1,76 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Text.RegularExpressions;
+using System.Configuration;
+using System.Diagnostics;
+
+namespace NUnit.Core.Builders
+{
+ public class NUnitTestCaseBuilder : AbstractTestCaseBuilder
+ {
+ private bool allowOldStyleTests = NUnitFramework.AllowOldStyleTests;
+
+ #region AbstractTestCaseBuilder Overrides
+ /// <summary>
+ /// Determine if the method is an NUnit test method.
+ /// The method must normally be marked with the test
+ /// attribute for this to be true. If the test config
+ /// file sets AllowOldStyleTests to true, then any
+ /// method beginning "test..." (case-insensitive)
+ /// is treated as a test unless it is also marked
+ /// as a setup or teardown method.
+ /// </summary>
+ /// <param name="method">A MethodInfo for the method being used as a test method</param>
+ /// <returns>True if the builder can create a test case from this method</returns>
+ public override bool CanBuildFrom(MethodInfo method)
+ {
+ if ( Reflect.HasAttribute( method, NUnitFramework.TestAttribute, false ) )
+ return true;
+
+ if (allowOldStyleTests)
+ {
+ Regex regex = new Regex("^(?i:test)");
+ if ( regex.Match(method.Name).Success
+ && !NUnitFramework.IsSetUpMethod( method )
+ && !NUnitFramework.IsTearDownMethod( method )
+ && !NUnitFramework.IsFixtureSetUpMethod( method )
+ && !NUnitFramework.IsFixtureTearDownMethod( method ) )
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Create an NUnitTestMethod
+ /// </summary>
+ /// <param name="method">A MethodInfo for the method being used as a test method</param>
+ /// <returns>A new NUnitTestMethod</returns>
+ protected override TestCase MakeTestCase(MethodInfo method)
+ {
+ return new NUnitTestMethod( method );
+ }
+
+ /// <summary>
+ /// Set additional properties of the newly created test case based
+ /// on its attributes. As implemented, the method sets the test's
+ /// RunState, Description, Categories and Properties.
+ /// </summary>
+ /// <param name="method">A MethodInfo for the method being used as a test method</param>
+ /// <param name="testCase">The test case being constructed</param>
+ protected override void SetTestProperties( MethodInfo method, TestCase testCase )
+ {
+ NUnitFramework.ApplyCommonAttributes( method, testCase );
+ NUnitFramework.ApplyExpectedExceptionAttribute( method, (TestMethod)testCase );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/NUnitTestFixtureBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/NUnitTestFixtureBuilder.cs
new file mode 100644
index 00000000000..1b8b346d695
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/NUnitTestFixtureBuilder.cs
@@ -0,0 +1,129 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Text.RegularExpressions;
+
+namespace NUnit.Core.Builders
+{
+ /// <summary>
+ /// Built-in SuiteBuilder for NUnit TestFixture
+ /// </summary>
+ public class NUnitTestFixtureBuilder : AbstractFixtureBuilder
+ {
+ public NUnitTestFixtureBuilder()
+ {
+ this.testCaseBuilders.Install( new NUnitTestCaseBuilder() );
+ }
+
+ #region AbstractFixtureBuilder Overrides
+ /// <summary>
+ /// Makes an NUnitTestFixture instance
+ /// </summary>
+ /// <param name="type">The type to be used</param>
+ /// <returns>An NUnitTestFixture as a TestSuite</returns>
+ protected override TestSuite MakeSuite( Type type )
+ {
+ return new NUnitTestFixture( type );
+ }
+
+ /// <summary>
+ /// Method that sets properties of the test suite based on the
+ /// information in the provided Type.
+ /// </summary>
+ /// <param name="type">The type to examine</param>
+ /// <param name="suite">The test suite being constructed</param>
+ protected override void SetTestSuiteProperties( Type type, TestSuite suite )
+ {
+ base.SetTestSuiteProperties( type, suite );
+
+ NUnitFramework.ApplyCommonAttributes( type, suite );
+ }
+
+ /// <summary>
+ /// Checks to see if the fixture type has the test fixture
+ /// attribute type specified in the parameters. Override
+ /// to allow additional types - based on name, for example.
+ /// </summary>
+ /// <param name="type">The fixture type to check</param>
+ /// <returns>True if the fixture can be built, false if not</returns>
+ public override bool CanBuildFrom(Type type)
+ {
+ return Reflect.HasAttribute( type, NUnitFramework.TestFixtureAttribute, true );
+ }
+
+ /// <summary>
+ /// Check that the fixture is valid. In addition to the base class
+ /// check for a valid constructor, this method ensures that there
+ /// is no more than one of each setup or teardown method and that
+ /// their signatures are correct.
+ /// </summary>
+ /// <param name="fixtureType">The type of the fixture to check</param>
+ /// <param name="reason">A message indicating why the fixture is invalid</param>
+ /// <returns>True if the fixture is valid, false if not</returns>
+ protected override bool IsValidFixtureType(Type fixtureType, ref string reason)
+ {
+ if (!base.IsValidFixtureType(fixtureType, ref reason))
+ return false;
+
+ if (!fixtureType.IsPublic && !fixtureType.IsNestedPublic)
+ {
+ reason = "Fixture class is not public";
+ return false;
+ }
+
+ return CheckSetUpTearDownMethod(fixtureType, "SetUp", NUnitFramework.SetUpAttribute, ref reason)
+ && CheckSetUpTearDownMethod(fixtureType, "TearDown", NUnitFramework.TearDownAttribute, ref reason)
+ && CheckSetUpTearDownMethod(fixtureType, "TestFixtureSetUp", NUnitFramework.FixtureSetUpAttribute, ref reason)
+ && CheckSetUpTearDownMethod(fixtureType, "TestFixtureTearDown", NUnitFramework.FixtureTearDownAttribute, ref reason);
+ }
+
+ /// <summary>
+ /// Internal helper to check a single setup or teardown method
+ /// </summary>
+ /// <param name="fixtureType">The type to be checked</param>
+ /// <param name="attributeName">The short name of the attribute to be checked</param>
+ /// <returns>True if the method is present no more than once and has a valid signature</returns>
+ private bool CheckSetUpTearDownMethod(Type fixtureType, string name, string attributeName, ref string reason)
+ {
+ int count = Reflect.CountMethodsWithAttribute(
+ fixtureType, attributeName,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly,
+ true);
+
+ if (count == 0) return true;
+
+ if (count > 1)
+ {
+ reason = string.Format("More than one {0} method", name);
+ return false;
+ }
+
+ MethodInfo theMethod = Reflect.GetMethodWithAttribute(
+ fixtureType, attributeName,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly,
+ true);
+
+ if (theMethod != null)
+ {
+ if (theMethod.IsStatic ||
+ theMethod.IsAbstract ||
+ !theMethod.IsPublic && !theMethod.IsFamily ||
+ theMethod.GetParameters().Length != 0 ||
+ !theMethod.ReturnType.Equals(typeof(void)))
+ {
+ reason = string.Format("Invalid {0} method signature", name);
+ return false;
+ }
+ }
+
+ return true;
+ }
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/core/Builders/SetUpFixtureBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/SetUpFixtureBuilder.cs
new file mode 100644
index 00000000000..9e76e8d2312
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/SetUpFixtureBuilder.cs
@@ -0,0 +1,35 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core.Builders
+{
+ /// <summary>
+ /// SetUpFixtureBuilder knows how to build a SetUpFixture.
+ /// </summary>
+ public class SetUpFixtureBuilder : Extensibility.ISuiteBuilder
+ {
+ public SetUpFixtureBuilder()
+ {
+ //
+ // TODO: Add constructor logic here //
+ }
+
+ #region ISuiteBuilder Members
+
+ public Test BuildFrom(Type type)
+ {
+ return new SetUpFixture( type );
+ }
+
+ public bool CanBuildFrom(Type type)
+ {
+ return Reflect.HasAttribute( type, NUnitFramework.SetUpFixtureAttribute, false );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs b/mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs
new file mode 100644
index 00000000000..e1f31b83ded
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Builders/TestAssemblyBuilder.cs
@@ -0,0 +1,213 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core.Builders
+{
+ /// <summary>
+ /// Class that builds a TestSuite from an assembly
+ /// </summary>
+ public class TestAssemblyBuilder
+ {
+
+ #region Instance Fields
+ /// <summary>
+ /// The loaded assembly
+ /// </summary>
+ Assembly assembly;
+
+ /// <summary>
+ /// Our LegacySuite builder, which is only used when a
+ /// fixture has been passed by name on the command line.
+ /// </summary>
+ ISuiteBuilder legacySuiteBuilder;
+
+ private TestAssemblyInfo assemblyInfo = null;
+
+ #endregion
+
+ #region Properties
+ public Assembly Assembly
+ {
+ get { return assembly; }
+ }
+
+ public TestAssemblyInfo AssemblyInfo
+ {
+ get
+ {
+ if ( assemblyInfo == null && assembly != null )
+ {
+ string path = TestFixtureBuilder.GetAssemblyPath( assembly );
+ AssemblyReader rdr = new AssemblyReader( path );
+ Version runtimeVersion = new Version( rdr.ImageRuntimeVersion.Substring( 1 ) );
+ IList frameworks = CoreExtensions.Host.TestFrameworks.GetReferencedFrameworks( assembly );
+ assemblyInfo = new TestAssemblyInfo( path, runtimeVersion, frameworks );
+ }
+
+ return assemblyInfo;
+ }
+ }
+ #endregion
+
+ #region Constructor
+
+ public TestAssemblyBuilder()
+ {
+ // TODO: Keeping this separate till we can make
+ //it work in all situations.
+ legacySuiteBuilder = new NUnit.Core.Builders.LegacySuiteBuilder();
+ }
+
+ #endregion
+
+ #region Build Methods
+ public Test Build( string assemblyName, string testName, bool autoSuites )
+ {
+ if ( testName == null || testName == string.Empty )
+ return Build( assemblyName, autoSuites );
+
+ this.assembly = Load( assemblyName );
+ if ( assembly == null ) return null;
+
+ // If provided test name is actually the name of
+ // a type, we handle it specially
+ Type testType = assembly.GetType(testName);
+ if( testType != null )
+ return Build( assemblyName, testType, autoSuites );
+
+ // Assume that testName is a namespace and get all fixtures in it
+ IList fixtures = GetFixtures( assembly, testName );
+ if ( fixtures.Count > 0 )
+ return BuildTestAssembly( assemblyName, fixtures, autoSuites );
+ return null;
+ }
+
+ public TestSuite Build( string assemblyName, bool autoSuites )
+ {
+ this.assembly = Load( assemblyName );
+ if ( this.assembly == null ) return null;
+
+ IList fixtures = GetFixtures( assembly, null );
+ return BuildTestAssembly( assemblyName, fixtures, autoSuites );
+ }
+
+ private Test Build( string assemblyName, Type testType, bool autoSuites )
+ {
+ // TODO: This is the only situation in which we currently
+ // recognize and load legacy suites. We need to determine
+ // whether to allow them in more places.
+ if ( legacySuiteBuilder.CanBuildFrom( testType ) )
+ return legacySuiteBuilder.BuildFrom( testType );
+ else if ( TestFixtureBuilder.CanBuildFrom( testType ) )
+ return BuildTestAssembly( assemblyName,
+ new Test[] { TestFixtureBuilder.BuildFrom( testType ) }, autoSuites );
+ return null;
+ }
+
+ private TestSuite BuildTestAssembly( string assemblyName, IList fixtures, bool autoSuites )
+ {
+ TestSuite testAssembly = new TestSuite( assemblyName );
+
+ if ( autoSuites )
+ {
+ NamespaceTreeBuilder treeBuilder =
+ new NamespaceTreeBuilder( testAssembly );
+ treeBuilder.Add( fixtures );
+ testAssembly = treeBuilder.RootSuite;
+ }
+ else
+ foreach( TestSuite fixture in fixtures )
+ {
+ if ( fixture is SetUpFixture )
+ {
+ fixture.RunState = RunState.NotRunnable;
+ fixture.IgnoreReason = "SetUpFixture cannot be used when loading tests as a flat list of fixtures";
+ }
+
+ testAssembly.Add( fixture );
+ }
+
+ if ( fixtures.Count == 0 )
+ {
+ testAssembly.RunState = RunState.NotRunnable;
+ testAssembly.IgnoreReason = "Has no TestFixtures";
+ }
+
+ NUnitFramework.ApplyCommonAttributes( assembly, testAssembly );
+
+ // TODO: Make this an option? Add Option to sort assemblies as well?
+ testAssembly.Sort();
+
+ return testAssembly;
+ }
+
+ #endregion
+
+ #region Helper Methods
+
+ private Assembly Load(string path)
+ {
+ Assembly assembly = null;
+
+ // Change currentDirectory in case assembly references unmanaged dlls
+ using( new DirectorySwapper( Path.GetDirectoryName( path ) ) )
+ {
+ // Throws if this isn't a managed assembly or if it was built
+ // with a later version of the same assembly.
+ AssemblyName.GetAssemblyName( Path.GetFileName( path ) );
+
+ // TODO: Figure out why we can't load using the assembly name
+ // in all cases. Might be a problem with the tests themselves.
+ assembly = Assembly.Load(Path.GetFileNameWithoutExtension(path));
+
+ if ( assembly != null )
+ CoreExtensions.Host.InstallAdhocExtensions( assembly );
+
+ NTrace.Info( "Loaded assembly " + assembly.FullName, "'TestAssemblyBuilder'" );
+
+ return assembly;
+ }
+ }
+
+ private IList GetFixtures( Assembly assembly, string ns )
+ {
+ ArrayList fixtures = new ArrayList();
+
+ IList testTypes = GetCandidateFixtureTypes( assembly, ns );
+ foreach(Type testType in testTypes)
+ {
+ if( TestFixtureBuilder.CanBuildFrom( testType ) )
+ fixtures.Add( TestFixtureBuilder.BuildFrom( testType ) );
+ }
+
+ return fixtures;
+ }
+
+ private IList GetCandidateFixtureTypes( Assembly assembly, string ns )
+ {
+ IList types = assembly.GetTypes();
+
+ if ( ns == null || ns == string.Empty || types.Count == 0 )
+ return types;
+
+ string prefix = ns + "." ;
+
+ ArrayList result = new ArrayList();
+ foreach( Type type in types )
+ if ( type.FullName.StartsWith( prefix ) )
+ result.Add( type );
+
+ return result;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/CoreExtensions.cs b/mcs/nunit24/NUnitCore/core/CoreExtensions.cs
new file mode 100644
index 00000000000..9f8d7d57fa0
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/CoreExtensions.cs
@@ -0,0 +1,215 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// CoreExtensions is a singleton class that groups together all
+ /// the extension points that are supported in the test domain.
+ /// It also provides access to the test builders and decorators
+ /// by other parts of the NUnit core.
+ /// </summary>
+ public class CoreExtensions : ExtensionHost, IService
+ {
+ #region Instance Fields
+ private IAddinRegistry addinRegistry;
+ private bool initialized;
+
+ private SuiteBuilderCollection suiteBuilders;
+ private TestCaseBuilderCollection testBuilders;
+ private TestDecoratorCollection testDecorators;
+ private EventListenerCollection listeners;
+
+// private log4net.Appender.ConsoleAppender appender;
+ #endregion
+
+ #region CoreExtensions Singleton
+ private static CoreExtensions host;
+ public static CoreExtensions Host
+ {
+ get
+ {
+ if (host == null)
+ host = new CoreExtensions();
+
+ return host;
+ }
+ }
+ #endregion
+
+ #region Constructors
+ public CoreExtensions()
+ {
+ this.suiteBuilders = new SuiteBuilderCollection(this);
+ this.testBuilders = new TestCaseBuilderCollection(this);
+ this.testDecorators = new TestDecoratorCollection(this);
+ this.listeners = new EventListenerCollection(this);
+
+ this.extensions = new IExtensionPoint[]
+ { suiteBuilders, testBuilders, testDecorators, listeners };
+ this.supportedTypes = ExtensionType.Core;
+
+ // TODO: This should be somewhere central
+// string logfile = Environment.GetFolderPath( Environment.SpecialFolder.ApplicationData );
+// logfile = Path.Combine( logfile, "NUnit" );
+// logfile = Path.Combine( logfile, "NUnitTest.log" );
+//
+// appender = new log4net.Appender.ConsoleAppender();
+//// appender.File = logfile;
+//// appender.AppendToFile = true;
+//// appender.LockingModel = new log4net.Appender.FileAppender.MinimalLock();
+// appender.Layout = new log4net.Layout.PatternLayout(
+// "%date{ABSOLUTE} %-5level [%4thread] %logger{1}: PID=%property{PID} %message%newline" );
+// appender.Threshold = log4net.Core.Level.All;
+// log4net.Config.BasicConfigurator.Configure(appender);
+ }
+ #endregion
+
+ #region Properties
+
+ public bool Initialized
+ {
+ get { return initialized; }
+ }
+
+ /// <summary>
+ /// Our AddinRegistry may be set from outside or passed into the domain
+ /// </summary>
+ public IAddinRegistry AddinRegistry
+ {
+ get
+ {
+ if ( addinRegistry == null )
+ addinRegistry = AppDomain.CurrentDomain.GetData( "AddinRegistry" ) as IAddinRegistry;
+
+ return addinRegistry;
+ }
+ set { addinRegistry = value; }
+ }
+
+ public ISuiteBuilder SuiteBuilders
+ {
+ get { return suiteBuilders; }
+ }
+
+ public ITestCaseBuilder TestBuilders
+ {
+ get { return testBuilders; }
+ }
+
+ public ITestDecorator TestDecorators
+ {
+ get { return testDecorators; }
+ }
+
+ public EventListener Listeners
+ {
+ get { return listeners; }
+ }
+
+ public FrameworkRegistry TestFrameworks
+ {
+ get { return frameworks; }
+ }
+ #endregion
+
+ #region Public Methods
+ public void InstallBuiltins()
+ {
+ NTrace.Info( "Installing Builtins" );
+
+ // Define NUnit Framework
+ FrameworkRegistry.Register( "NUnit", "nunit.framework" );
+
+ // Install builtin SuiteBuilders - Note that the
+ // NUnitTestCaseBuilder is installed whenever
+ // an NUnitTestFixture is being populated and
+ // removed afterward.
+ suiteBuilders.Install( new Builders.NUnitTestFixtureBuilder() );
+ suiteBuilders.Install( new Builders.SetUpFixtureBuilder() );
+ }
+
+ public void InstallAddins()
+ {
+ NTrace.Info( "Installing Addins" );
+
+ if( AddinRegistry != null )
+ {
+ foreach (Addin addin in AddinRegistry.Addins)
+ {
+ if ( (this.ExtensionTypes & addin.ExtensionType) != 0 )
+ {
+ try
+ {
+ Type type = Type.GetType(addin.TypeName);
+ if ( type == null )
+ {
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Error, "Could not locate type" );
+ NTrace.Error( "Failed to load " + addin.Name + " - Could not locate type" );
+ }
+ else if ( !InstallAddin( type ) )
+ {
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Error, "Install returned false" );
+ NTrace.Error( "Failed to load " +addin.Name + " - Install returned false" );
+ }
+ else
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Loaded, null );
+ }
+ catch( Exception ex )
+ {
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Error, ex.Message );
+ NTrace.Error( "Exception loading " + addin.Name + " - " + ex.Message );
+ }
+ }
+ }
+ }
+ }
+
+ public void InstallAdhocExtensions( Assembly assembly )
+ {
+ foreach ( Type type in assembly.GetExportedTypes() )
+ {
+ if ( type.GetCustomAttributes(typeof(NUnitAddinAttribute), false).Length == 1 )
+ InstallAddin( type );
+ }
+ }
+ #endregion
+
+ #region Helper Methods
+ private bool InstallAddin( Type type )
+ {
+ ConstructorInfo ctor = type.GetConstructor(Type.EmptyTypes);
+ object obj = ctor.Invoke( new object[0] );
+ IAddin theAddin = (IAddin)obj;
+
+ return theAddin.Install(this);
+ }
+ #endregion
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ // TODO: Add CoreExtensions.UnloadService implementation
+ }
+
+ public void InitializeService()
+ {
+ InstallBuiltins();
+ InstallAddins();
+
+ initialized = true;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/CoreExtensions.save.cs b/mcs/nunit24/NUnitCore/core/CoreExtensions.save.cs
new file mode 100644
index 00000000000..437af0aeaa0
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/CoreExtensions.save.cs
@@ -0,0 +1,215 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Reflection;
+using System.Diagnostics;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// CoreExtensions is a singleton class that groups together all
+ /// the extension points that are supported in the test domain.
+ /// It also provides access to the test builders and decorators
+ /// by other parts of the NUnit core.
+ /// </summary>
+ public class CoreExtensions : ExtensionHost, IService
+ {
+ #region Instance Fields
+ private IAddinRegistry addinRegistry;
+ private bool initialized;
+
+ private SuiteBuilderCollection suiteBuilders;
+ private TestCaseBuilderCollection testBuilders;
+ private TestDecoratorCollection testDecorators;
+ private EventListenerCollection listeners;
+ #endregion
+
+ #region CoreExtensions Singleton
+ private static CoreExtensions host;
+ public static CoreExtensions Host
+ {
+ get
+ {
+ if (host == null)
+ {
+ host = new CoreExtensions();
+// host.InitializeService();
+ }
+
+ return host;
+ }
+ }
+ #endregion
+
+ #region Constructors
+ public CoreExtensions()
+ {
+ this.suiteBuilders = new SuiteBuilderCollection();
+ this.testBuilders = new TestCaseBuilderCollection();
+ this.testDecorators = new TestDecoratorCollection();
+ this.listeners = new EventListenerCollection();
+
+ this.extensions = new IExtensionPoint[]
+ { suiteBuilders, testBuilders, testDecorators };
+ this.supportedTypes = ExtensionType.Core;
+ }
+ #endregion
+
+ #region Properties
+
+ public bool Initialized
+ {
+ get { return initialized; }
+ }
+
+ /// <summary>
+ /// Our AddinRegistry may be set from outside or passed into the domain
+ /// </summary>
+ public IAddinRegistry AddinRegistry
+ {
+ get
+ {
+ if ( addinRegistry == null )
+ addinRegistry = AppDomain.CurrentDomain.GetData( "AddinRegistry" ) as IAddinRegistry;
+
+ return addinRegistry;
+ }
+ set { addinRegistry = value; }
+ }
+
+ public ISuiteBuilder SuiteBuilders
+ {
+ get { return suiteBuilders; }
+ }
+
+ public TestCaseBuilderCollection TestBuilders
+ {
+ get { return testBuilders; }
+ }
+
+ public ITestDecorator TestDecorators
+ {
+ get { return testDecorators; }
+ }
+
+ public FrameworkRegistry TestFrameworks
+ {
+ get { return frameworks; }
+ }
+ #endregion
+
+ #region Public Methods
+ public void InstallBuiltins()
+ {
+ //Trace.WriteLine( "Installing Builtins" );
+
+ // Define NUnit Framework
+ FrameworkRegistry.Register( "NUnit", "nunit.framework" );
+
+ // Install builtin SuiteBuilders - Note that the
+ // NUnitTestCaseBuilder is installed whenever
+ // an NUnitTestFixture is being populated and
+ // removed afterward.
+ suiteBuilders.Install( new Builders.NUnitTestFixtureBuilder() );
+ suiteBuilders.Install( new Builders.SetUpFixtureBuilder() );
+
+ //testDecorators.InstallFinal(new Builders.MultiCultureDecorator());
+ }
+
+ public void InstallAddins()
+ {
+ //Trace.WriteLine( "Installing Addins" );
+
+ if( AddinRegistry != null )
+ {
+ foreach (Addin addin in AddinRegistry.Addins)
+ {
+ if ( (this.ExtensionTypes & addin.ExtensionType) != 0 )
+ {
+ try
+ {
+ Type type = Type.GetType(addin.TypeName);
+ if ( type == null )
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Error, "Could not locate type" );
+ else if ( !InstallAddin( type ) )
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Error, "Install returned false" );
+ else
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Loaded, null );
+ }
+ catch( Exception ex )
+ {
+ AddinRegistry.SetStatus( addin.Name, AddinStatus.Error, ex.Message );
+ }
+ }
+ }
+ }
+ }
+
+ public void InstallAdhocExtensions( Assembly assembly )
+ {
+ foreach ( Type type in assembly.GetExportedTypes() )
+ {
+ if ( type.GetCustomAttributes(typeof(NUnitAddinAttribute), false).Length == 1 )
+ InstallAddin( type );
+ }
+ }
+ #endregion
+
+ #region Helper Methods
+ private bool InstallAddin( Type type )
+ {
+ ConstructorInfo ctor = type.GetConstructor(Type.EmptyTypes);
+ object obj = ctor.Invoke( new object[0] );
+ IAddin theAddin = (IAddin)obj;
+
+ return theAddin.Install(this);
+ }
+ #endregion
+
+ #region Type Safe Install Helpers
+ //internal void Install( ISuiteBuilder builder )
+ //{
+ // suiteBuilders.Install( builder );
+ //}
+
+ //internal void Install( ITestCaseBuilder builder )
+ //{
+ // testBuilders.Install( builder );
+ //}
+
+ //internal void Install( ITestDecorator decorator )
+ //{
+ // testDecorators.Install( decorator );
+ //}
+
+ //internal void Install( EventListener listener )
+ //{
+ // listeners.Install( listener );
+ //}
+ #endregion
+
+ #region IService Members
+
+ public void UnloadService()
+ {
+ // TODO: Add CoreExtensions.UnloadService implementation
+ }
+
+ public void InitializeService()
+ {
+ InstallBuiltins();
+ InstallAddins();
+
+ initialized = true;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/CultureDetector.cs b/mcs/nunit24/NUnitCore/core/CultureDetector.cs
new file mode 100644
index 00000000000..9569a08045d
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/CultureDetector.cs
@@ -0,0 +1,127 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+using System.Globalization;
+
+namespace NUnit.Core
+{
+ public class CultureDetector
+ {
+ private CultureInfo currentCulture;
+
+ // Set whenever we fail to support a list of platforms
+ private string reason = string.Empty;
+
+ /// <summary>
+ /// Default constructor uses the current culutre.
+ /// </summary>
+ public CultureDetector()
+ {
+ this.currentCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
+ }
+
+ /// <summary>
+ /// Contruct a CultureHelper for a particular culture for testing.
+ /// </summary>
+ /// <param name="culture">The culture to be used</param>
+ public CultureDetector( string culture )
+ {
+ this.currentCulture = new CultureInfo( culture );
+ }
+
+ /// <summary>
+ /// Test to determine if one of a collection of culturess
+ /// is being used currently.
+ /// </summary>
+ /// <param name="cultures"></param>
+ /// <returns></returns>
+ public bool IsCultureSupported( string[] cultures )
+ {
+ foreach( string culture in cultures )
+ if ( IsCultureSupported( culture ) )
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Tests to determine if the current culture is supported
+ /// based on a culture attribute.
+ /// </summary>
+ /// <param name="platformAttribute">The attribute to examine</param>
+ /// <returns></returns>
+ public bool IsCultureSupported( Attribute cultureAttribute )
+ {
+ //Use reflection to avoid dependency on a particular framework version
+ string include = (string)Reflect.GetPropertyValue(
+ cultureAttribute, "Include",
+ BindingFlags.Public | BindingFlags.Instance );
+
+ string exclude = (string)Reflect.GetPropertyValue(
+ cultureAttribute, "Exclude",
+ BindingFlags.Public | BindingFlags.Instance );
+
+ try
+ {
+ if (include != null && !IsCultureSupported(include))
+ {
+ reason = string.Format("Only supported under culture {0}", include);
+ return false;
+ }
+
+ if (exclude != null && IsCultureSupported(exclude))
+ {
+ reason = string.Format("Not supported under culture {0}", exclude);
+ return false;
+ }
+ }
+ catch( ArgumentException ex )
+ {
+ reason = string.Format( "Invalid culture: {0}", ex.ParamName );
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Test to determine if the a particular culture or comma-
+ /// delimited set of cultures is in use.
+ /// </summary>
+ /// <param name="platform">Name of the culture or comma-separated list of culture names</param>
+ /// <returns>True if the culture is in use on the system</returns>
+ public bool IsCultureSupported( string culture )
+ {
+ culture = culture.Trim();
+
+ if ( culture.IndexOf( ',' ) >= 0 )
+ {
+ if ( IsCultureSupported( culture.Split( new char[] { ',' } ) ) )
+ return true;
+ }
+ else
+ {
+ if( this.currentCulture.Name == culture || this.currentCulture.TwoLetterISOLanguageName == culture)
+ return true;
+ }
+
+ this.reason = "Only supported under culture " + culture;
+ return false;
+ }
+
+ /// <summary>
+ /// Return the last failure reason. Results are not
+ /// defined if called before IsSupported( Attribute )
+ /// is called.
+ /// </summary>
+ public string Reason
+ {
+ get { return reason; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/DelegatingTestRunner.cs b/mcs/nunit24/NUnitCore/core/DelegatingTestRunner.cs
new file mode 100644
index 00000000000..b01852729c5
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/DelegatingTestRunner.cs
@@ -0,0 +1,174 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+namespace NUnit.Core
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+
+ /// <summary>
+ /// DelegatingTestRUnner is the abstract base for core TestRunner
+ /// implementations that operate by controlling a downstream
+ /// TestRunner. All calls are simply passed on to the
+ /// TestRunner that is provided to the constructor.
+ ///
+ /// Although the class is abstract, it has no abstract
+ /// methods specified because each implementation will
+ /// need to override different methods. All methods are
+ /// specified using interface syntax and the derived class
+ /// must explicitly implement TestRunner in order to
+ /// redefine the selected methods.
+ /// </summary>
+ public abstract class DelegatingTestRunner : MarshalByRefObject, TestRunner
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// Our runner ID
+ /// </summary>
+ protected int runnerID;
+
+ /// <summary>
+ /// The downstream TestRunner
+ /// </summary>
+ private TestRunner testRunner;
+
+ /// <summary>
+ /// The event listener for the currently running test
+ /// </summary>
+ protected EventListener listener;
+
+ #endregion
+
+ #region Construction
+ public DelegatingTestRunner(TestRunner testRunner)
+ {
+ this.testRunner = testRunner;
+ this.runnerID = testRunner.ID;
+ }
+
+ /// <summary>
+ /// Protected constructor for runners that delay creation
+ /// of their downstream runner.
+ /// </summary>
+ protected DelegatingTestRunner( int runnerID )
+ {
+ this.runnerID = runnerID;
+ }
+ #endregion
+
+ #region Properties
+ public virtual int ID
+ {
+ get { return runnerID; }
+ }
+
+ public virtual bool Running
+ {
+ get { return testRunner != null && testRunner.Running; }
+ }
+
+ public virtual IList AssemblyInfo
+ {
+ get { return testRunner == null ? null : testRunner.AssemblyInfo; }
+ }
+
+ public virtual ITest Test
+ {
+ get { return testRunner == null ? null : testRunner.Test; }
+ }
+
+ public virtual TestResult TestResult
+ {
+ get { return testRunner == null ? null : testRunner.TestResult; }
+ }
+
+ /// <summary>
+ /// Protected property copies any settings to the downstream test runner
+ /// when it is set. Derived runners overriding this should call the base
+ /// or copy the settings themselves.
+ /// </summary>
+ protected virtual TestRunner TestRunner
+ {
+ get { return testRunner; }
+ set { testRunner = value; }
+ }
+ #endregion
+
+ #region Load and Unload Methods
+ public virtual bool Load( TestPackage package )
+ {
+ return this.testRunner.Load( package );
+ }
+
+ public virtual void Unload()
+ {
+ if ( this.testRunner != null )
+ this.testRunner.Unload();
+ }
+ #endregion
+
+ #region CountTestCases
+ public virtual int CountTestCases( ITestFilter filter )
+ {
+ return this.testRunner.CountTestCases( filter );
+ }
+ #endregion
+
+ #region Methods for Running Tests
+ public virtual TestResult Run(EventListener listener)
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ return this.testRunner.Run(listener);
+ }
+
+ public virtual TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ return this.testRunner.Run(listener, filter);
+ }
+
+ public virtual void BeginRun( EventListener listener )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ this.testRunner.BeginRun( listener );
+ }
+
+ public virtual void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ this.testRunner.BeginRun( listener, filter );
+ }
+
+ public virtual TestResult EndRun()
+ {
+ return this.testRunner.EndRun();
+ }
+
+ public virtual void CancelRun()
+ {
+ this.testRunner.CancelRun();
+ }
+
+ public virtual void Wait()
+ {
+ this.testRunner.Wait();
+ }
+ #endregion
+
+ #region InitializeLifetimeService Override
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/DirectorySwapper.cs b/mcs/nunit24/NUnitCore/core/DirectorySwapper.cs
new file mode 100644
index 00000000000..88eaa093adf
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/DirectorySwapper.cs
@@ -0,0 +1,44 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Utility class that allows changing the current directory
+ /// for the duration of some lexical scope and guaranteeing
+ /// that it will be restored upon exit.
+ ///
+ /// Use it as follows:
+ /// using( new DirectorySwapper( @"X:\New\Path" )
+ /// {
+ /// // Code that operates in the new current directory
+ /// }
+ ///
+ /// Instantiating DirectorySwapper without a path merely
+ /// saves the current directory, but does not change it.
+ /// </summary>
+ public class DirectorySwapper : IDisposable
+ {
+ private string savedDirectoryName;
+
+ public DirectorySwapper() : this( null ) { }
+
+ public DirectorySwapper( string directoryName )
+ {
+ savedDirectoryName = Environment.CurrentDirectory;
+
+ if ( directoryName != null && directoryName != string.Empty )
+ Environment.CurrentDirectory = directoryName;
+ }
+
+ public void Dispose()
+ {
+ Environment.CurrentDirectory = savedDirectoryName;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/EventListenerTextWriter.cs b/mcs/nunit24/NUnitCore/core/EventListenerTextWriter.cs
new file mode 100644
index 00000000000..98a1c3057a7
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/EventListenerTextWriter.cs
@@ -0,0 +1,114 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+namespace NUnit.Core
+{
+ using System;
+ using System.IO;
+ using System.Text;
+
+ public class EventListenerTextWriter : TextWriter
+ {
+ private EventListener eventListener;
+ private TestOutputType type;
+
+ public EventListenerTextWriter( EventListener eventListener, TestOutputType type )
+ {
+ this.eventListener = eventListener;
+ this.type = type;
+ }
+ override public void Write(char aChar)
+ {
+ this.eventListener.TestOutput( new TestOutput( aChar.ToString(), this.type ) );
+ }
+
+ override public void Write(string aString)
+ {
+ this.eventListener.TestOutput( new TestOutput( aString, this.type ) );
+ }
+
+ override public void WriteLine(string aString)
+ {
+ this.eventListener.TestOutput( new TestOutput( aString + this.NewLine, this.type ) );
+ }
+
+ override public System.Text.Encoding Encoding
+ {
+ get { return Encoding.Default; }
+ }
+ }
+
+ /// <summary>
+ /// This wrapper adds buffering to improve cross-domain performance.
+ /// </summary>
+ public class BufferedEventListenerTextWriter : TextWriter
+ {
+ private EventListener eventListener;
+ private TestOutputType type;
+ private const int MAX_BUFFER = 1024;
+ private StringBuilder sb = new StringBuilder( MAX_BUFFER );
+
+ public BufferedEventListenerTextWriter( EventListener eventListener, TestOutputType type )
+ {
+ this.eventListener = eventListener;
+ this.type = type;
+ }
+
+ public override Encoding Encoding
+ {
+ get
+ {
+ return Encoding.Default;
+ }
+ }
+
+ override public void Write(char ch)
+ {
+ lock( sb )
+ {
+ sb.Append( ch );
+ this.CheckBuffer();
+ }
+ }
+
+ override public void Write(string str)
+ {
+ lock( sb )
+ {
+ sb.Append( str );
+ this.CheckBuffer();
+ }
+ }
+
+ override public void WriteLine(string str)
+ {
+ lock( sb )
+ {
+ sb.Append( str );
+ sb.Append( base.NewLine );
+ this.CheckBuffer();
+ }
+ }
+
+ override public void Flush()
+ {
+ if ( sb.Length > 0 )
+ {
+ lock( sb )
+ {
+ TestOutput output = new TestOutput(sb.ToString(), this.type);
+ this.eventListener.TestOutput( output );
+ sb.Length = 0;
+ }
+ }
+ }
+
+ private void CheckBuffer()
+ {
+ if ( sb.Length >= MAX_BUFFER )
+ this.Flush();
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/EventPump.cs b/mcs/nunit24/NUnitCore/core/EventPump.cs
new file mode 100644
index 00000000000..26f1cc36101
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/EventPump.cs
@@ -0,0 +1,169 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Threading;
+
+ /// <summary>
+ /// EventPump pulls events out of an EventQueue and sends
+ /// them to a listener. It is used to send events back to
+ /// the client without using the CallContext of the test
+ /// runner thread.
+ /// </summary>
+ public class EventPump : IDisposable
+ {
+ #region Instance Variables
+ /// <summary>
+ /// The downstream listener to which we send events
+ /// </summary>
+ EventListener eventListener;
+
+ /// <summary>
+ /// The queue that holds our events
+ /// </summary>
+ EventQueue events;
+
+ /// <summary>
+ /// Thread to do the pumping
+ /// </summary>
+ Thread pumpThread;
+
+ /// <summary>
+ /// Indicator that we are pumping events
+ /// </summary>
+ private bool pumping;
+
+ /// <summary>
+ /// Indicator that we are stopping
+ /// </summary>
+ private bool stopping;
+
+ /// <summary>
+ /// If true, stop after sending RunFinished
+ /// </summary>
+ private bool autostop;
+ #endregion
+
+ #region Constructor
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ /// <param name="eventListener">The EventListener to receive events</param>
+ /// <param name="events">The event queue to pull events from</param>
+ /// <param name="autostop">Set to true to stop pump after RunFinished</param>
+ public EventPump( EventListener eventListener, EventQueue events, bool autostop)
+ {
+ this.eventListener = eventListener;
+ this.events = events;
+ this.autostop = autostop;
+ }
+ #endregion
+
+ #region Properties
+ // TODO: Replace booleans with a state?
+ /// <summary>
+ /// Returns true if we are pumping events
+ /// </summary>
+ public bool Pumping
+ {
+ get { return pumping; }
+ }
+
+ /// <summary>
+ /// Returns true if a stop is in progress
+ /// </summary>
+ public bool Stopping
+ {
+ get { return stopping; }
+ }
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Dispose stops the pump
+ /// </summary>
+ public void Dispose()
+ {
+ Stop();
+ }
+
+ /// <summary>
+ /// Start the pump
+ /// </summary>
+ public void Start()
+ {
+ if ( !this.Pumping ) // Ignore if already started
+ {
+ this.pumpThread = new Thread( new ThreadStart( PumpThreadProc ) );
+ this.pumpThread.Name = "EventPumpThread";
+ pumping = true;
+ this.pumpThread.Start();
+ }
+ }
+
+ /// <summary>
+ /// Tell the pump to stop after emptying the queue.
+ /// </summary>
+ public void Stop()
+ {
+ if ( this.Pumping && !this.Stopping ) // Ignore extra calls
+ {
+ lock( events )
+ {
+ stopping = true;
+ Monitor.Pulse( events ); // In case thread is waiting
+ }
+ this.pumpThread.Join();
+ }
+ }
+ #endregion
+
+ #region PumpThreadProc
+ /// <summary>
+ /// Our thread proc for removing items from the event
+ /// queue and sending them on. Note that this would
+ /// need to do more locking if any other thread were
+ /// removing events from the queue.
+ /// </summary>
+ private void PumpThreadProc()
+ {
+ EventListener hostListeners = CoreExtensions.Host.Listeners;
+ Monitor.Enter( events );
+ try
+ {
+ while (this.events.Count > 0 || !stopping)
+ {
+ while (this.events.Count > 0)
+ {
+ Event e = this.events.Dequeue();
+ e.Send(this.eventListener);
+ e.Send(hostListeners);
+ if (autostop && e is RunFinishedEvent)
+ stopping = true;
+ }
+ // Will be pulsed if there are any events added
+ // or if it's time to stop the pump.
+ if (!stopping)
+ Monitor.Wait(events);
+ }
+ }
+ catch (Exception ex)
+ {
+ throw new ApplicationException("Exception in pump thread", ex);
+ }
+ finally
+ {
+ Monitor.Exit( events );
+ pumping = false;
+ stopping = false;
+ //pumpThread = null;
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/EventQueue.cs b/mcs/nunit24/NUnitCore/core/EventQueue.cs
new file mode 100644
index 00000000000..17320182028
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/EventQueue.cs
@@ -0,0 +1,195 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Threading;
+
+namespace NUnit.Core
+{
+ #region Individual Event Classes
+
+ /// <summary>
+ /// NUnit.Core.Event is the abstract base for all stored events.
+ /// An Event is the stored representation of a call to the
+ /// EventListener interface and is used to record such calls
+ /// or to queue them for forwarding on another thread or at
+ /// a later time.
+ /// </summary>
+ public abstract class Event
+ {
+ abstract public void Send( EventListener listener );
+ }
+
+ public class RunStartedEvent : Event
+ {
+ string name;
+ int testCount;
+
+ public RunStartedEvent( string name, int testCount )
+ {
+ this.name = name;
+ this.testCount = testCount;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.RunStarted(name, testCount);
+ }
+ }
+
+ public class RunFinishedEvent : Event
+ {
+ TestResult result;
+ Exception exception;
+
+ public RunFinishedEvent( TestResult result )
+ {
+ this.result = result;
+ }
+
+ public RunFinishedEvent( Exception exception )
+ {
+ this.exception = exception;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ if ( this.exception != null )
+ listener.RunFinished( this.exception );
+ else
+ listener.RunFinished( this.result );
+ }
+ }
+
+ public class TestStartedEvent : Event
+ {
+ TestName testName;
+
+ public TestStartedEvent( TestName testName )
+ {
+ this.testName = testName;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.TestStarted( this.testName );
+ }
+ }
+
+ public class TestFinishedEvent : Event
+ {
+ TestCaseResult result;
+
+ public TestFinishedEvent( TestCaseResult result )
+ {
+ this.result = result;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.TestFinished( this.result );
+ }
+ }
+
+ public class SuiteStartedEvent : Event
+ {
+ TestName suiteName;
+
+ public SuiteStartedEvent( TestName suiteName )
+ {
+ this.suiteName = suiteName;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.SuiteStarted( this.suiteName );
+ }
+ }
+
+ public class SuiteFinishedEvent : Event
+ {
+ TestSuiteResult result;
+
+ public SuiteFinishedEvent( TestSuiteResult result )
+ {
+ this.result = result;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.SuiteFinished( this.result );
+ }
+ }
+
+ public class UnhandledExceptionEvent : Event
+ {
+ Exception exception;
+
+ public UnhandledExceptionEvent( Exception exception )
+ {
+ this.exception = exception;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.UnhandledException( this.exception );
+ }
+ }
+
+ public class OutputEvent : Event
+ {
+ TestOutput output;
+
+ public OutputEvent( TestOutput output )
+ {
+ this.output = output;
+ }
+
+ public override void Send( EventListener listener )
+ {
+ listener.TestOutput( this.output );
+ }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Implements a queue of work items each of which
+ /// is queued as a WaitCallback.
+ /// </summary>
+ public class EventQueue
+ {
+ private Queue queue = new Queue();
+
+ public int Count
+ {
+ get
+ {
+ lock( this )
+ {
+ return this.queue.Count;
+ }
+ }
+ }
+
+ public void Enqueue( Event e )
+ {
+ lock( this )
+ {
+ this.queue.Enqueue( e );
+ Monitor.Pulse( this );
+ }
+ }
+
+ public Event Dequeue()
+ {
+ lock( this )
+ {
+ return (Event)this.queue.Dequeue();
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/AddinRegistry.cs b/mcs/nunit24/NUnitCore/core/Extensibility/AddinRegistry.cs
new file mode 100644
index 00000000000..8377e199172
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/AddinRegistry.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// Summary description for AddinRegistry.
+ /// </summary>
+ public class AddinRegistry : MarshalByRefObject, IAddinRegistry, IService
+ {
+ #region Instance Fields
+ private ArrayList addins = new ArrayList();
+ #endregion
+
+ #region IAddinRegistry Members
+
+ //public void Register(Type type)
+ //{
+ // addins.Add( new Addin( type ) );
+ //}
+
+ public void Register(Addin addin)
+ {
+ addins.Add( addin );
+ }
+
+ public void Register(Assembly assembly)
+ {
+ foreach (Type type in assembly.GetExportedTypes())
+ {
+ if (type.GetCustomAttributes(typeof(NUnitAddinAttribute), false).Length == 1)
+ {
+ Addin addin = new Addin(type);
+ Register(addin);
+ }
+ }
+ }
+
+ public IList Addins
+ {
+ get
+ {
+ return addins;
+ }
+ }
+
+ public void SetStatus( string name, AddinStatus status )
+ {
+ foreach( Addin addin in addins )
+ if ( addin.Name == name )
+ addin.Status = status;
+ }
+ #endregion
+
+ #region IService Members
+ public void InitializeService()
+ {
+ }
+
+ public void UnloadService()
+ {
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/EventListenerCollection.cs b/mcs/nunit24/NUnitCore/core/Extensibility/EventListenerCollection.cs
new file mode 100644
index 00000000000..de1319e4e9b
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/EventListenerCollection.cs
@@ -0,0 +1,86 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// EventListenerCollection holds multiple event listeners
+ /// and relays all event calls to each of them.
+ /// </summary>
+ public class EventListenerCollection : ExtensionPoint, EventListener
+ {
+ #region Constructor
+ public EventListenerCollection( IExtensionHost host )
+ : base( "EventListeners", host ) { }
+ #endregion
+
+ #region EventListener Members
+ public void RunStarted(string name, int testCount)
+ {
+ foreach( EventListener listener in extensions )
+ listener.RunStarted( name, testCount );
+ }
+
+ public void RunFinished(TestResult result)
+ {
+ foreach( EventListener listener in extensions )
+ listener.RunFinished( result );
+ }
+
+ public void RunFinished(Exception exception)
+ {
+ foreach( EventListener listener in extensions )
+ listener.RunFinished( exception );
+ }
+
+ public void SuiteStarted(TestName testName)
+ {
+ foreach( EventListener listener in extensions )
+ listener.SuiteStarted( testName );
+ }
+
+ public void SuiteFinished(TestSuiteResult result)
+ {
+ foreach( EventListener listener in extensions )
+ listener.SuiteFinished( result );
+ }
+
+ public void TestStarted(TestName testName)
+ {
+ foreach( EventListener listener in extensions )
+ listener.TestStarted( testName );
+ }
+
+ public void TestFinished(TestCaseResult result)
+ {
+ foreach( EventListener listener in extensions )
+ listener.TestFinished( result );
+ }
+
+ public void UnhandledException(Exception exception)
+ {
+ foreach( EventListener listener in extensions )
+ listener.UnhandledException( exception );
+ }
+
+ public void TestOutput(TestOutput testOutput)
+ {
+ foreach( EventListener listener in extensions )
+ listener.TestOutput( testOutput );
+ }
+
+ #endregion
+
+ #region ExtensionPoint Overrides
+ protected override bool ValidExtension(object extension)
+ {
+ return extension is EventListener;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/FrameworkRegistry.cs b/mcs/nunit24/NUnitCore/core/Extensibility/FrameworkRegistry.cs
new file mode 100644
index 00000000000..5cf23e399ac
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/FrameworkRegistry.cs
@@ -0,0 +1,60 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+using System.Collections;
+
+namespace NUnit.Core.Extensibility
+{
+ public class FrameworkRegistry : IFrameworkRegistry
+ {
+ #region Instance Fields
+ /// <summary>
+ /// List of FrameworkInfo structs for supported frameworks
+ /// </summary>
+ private Hashtable testFrameworks = new Hashtable();
+ #endregion
+
+ #region IFrameworkRegistry Members
+ /// <summary>
+ /// Register a framework. NUnit registers itself using this method. Add-ins that
+ /// work with or emulate a different framework may register themselves as well.
+ /// </summary>
+ /// <param name="frameworkName">The name of the framework</param>
+ /// <param name="assemblyName">The name of the assembly that framework users reference</param>
+ public void Register(string frameworkName, string assemblyName)
+ {
+ testFrameworks[frameworkName] = new TestFramework(frameworkName, assemblyName);
+ }
+ #endregion
+
+ #region Other Methods
+ /// <summary>
+ /// Get a list of known frameworks referenced by an assembly
+ /// </summary>
+ /// <param name="assembly">The assembly to be examined</param>
+ /// <returns>A list of AssemblyNames</returns>
+ public IList GetReferencedFrameworks(Assembly assembly)
+ {
+ ArrayList referencedAssemblies = new ArrayList();
+
+ foreach (AssemblyName assemblyRef in assembly.GetReferencedAssemblies())
+ {
+ foreach (TestFramework info in testFrameworks.Values)
+ {
+ if (assemblyRef.Name == info.AssemblyName)
+ {
+ referencedAssemblies.Add(assemblyRef);
+ break;
+ }
+ }
+ }
+
+ return referencedAssemblies;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/SuiteBuilderCollection.cs b/mcs/nunit24/NUnitCore/core/Extensibility/SuiteBuilderCollection.cs
new file mode 100644
index 00000000000..57a2413b450
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/SuiteBuilderCollection.cs
@@ -0,0 +1,68 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// SuiteBuilderCollection is an ExtensionPoint for SuiteBuilders and
+ /// implements the ISuiteBuilder interface itself, passing calls
+ /// on to the individual builders.
+ ///
+ /// The builders are added to the collection by inserting them at
+ /// the start, as to take precedence over those added earlier.
+ /// </summary>
+ public class SuiteBuilderCollection : ExtensionPoint, ISuiteBuilder
+ {
+ #region Constructor
+ /// <summary>
+ /// Default constructor
+ /// </summary>
+ public SuiteBuilderCollection(IExtensionHost host)
+ : base("SuiteBuilders", host ) { }
+ #endregion
+
+ #region ISuiteBuilder Members
+
+ /// <summary>
+ /// Examine the type and determine if it is suitable for
+ /// any SuiteBuilder to use in building a TestSuite
+ /// </summary>
+ /// <param name="type">The type of the fixture to be used</param>
+ /// <returns>True if the type can be used to build a TestSuite</returns>
+ public bool CanBuildFrom(Type type)
+ {
+ foreach( ISuiteBuilder builder in extensions )
+ if ( builder.CanBuildFrom( type ) )
+ return true;
+ return false;
+ }
+
+ /// <summary>
+ /// Build a TestSuite from type provided.
+ /// </summary>
+ /// <param name="type">The type of the fixture to be used</param>
+ /// <returns>A TestSuite or null</returns>
+ public Test BuildFrom(Type type)
+ {
+ foreach( ISuiteBuilder builder in extensions )
+ if ( builder.CanBuildFrom( type ) )
+ return builder.BuildFrom( type );
+ return null;
+ }
+
+ #endregion
+
+ #region ExtensionPoint Overrides
+ protected override bool ValidExtension(object extension)
+ {
+ return extension is ISuiteBuilder;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/TestCaseBuilderCollection.cs b/mcs/nunit24/NUnitCore/core/Extensibility/TestCaseBuilderCollection.cs
new file mode 100644
index 00000000000..7e174026ca2
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/TestCaseBuilderCollection.cs
@@ -0,0 +1,67 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// TestCaseBuilderCollection is an ExtensionPoint for TestCaseBuilders
+ /// and implements the ITestCaseBuilder interface itself, passing calls
+ /// on to the individual builders.
+ ///
+ /// The builders are added to the collection by inserting them at
+ /// the start, as to take precedence over those added earlier.
+ /// </summary>
+ public class TestCaseBuilderCollection : ExtensionPoint, ITestCaseBuilder
+ {
+ #region Constructor
+ public TestCaseBuilderCollection(IExtensionHost host)
+ : base("TestCaseBuilders", host) { }
+ #endregion
+
+ #region ITestCaseBuilder Members
+
+ /// <summary>
+ /// Examine the method and determine if it is suitable for
+ /// any TestCaseBuilder to use in building a TestCase
+ /// </summary>
+ /// <param name="method">The method to be used as a test case</param>
+ /// <returns>True if the type can be used to build a TestCase</returns>
+ public bool CanBuildFrom( MethodInfo method )
+ {
+ foreach( ITestCaseBuilder builder in extensions )
+ if ( builder.CanBuildFrom( method ) )
+ return true;
+ return false;
+ }
+
+ /// <summary>
+ /// Build a TestCase from the method provided.
+ /// </summary>
+ /// <param name="method">The method to be used</param>
+ /// <returns>A TestCase or null</returns>
+ public Test BuildFrom( MethodInfo method )
+ {
+ foreach( ITestCaseBuilder builder in extensions )
+ {
+ if ( builder.CanBuildFrom( method ) )
+ return builder.BuildFrom( method );
+ }
+
+ return null;
+ }
+ #endregion
+
+ #region ExtensionPoint Overrides
+ protected override bool ValidExtension(object extension)
+ {
+ return extension is ITestCaseBuilder;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.cs b/mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.cs
new file mode 100644
index 00000000000..e224ab9c01c
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.cs
@@ -0,0 +1,43 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// TestDecoratorCollection is an ExtensionPoint for TestDecorators and
+ /// implements the ITestDecorator interface itself, passing calls
+ /// on to the individual decorators.
+ /// </summary>
+ public class TestDecoratorCollection : ExtensionPoint, ITestDecorator
+ {
+ #region Constructor
+ public TestDecoratorCollection(IExtensionHost host)
+ : base( "TestDecorators", host ) { }
+ #endregion
+
+ #region ITestDecorator Members
+ public Test Decorate(Test test, MemberInfo member)
+ {
+ Test decoratedTest = test;
+
+ foreach( ITestDecorator decorator in extensions )
+ decoratedTest = decorator.Decorate( decoratedTest, member );
+
+ return decoratedTest;
+ }
+ #endregion
+
+ #region ExtensionPoint Overrides
+ protected override bool ValidExtension(object extension)
+ {
+ return extension is ITestDecorator;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.save.cs b/mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.save.cs
new file mode 100644
index 00000000000..b5dfaa01f88
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Extensibility/TestDecoratorCollection.save.cs
@@ -0,0 +1,84 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// TestDecoratorCollection is an ExtensionPoint for TestDecorators and
+ /// implements the ITestDecorator interface itself, passing calls
+ /// on to the individual decorators.
+ /// </summary>
+ public class TestDecoratorCollection : ITestDecorator, IExtensionPoint
+ {
+ private ArrayList decorators = new ArrayList();
+ private ArrayList finalDecorators = new ArrayList();
+
+ #region Constructors
+ public TestDecoratorCollection() { }
+
+ public TestDecoratorCollection( TestDecoratorCollection other )
+ {
+ decorators.AddRange( other.decorators );
+ }
+ #endregion
+
+ #region ITestDecorator Members
+ public Test Decorate(Test test, MemberInfo member)
+ {
+ Test decoratedTest = test;
+
+ foreach (ITestDecorator decorator in decorators)
+ decoratedTest = decorator.Decorate(decoratedTest, member);
+ foreach (ITestDecorator decorator in finalDecorators)
+ decoratedTest = decorator.Decorate(decoratedTest, member);
+
+ return decoratedTest;
+ }
+ #endregion
+
+ #region IExtensionPoint Members
+ public string Name
+ {
+ get { return "TestDecorators"; }
+ }
+
+ public IExtensionHost Host
+ {
+ get { return CoreExtensions.Host; }
+ }
+
+ public void Install(object extension)
+ {
+ ITestDecorator decorator = extension as ITestDecorator;
+ if ( decorator == null )
+ throw new ArgumentException(
+ extension.GetType().FullName + " is not an ITestDecorator", "exception" );
+
+ decorators.Add( extension );
+ }
+
+ public void Remove( object extension )
+ {
+ decorators.Remove( extension );
+ }
+ #endregion
+
+ #region Public non-Interface Methods
+ /// <summary>
+ /// Used internally by NUnit to install decorators that
+ /// are run after all other decorators have run.
+ /// </summary>
+ /// <param name="decorator"></param>
+ public void InstallFinal(ITestDecorator decorator)
+ {
+ finalDecorators.Add(decorator);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/ExtensionHost.cs b/mcs/nunit24/NUnitCore/core/ExtensionHost.cs
new file mode 100644
index 00000000000..dda7390eb3f
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/ExtensionHost.cs
@@ -0,0 +1,57 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// ExtensionHost is the abstract base class used for
+ /// all extension hosts. It provides an array of
+ /// extension points and a FrameworkRegistry and
+ /// implements the IExtensionHost interface. Derived
+ /// classes must initialize the extension points.
+ /// </summary>
+ public abstract class ExtensionHost : IExtensionHost
+ {
+ protected FrameworkRegistry frameworks;
+
+ protected IExtensionPoint[] extensions;
+
+ protected ExtensionType supportedTypes;
+
+ public ExtensionHost()
+ {
+ frameworks = new FrameworkRegistry();
+ }
+
+ #region IExtensionHost Interface
+ public IExtensionPoint[] ExtensionPoints
+ {
+ get { return extensions; }
+ }
+
+ public IFrameworkRegistry FrameworkRegistry
+ {
+ get { return frameworks; }
+ }
+
+ public IExtensionPoint GetExtensionPoint( string name )
+ {
+ foreach ( IExtensionPoint extensionPoint in extensions )
+ if ( extensionPoint.Name == name )
+ return extensionPoint;
+
+ return null;
+ }
+
+ public ExtensionType ExtensionTypes
+ {
+ get { return supportedTypes; }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/ExtensionPoint.cs b/mcs/nunit24/NUnitCore/core/ExtensionPoint.cs
new file mode 100644
index 00000000000..786d849d0a1
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/ExtensionPoint.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// ExtensionPoint is used as a base class for all
+ /// extension points.
+ /// </summary>
+ public abstract class ExtensionPoint : IExtensionPoint
+ {
+ private string name;
+ private IExtensionHost host;
+
+ protected ArrayList extensions = new ArrayList();
+
+ #region Constructor
+ public ExtensionPoint(string name, IExtensionHost host)
+ {
+ this.name = name;
+ this.host = host;
+ }
+ #endregion
+
+ #region IExtensionPoint Members
+ /// <summary>
+ /// Get the name of this extension point
+ /// </summary>
+ public string Name
+ {
+ get { return this.name; }
+ }
+
+ /// <summary>
+ /// Get the host that provides this extension point
+ /// </summary>
+ public IExtensionHost Host
+ {
+ get { return this.host; }
+ }
+
+ /// <summary>
+ /// Install an extension at this extension point. If the
+ /// extension object does not meet the requirements for
+ /// this extension point, an exception is thrown.
+ /// </summary>
+ /// <param name="extension">The extension to install</param>
+ public void Install(object extension)
+ {
+ if ( !ValidExtension( extension ) )
+ throw new ArgumentException(
+ extension.GetType().FullName + " is not {0} extension point", "extension" );
+
+ extensions.Add( extension );
+ }
+
+ /// <summary>
+ /// Removes an extension from this extension point. If the
+ /// extension object is not present, the method returns
+ /// without error.
+ /// </summary>
+ /// <param name="extension"></param>
+ public void Remove(object extension)
+ {
+ extensions.Remove( extension );
+ }
+ #endregion
+
+ #region Abstract Methods
+ protected abstract bool ValidExtension(object extension);
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/IgnoreDecorator.cs b/mcs/nunit24/NUnitCore/core/IgnoreDecorator.cs
new file mode 100644
index 00000000000..4a983d483a4
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/IgnoreDecorator.cs
@@ -0,0 +1,49 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Ignore Decorator is an alternative method of marking tests to
+ /// be ignored. It is currently not used, since the test builders
+ /// take care of the ignore attribute.
+ /// </summary>
+ public class IgnoreDecorator : Extensibility.ITestDecorator
+ {
+ public IgnoreDecorator( string ignoreAttributeType )
+ {
+ }
+
+ #region ITestDecorator Members
+
+// public Test Decorate(Test test, MethodInfo method)
+// {
+// return DecorateTest( test, method );
+// }
+//
+// public Test Decorate(Test test, Type fixtureType)
+// {
+// return DecorateTest( test, fixtureType );
+// }
+
+ public Test Decorate( Test test, MemberInfo member )
+ {
+ Attribute ignoreAttribute = Reflect.GetAttribute( member, NUnitFramework.IgnoreAttribute, false );
+
+ if ( ignoreAttribute != null )
+ {
+ test.RunState = RunState.Ignored;
+ test.IgnoreReason = NUnitFramework.GetIgnoreReason( ignoreAttribute );
+ }
+
+ return test;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/InvalidSuiteException.cs b/mcs/nunit24/NUnitCore/core/InvalidSuiteException.cs
new file mode 100644
index 00000000000..0b91b2f626a
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/InvalidSuiteException.cs
@@ -0,0 +1,44 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ [Serializable]
+ public class InvalidSuiteException : ApplicationException
+ {
+ public InvalidSuiteException () : base()
+ {}
+
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ public InvalidSuiteException(string message) : base (message)
+ {}
+
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ /// <param name="inner">The exception that caused the
+ /// current exception</param>
+ public InvalidSuiteException(string message, Exception inner) :
+ base(message, inner)
+ {}
+
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected InvalidSuiteException(SerializationInfo info,
+ StreamingContext context) : base(info,context){}
+
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/core/InvalidTestFixtureException.cs b/mcs/nunit24/NUnitCore/core/InvalidTestFixtureException.cs
new file mode 100644
index 00000000000..767a1d88556
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/InvalidTestFixtureException.cs
@@ -0,0 +1,34 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Summary description for NoTestMethodsException.
+ /// </summary>
+ ///
+ [Serializable]
+ public class InvalidTestFixtureException : ApplicationException
+ {
+ public InvalidTestFixtureException() : base() {}
+
+ public InvalidTestFixtureException(string message) : base(message)
+ {}
+
+ public InvalidTestFixtureException(string message, Exception inner) : base(message, inner)
+ {}
+
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected InvalidTestFixtureException(SerializationInfo info,
+ StreamingContext context) : base(info,context){}
+
+ }
+} \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/core/LegacySuite.cs b/mcs/nunit24/NUnitCore/core/LegacySuite.cs
new file mode 100644
index 00000000000..944bc3106e2
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/LegacySuite.cs
@@ -0,0 +1,85 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Represents a test suite constructed from a type that has a static Suite property
+ /// </summary>
+ public class LegacySuite : TestSuite
+ {
+ #region Static Methods
+
+ public static PropertyInfo GetSuiteProperty( Type testClass )
+ {
+ if( testClass == null )
+ return null;
+
+ PropertyInfo property = Reflect.GetPropertyWithAttribute(
+ testClass,
+ NUnitFramework.SuiteAttribute,
+ BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly );
+
+ return property;
+ }
+
+ #endregion
+
+ #region Constructors
+
+ public LegacySuite( Type fixtureType ) : base( fixtureType )
+ {
+ PropertyInfo suiteProperty = GetSuiteProperty( fixtureType );
+
+ if (suiteProperty == null)
+ throw new ArgumentException( "Invalid argument to LegacySuite constructor", "fixtureType" );
+
+ this.fixtureSetUp = NUnitFramework.GetFixtureSetUpMethod(fixtureType);
+ this.fixtureTearDown = NUnitFramework.GetFixtureTearDownMethod(fixtureType);
+
+ MethodInfo method = suiteProperty.GetGetMethod(true);
+
+ if (method.GetParameters().Length == 0)
+ {
+ Type returnType = method.ReturnType;
+
+ if (returnType.FullName == "NUnit.Core.TestSuite")
+ {
+ TestSuite suite = (TestSuite)suiteProperty.GetValue(null, new Object[0]);
+ foreach (Test test in suite.Tests)
+ this.Add(test);
+ }
+ else if (typeof(IEnumerable).IsAssignableFrom(returnType))
+ {
+ foreach (object obj in (IEnumerable)suiteProperty.GetValue(null, new object[0]))
+ {
+ Type type = obj as Type;
+ if ( type != null && TestFixtureBuilder.CanBuildFrom(type) )
+ this.Add( TestFixtureBuilder.BuildFrom(type) );
+ else
+ this.Add(obj);
+ }
+ }
+ else
+ {
+ this.RunState = RunState.NotRunnable;
+ this.IgnoreReason = "Suite property must return either TestSuite or IEnumerable";
+ }
+ }
+ else
+ {
+ this.RunState = RunState.NotRunnable;
+ this.IgnoreReason = "Suite property may not be indexed";
+ }
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Log4NetCapture.cs b/mcs/nunit24/NUnitCore/core/Log4NetCapture.cs
new file mode 100644
index 00000000000..f7c07a2e87d
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Log4NetCapture.cs
@@ -0,0 +1,180 @@
+// ****************************************************************
+// Copyright 2008, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Reflection;
+using BF = System.Reflection.BindingFlags;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Proxy class for operations on a real log4net appender,
+ /// allowing NUnit to work with multiple versions of log4net
+ /// and to fail gracefully if no log4net assembly is present.
+ /// </summary>
+ public class Log4NetCapture : LogCapture
+ {
+ private Assembly log4netAssembly;
+ private Type appenderType;
+ private Type basicConfiguratorType;
+
+ private object appender;
+ private bool isInitialized;
+
+ // Layout codes that work for versions from
+ // log4net 1.2.0.30714 to 1.2.10:
+ //
+ // %a = domain friendly name
+ // %c = logger name (%c{1} = last component )
+ // %d = date and time
+ // %d{ABSOLUTE} = time only
+ // %l = source location of the error
+ // %m = message
+ // %n = newline
+ // %p = level
+ // %r = elapsed milliseconds since program start
+ // %t = thread
+ // %x = nested diagnostic content (NDC)
+ private static readonly string logFormat =
+ "%d{ABSOLUTE} %-5p [%4t] %c{1} [%x]- %m%n";
+
+ protected override void StartCapture()
+ {
+ if ( IsInitialized )
+ {
+ string threshold = DefaultThreshold;
+ if ( !SetLoggingThreshold( threshold ) )
+ SetLoggingThreshold( "Error" );
+
+ SetAppenderTextWriter( this.Writer );
+ ConfigureAppender();
+ }
+ }
+
+ protected override void StopCapture()
+ {
+ if ( appender != null )
+ {
+ SetLoggingThreshold( "Off" );
+ SetAppenderTextWriter( null );
+ }
+ }
+
+ #region Helpers
+ private bool IsInitialized
+ {
+ get
+ {
+ if ( isInitialized )
+ return true;
+
+ try
+ {
+ log4netAssembly = Assembly.Load( "log4net" );
+ if ( log4netAssembly == null ) return false;
+
+ appenderType = log4netAssembly.GetType(
+ "log4net.Appender.TextWriterAppender", false, false );
+ if ( appenderType == null ) return false;
+
+ basicConfiguratorType = log4netAssembly.GetType(
+ "log4net.Config.BasicConfigurator", false, false );
+ if ( basicConfiguratorType == null ) return false;
+
+ appender = TryCreateAppender();
+ if ( appender == null ) return false;
+
+ SetAppenderLogFormat( logFormat );
+
+ isInitialized = true;
+ }
+ catch
+ {
+ }
+
+ return isInitialized;
+ }
+ }
+
+ private Assembly TryLoadLog4NetAssembly()
+ {
+ Assembly assembly = null;
+
+ try
+ {
+ assembly = Assembly.Load( "log4net" );
+ }
+ catch
+ {
+ return null;
+ }
+
+ return assembly;
+ }
+
+ /// <summary>
+ /// Attempt to create a TextWriterAppender using reflection,
+ /// failing silently if it is not possible.
+ /// </summary>
+ private object TryCreateAppender()
+ {
+ ConstructorInfo ctor = appenderType.GetConstructor( Type.EmptyTypes );
+ object appender = ctor.Invoke( new object[0] );
+
+ return appender;
+ }
+
+ private void SetAppenderLogFormat( string logFormat )
+ {
+ Type patternLayoutType = log4netAssembly.GetType(
+ "log4net.Layout.PatternLayout", false, false );
+ if ( patternLayoutType == null ) return;
+
+ ConstructorInfo ctor = patternLayoutType.GetConstructor( new Type[] { typeof(string) } );
+ if ( ctor != null )
+ {
+ object patternLayout = ctor.Invoke( new object[] { logFormat } );
+
+ if ( patternLayout != null )
+ {
+ PropertyInfo prop = appenderType.GetProperty( "Layout", BF.Public | BF.Instance | BF.SetProperty );
+ if ( prop != null )
+ prop.SetValue( appender, patternLayout, null );
+ }
+ }
+ }
+
+ private bool SetLoggingThreshold( string threshold )
+ {
+ PropertyInfo prop = appenderType.GetProperty( "Threshold", BF.Public | BF.Instance | BF.SetProperty );
+ if ( prop == null ) return false;
+
+ Type levelType = prop.PropertyType;
+ FieldInfo levelField = levelType.GetField( threshold, BF.Public | BF.Static | BF.IgnoreCase );
+ if ( levelField == null ) return false;
+
+ object level = levelField.GetValue( null );
+ prop.SetValue( appender, level, null );
+ return true;
+ }
+
+ private void SetAppenderTextWriter( TextWriter writer )
+ {
+ PropertyInfo prop = appenderType.GetProperty( "Writer", BF.Instance | BF.Public | BF.SetProperty );
+ if ( prop != null )
+ prop.SetValue( appender, writer, null );
+ }
+
+ private void ConfigureAppender()
+ {
+ MethodInfo configureMethod = basicConfiguratorType.GetMethod( "Configure", new Type[] { appenderType } );
+ if ( configureMethod != null )
+ configureMethod.Invoke( null, new object[] { appender } );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/LogCapture.cs b/mcs/nunit24/NUnitCore/core/LogCapture.cs
new file mode 100644
index 00000000000..e0a13bc5c20
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/LogCapture.cs
@@ -0,0 +1,44 @@
+// ****************************************************************
+// Copyright 2008, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System.Collections.Specialized;
+using System.Configuration;
+
+namespace NUnit.Core
+{
+ public abstract class LogCapture : TextCapture
+ {
+ private string defaultThreshold;
+
+ /// <summary>
+ /// The default threshold for log capture
+ /// is read from the config file. If not
+ /// found, we use "Error".
+ /// </summary>
+ public override string DefaultThreshold
+ {
+ get
+ {
+ if (defaultThreshold == null)
+ {
+ defaultThreshold = "Error";
+
+ NameValueCollection settings = (NameValueCollection)
+ ConfigurationSettings.GetConfig("NUnit/TestRunner");
+
+ if (settings != null)
+ {
+ string level = settings["DefaultLogThreshold"];
+ if (level != null)
+ defaultThreshold = level;
+ }
+ }
+
+ return defaultThreshold;
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Makefile b/mcs/nunit24/NUnitCore/core/Makefile
new file mode 100644
index 00000000000..4fba3fec79f
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Makefile
@@ -0,0 +1,27 @@
+thisdir = nunit20/NUnitCore/core
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit.core.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LOCAL_MCS_FLAGS= -debug -r:nunit.framework.dll -r:nunit.core.interfaces.dll -r:System.dll /d:StronglyNamedAssembly
+NO_TEST = yo
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+EXTRA_DISTFILES = nunit.core.dll.csproj nunit.core.dll_VS2005.csproj
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/NUnitCore/core/NTrace.cs b/mcs/nunit24/NUnitCore/core/NTrace.cs
new file mode 100644
index 00000000000..cd90fd01f1f
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NTrace.cs
@@ -0,0 +1,123 @@
+using System;
+using System.Diagnostics;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Summary description for Logger.
+ /// </summary>
+ public class NTrace
+ {
+ private readonly static TraceSwitch Level = new TraceSwitch( "NTrace", "NUnit internal trace" );
+ private readonly static string NL = Environment.NewLine;
+
+ #region Error
+ public static void Error( string message )
+ {
+ if ( Level.TraceError )
+ WriteLine( message );
+ }
+
+ public static void Error( string message, string category )
+ {
+ if ( Level.TraceError )
+ WriteLine( message, category );
+ }
+
+ public static void ErrorFormat( string message, params object[] args )
+ {
+ if ( Level.TraceError )
+ WriteFormat( message, args );
+ }
+
+ public static void Error( string message, Exception ex )
+ {
+ if ( Level.TraceError )
+ {
+ WriteLine( message );
+ WriteLine( ex.ToString() );
+ }
+ }
+ #endregion
+
+ #region Warning
+ public static void Warning( string message )
+ {
+ if ( Level.TraceWarning )
+ WriteLine( message );
+ }
+
+ public static void Warning( string message, string category )
+ {
+ if ( Level.TraceWarning )
+ WriteLine( message, category );
+ }
+
+ public static void WarningFormat( string message, params object[] args )
+ {
+ if ( Level.TraceWarning )
+ WriteFormat( message, args );
+ }
+ #endregion
+
+ #region Info
+ public static void Info( string message )
+ {
+ if ( Level.TraceInfo )
+ WriteLine( message );
+ }
+
+ public static void Info( string message, string category )
+ {
+ if ( Level.TraceInfo )
+ WriteLine( message, category );
+ }
+
+ public static void InfoFormat( string message, params object[] args )
+ {
+ if ( Level.TraceInfo )
+ WriteFormat( message, args );
+ }
+ #endregion
+
+ #region Debug
+ public static void Debug( string message )
+ {
+ if ( Level.TraceVerbose )
+ WriteLine( message );
+ }
+
+ public static void Debug( string message, string category )
+ {
+ if ( Level.TraceVerbose )
+ WriteLine( message, category );
+ }
+
+ public static void DebugFormat( string message, params object[] args )
+ {
+ if ( Level.TraceVerbose )
+ WriteFormat( message, args );
+ }
+ #endregion
+
+ #region Helper Methods
+ private static void WriteLine( string message )
+ {
+ Trace.WriteLine( message );
+ }
+
+ private static void WriteLine( string message, string category )
+ {
+ Trace.WriteLine( message, category );
+ }
+
+ private static void WriteFormat( string format, params object[] args )
+ {
+ string message = string.Format( format, args );
+ Trace.WriteLine( message );
+ }
+ #endregion
+
+ private NTrace() { }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NUnitException.cs b/mcs/nunit24/NUnitCore/core/NUnitException.cs
new file mode 100644
index 00000000000..8d70f96c6d2
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NUnitException.cs
@@ -0,0 +1,50 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Thrown when an assertion failed. Here to preserve the inner
+ /// exception and hence its stack trace.
+ /// </summary>
+ ///
+ [Serializable]
+ public class NUnitException : ApplicationException
+ {
+ public NUnitException () : base()
+ {}
+
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ public NUnitException(string message) : base (message)
+ {}
+
+ /// <summary>
+ /// Standard constructor
+ /// </summary>
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ /// <param name="inner">The exception that caused the
+ /// current exception</param>
+ public NUnitException(string message, Exception inner) :
+ base(message, inner)
+ {}
+
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected NUnitException(SerializationInfo info,
+ StreamingContext context) : base(info,context){}
+
+
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NUnitFramework.cs b/mcs/nunit24/NUnitCore/core/NUnitFramework.cs
new file mode 100644
index 00000000000..9c4dfda5117
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NUnitFramework.cs
@@ -0,0 +1,448 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.Diagnostics;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Static methods that implement aspects of the NUnit framework that cut
+ /// across individual test types, extensions, etc. Some of these use the
+ /// methods of the Reflect class to implement operations specific to the
+ /// NUnit Framework.
+ /// </summary>
+ public class NUnitFramework
+ {
+ private static Type assertType;
+ //private static Hashtable frameworkByAssembly = new Hashtable();
+
+ #region Constants
+
+ #region Attribute Names
+ // NOTE: Attributes used in switch statements must be const
+
+ // Attributes that apply to Assemblies, Classes and Methods
+ public const string IgnoreAttribute = "NUnit.Framework.IgnoreAttribute";
+ public const string PlatformAttribute = "NUnit.Framework.PlatformAttribute";
+ public const string CultureAttribute = "NUnit.Framework.CultureAttribute";
+ public const string ExplicitAttribute = "NUnit.Framework.ExplicitAttribute";
+ public const string CategoryAttribute = "NUnit.Framework.CategoryAttribute";
+ public const string PropertyAttribute = "NUnit.Framework.PropertyAttribute";
+ public const string DescriptionAttribute = "NUnit.Framework.DescriptionAttribute";
+
+ // Attributes that apply only to Classes
+ public const string TestFixtureAttribute = "NUnit.Framework.TestFixtureAttribute";
+ public const string SetUpFixtureAttribute = "NUnit.Framework.SetUpFixtureAttribute";
+
+ // Attributes that apply only to Methods
+ public const string TestAttribute = "NUnit.Framework.TestAttribute";
+ public static readonly string SetUpAttribute = "NUnit.Framework.SetUpAttribute";
+ public static readonly string TearDownAttribute = "NUnit.Framework.TearDownAttribute";
+ public static readonly string FixtureSetUpAttribute = "NUnit.Framework.TestFixtureSetUpAttribute";
+ public static readonly string FixtureTearDownAttribute = "NUnit.Framework.TestFixtureTearDownAttribute";
+ public static readonly string ExpectedExceptionAttribute = "NUnit.Framework.ExpectedExceptionAttribute";
+
+ // Attributes that apply only to Properties
+ public static readonly string SuiteAttribute = "NUnit.Framework.SuiteAttribute";
+ #endregion
+
+ #region Other Framework Types
+ public static readonly string AssertException = "NUnit.Framework.AssertionException";
+ public static readonly string IgnoreException = "NUnit.Framework.IgnoreException";
+ public static readonly string AssertType = "NUnit.Framework.Assert";
+ public static readonly string ExpectExceptionInterface = "NUnit.Framework.IExpectException";
+ #endregion
+
+ #region Core Types
+ public static readonly string SuiteBuilderAttribute = typeof(SuiteBuilderAttribute).FullName;
+ public static readonly string SuiteBuilderInterface = typeof(ISuiteBuilder).FullName;
+
+ public static readonly string TestCaseBuilderAttributeName = typeof(TestCaseBuilderAttribute).FullName;
+ public static readonly string TestCaseBuilderInterfaceName = typeof(ITestCaseBuilder).FullName;
+
+ public static readonly string TestDecoratorAttributeName = typeof(TestDecoratorAttribute).FullName;
+ public static readonly string TestDecoratorInterfaceName = typeof(ITestDecorator).FullName;
+ #endregion
+
+ #endregion
+
+ #region Identify SetUp and TearDown Methods
+ public static bool IsSetUpMethod(MethodInfo method)
+ {
+ return Reflect.HasAttribute(method, NUnitFramework.SetUpAttribute, false);
+ }
+
+ public static bool IsTearDownMethod(MethodInfo method)
+ {
+ return Reflect.HasAttribute(method, NUnitFramework.TearDownAttribute, false);
+ }
+
+ public static bool IsFixtureSetUpMethod(MethodInfo method)
+ {
+ return Reflect.HasAttribute(method, NUnitFramework.FixtureSetUpAttribute, false);
+ }
+
+ public static bool IsFixtureTearDownMethod(MethodInfo method)
+ {
+ return Reflect.HasAttribute(method, NUnitFramework.FixtureTearDownAttribute, false);
+ }
+
+ #endregion
+
+ #region Locate SetUp and TearDown Methods
+ public static MethodInfo GetSetUpMethod(Type fixtureType)
+ {
+ return Reflect.GetMethodWithAttribute(fixtureType, SetUpAttribute,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
+ true);
+ }
+
+ public static MethodInfo GetTearDownMethod(Type fixtureType)
+ {
+ return Reflect.GetMethodWithAttribute(fixtureType, TearDownAttribute,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
+ true);
+ }
+
+ public static MethodInfo GetFixtureSetUpMethod(Type fixtureType)
+ {
+ return Reflect.GetMethodWithAttribute(fixtureType, FixtureSetUpAttribute,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
+ true);
+ }
+
+ public static MethodInfo GetFixtureTearDownMethod(Type fixtureType)
+ {
+ return Reflect.GetMethodWithAttribute(fixtureType, FixtureTearDownAttribute,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance,
+ true);
+ }
+ #endregion
+
+ #region Locate ExceptionHandler
+ public static MethodInfo GetDefaultExceptionHandler( Type fixtureType )
+ {
+ return Reflect.HasInterface( fixtureType, ExpectExceptionInterface )
+ ? GetExceptionHandler( fixtureType, "HandleException" )
+ : null;
+ }
+
+ public static MethodInfo GetExceptionHandler( Type fixtureType, string name )
+ {
+ return Reflect.GetNamedMethod(
+ fixtureType,
+ name,
+ new string[] { "System.Exception" },
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static );
+ }
+ #endregion
+
+ #region Get Special Properties of Attributes
+
+ #region IgnoreReason
+ public static string GetIgnoreReason( System.Attribute attribute )
+ {
+ return Reflect.GetPropertyValue( attribute, "Reason" ) as string;
+ }
+ #endregion
+
+ #region Description
+ /// <summary>
+ /// Method to return the description from an attribute
+ /// </summary>
+ /// <param name="attribute">The attribute to check</param>
+ /// <returns>The description, if any, or null</returns>
+ public static string GetDescription(System.Attribute attribute)
+ {
+ return Reflect.GetPropertyValue( attribute, "Description" ) as string;
+ }
+ #endregion
+
+ #region ExpectedException Attrributes
+ public static string GetHandler(System.Attribute attribute)
+ {
+ return Reflect.GetPropertyValue( attribute, "Handler" ) as string;
+ }
+
+ public static Type GetExceptionType(System.Attribute attribute)
+ {
+ return Reflect.GetPropertyValue( attribute, "ExceptionType" ) as Type;
+ }
+
+ public static string GetExceptionName(System.Attribute attribute)
+ {
+ return Reflect.GetPropertyValue( attribute, "ExceptionName" ) as string;
+ }
+
+ public static string GetExpectedMessage(System.Attribute attribute)
+ {
+ return Reflect.GetPropertyValue( attribute, "ExpectedMessage" ) as string;
+ }
+
+ public static string GetMatchType(System.Attribute attribute)
+ {
+ object matchEnum = Reflect.GetPropertyValue( attribute, "MatchType" );
+ return matchEnum != null ? matchEnum.ToString() : null;
+ }
+
+ public static string GetUserMessage(System.Attribute attribute)
+ {
+ return Reflect.GetPropertyValue( attribute, "UserMessage" ) as string;
+ }
+ #endregion
+
+ #endregion
+
+ #region ApplyCommonAttributes
+ /// <summary>
+ /// Modify a newly constructed test based on a type or method by
+ /// applying any of NUnit's common attributes.
+ /// </summary>
+ /// <param name="member">The type or method from which the test was constructed</param>
+ /// <param name="test">The test to which the attributes apply</param>
+ public static void ApplyCommonAttributes(MemberInfo member, Test test)
+ {
+ ApplyCommonAttributes( Reflect.GetAttributes( member, false ), test );
+ }
+
+ /// <summary>
+ /// Modify a newly constructed test based on an assembly by applying
+ /// any of NUnit's common attributes.
+ /// </summary>
+ /// <param name="assembly">The assembly from which the test was constructed</param>
+ /// <param name="test">The test to which the attributes apply</param>
+ public static void ApplyCommonAttributes(Assembly assembly, Test test)
+ {
+ ApplyCommonAttributes( Reflect.GetAttributes( assembly, false ), test );
+ }
+
+ /// <summary>
+ /// Modify a newly constructed test by applying any of NUnit's common
+ /// attributes, based on an input array of attributes. This method checks
+ /// for all attributes, relying on the fact that specific attributes can only
+ /// occur on those constructs on which they are allowed.
+ /// </summary>
+ /// <param name="attributes">An array of attributes possibly including NUnit attributes
+ /// <param name="test">The test to which the attributes apply</param>
+ public static void ApplyCommonAttributes(Attribute[] attributes, Test test)
+ {
+ IList categories = new ArrayList();
+ ListDictionary properties = new ListDictionary();
+
+ foreach (Attribute attribute in attributes)
+ {
+ Type attributeType = attribute.GetType();
+ string attributeName = attributeType.FullName;
+ bool isValid = test.RunState != RunState.NotRunnable;
+
+ switch (attributeName)
+ {
+ case TestFixtureAttribute:
+ case TestAttribute:
+ if ( test.Description == null )
+ test.Description = GetDescription( attribute );
+ break;
+ case DescriptionAttribute:
+ test.Description = GetDescription( attribute );
+ break;
+ case ExplicitAttribute:
+ if (isValid)
+ {
+ test.RunState = RunState.Explicit;
+ test.IgnoreReason = GetIgnoreReason(attribute);
+ }
+ break;
+ case IgnoreAttribute:
+ if (isValid)
+ {
+ test.RunState = RunState.Ignored;
+ test.IgnoreReason = GetIgnoreReason(attribute);
+ }
+ break;
+ case PlatformAttribute:
+ PlatformHelper pHelper = new PlatformHelper();
+ if (isValid && !pHelper.IsPlatformSupported(attribute))
+ {
+ test.RunState = RunState.Skipped;
+ test.IgnoreReason = GetIgnoreReason(attribute);
+ if ( test.IgnoreReason == null )
+ test.IgnoreReason = pHelper.Reason;
+ }
+ break;
+ case CultureAttribute:
+ CultureDetector cultureDetector = new CultureDetector();
+ if (isValid && !cultureDetector.IsCultureSupported(attribute))
+ {
+ test.RunState = RunState.Skipped;
+ test.IgnoreReason = cultureDetector.Reason;
+ }
+ break;
+ default:
+ if ( Reflect.InheritsFrom( attributeType, CategoryAttribute ) )
+ {
+ categories.Add( Reflect.GetPropertyValue( attribute, "Name" ) );
+ }
+ else if ( Reflect.InheritsFrom( attributeType, PropertyAttribute ) )
+ {
+ string name = (string)Reflect.GetPropertyValue( attribute, "Name" );
+ if ( name != null && name != string.Empty )
+ {
+ object val = Reflect.GetPropertyValue( attribute, "Value" );
+ properties[name] = val;
+ }
+ }
+ break;
+ }
+ }
+
+ test.Categories = categories;
+ test.Properties = properties;
+ }
+ #endregion
+
+ #region ApplyExpectedExceptionAttribute
+ // TODO: Handle this with a separate ExceptionProcessor object
+ public static void ApplyExpectedExceptionAttribute(MethodInfo method, TestMethod testMethod)
+ {
+ Attribute attribute = Reflect.GetAttribute(
+ method, NUnitFramework.ExpectedExceptionAttribute, false );
+
+ if (attribute != null)
+ {
+ testMethod.ExceptionExpected = true;
+
+ Type expectedExceptionType = GetExceptionType( attribute );
+ string expectedExceptionName = GetExceptionName( attribute );
+ if ( expectedExceptionType != null )
+ testMethod.ExpectedExceptionType = expectedExceptionType;
+ else if ( expectedExceptionName != null )
+ testMethod.ExpectedExceptionName = expectedExceptionName;
+
+ testMethod.ExpectedMessage = GetExpectedMessage( attribute );
+ testMethod.MatchType = GetMatchType( attribute );
+ testMethod.UserMessage = GetUserMessage( attribute );
+
+ string handlerName = GetHandler( attribute );
+ if ( handlerName == null )
+ testMethod.ExceptionHandler = GetDefaultExceptionHandler( testMethod.FixtureType );
+ else
+ {
+ MethodInfo handler = GetExceptionHandler( testMethod.FixtureType, handlerName );
+ if ( handler != null )
+ testMethod.ExceptionHandler = handler;
+ else
+ {
+ testMethod.RunState = RunState.NotRunnable;
+ testMethod.IgnoreReason = string.Format(
+ "The specified exception handler {0} was not found", handlerName );
+ }
+ }
+ }
+ }
+ #endregion
+
+ #region GetAssertCount
+ public static int GetAssertCount()
+ {
+ if ( assertType == null )
+ foreach( Assembly assembly in AppDomain.CurrentDomain.GetAssemblies() )
+ if ( assembly.GetName().Name == "nunit.framework" )
+ {
+ assertType = assembly.GetType( AssertType );
+ break;
+ }
+
+ if ( assertType == null )
+ return 0;
+
+ PropertyInfo property = Reflect.GetNamedProperty(
+ assertType,
+ "Counter",
+ BindingFlags.Public | BindingFlags.Static );
+
+ if ( property == null )
+ return 0;
+
+ return (int)property.GetValue( null, new object[0] );
+ }
+ #endregion
+
+ #region IsSuiteBuilder
+ public static bool IsSuiteBuilder( Type type )
+ {
+ return Reflect.HasAttribute( type, SuiteBuilderAttribute, false )
+ && Reflect.HasInterface( type, SuiteBuilderInterface );
+ }
+ #endregion
+
+ #region IsTestCaseBuilder
+ public static bool IsTestCaseBuilder( Type type )
+ {
+ return Reflect.HasAttribute( type, TestCaseBuilderAttributeName, false )
+ && Reflect.HasInterface( type, TestCaseBuilderInterfaceName );
+ }
+ #endregion
+
+ #region IsTestDecorator
+ public static bool IsTestDecorator( Type type )
+ {
+ return Reflect.HasAttribute( type, TestDecoratorAttributeName, false )
+ && Reflect.HasInterface( type, TestDecoratorInterfaceName );
+ }
+ #endregion
+
+ #region AllowOldStyleTests
+ public static bool AllowOldStyleTests
+ {
+ get
+ {
+ try
+ {
+ NameValueCollection settings = (NameValueCollection)
+ ConfigurationSettings.GetConfig("NUnit/TestCaseBuilder");
+ if (settings != null)
+ {
+ string oldStyle = settings["OldStyleTestCases"];
+ if (oldStyle != null)
+ return Boolean.Parse(oldStyle);
+ }
+ }
+ catch( Exception e )
+ {
+ Debug.WriteLine( e );
+ }
+
+ return false;
+ }
+ }
+ #endregion
+
+ #region BuildConfiguration
+ public static string BuildConfiguration
+ {
+ get
+ {
+#if DEBUG
+ if (Environment.Version.Major == 2)
+ return "Debug2005";
+ else
+ return "Debug";
+#else
+ if (Environment.Version.Major == 2)
+ return "Release2005";
+ else
+ return "Release";
+#endif
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NUnitTestFixture.cs b/mcs/nunit24/NUnitCore/core/NUnitTestFixture.cs
new file mode 100644
index 00000000000..cec2a859743
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NUnitTestFixture.cs
@@ -0,0 +1,37 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Class to implement an NUnit test fixture
+ /// </summary>
+ public class NUnitTestFixture : TestFixture
+ {
+ public NUnitTestFixture(Type fixtureType) : base( fixtureType)
+ {
+ this.fixtureSetUp = NUnitFramework.GetFixtureSetUpMethod( fixtureType );
+ this.fixtureTearDown = NUnitFramework.GetFixtureTearDownMethod( fixtureType );
+ }
+
+ protected override void DoOneTimeSetUp(TestResult suiteResult)
+ {
+ base.DoOneTimeSetUp(suiteResult);
+
+ suiteResult.AssertCount = NUnitFramework.GetAssertCount(); ;
+ }
+
+ protected override void DoOneTimeTearDown(TestResult suiteResult)
+ {
+ base.DoOneTimeTearDown(suiteResult);
+
+ suiteResult.AssertCount += NUnitFramework.GetAssertCount();
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NUnitTestMethod.cs b/mcs/nunit24/NUnitCore/core/NUnitTestMethod.cs
new file mode 100644
index 00000000000..477e85aeaca
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NUnitTestMethod.cs
@@ -0,0 +1,58 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Class to implement an NUnit test method
+ /// </summary>
+ public class NUnitTestMethod : TestMethod
+ {
+ #region Constructor
+ public NUnitTestMethod(MethodInfo method) : base(method)
+ {
+ this.setUpMethod = NUnitFramework.GetSetUpMethod(this.FixtureType);
+ this.tearDownMethod = NUnitFramework.GetTearDownMethod(this.FixtureType);
+ }
+ #endregion
+
+ #region TestMethod Overrides
+ /// <summary>
+ /// Run a test returning the result. Overrides TestMethod
+ /// to count assertions.
+ /// </summary>
+ /// <param name="testResult"></param>
+ public override void Run(TestCaseResult testResult)
+ {
+ base.Run(testResult);
+
+ testResult.AssertCount = NUnitFramework.GetAssertCount();
+ }
+
+ /// <summary>
+ /// Determine if an exception is an NUnit AssertionException
+ /// </summary>
+ /// <param name="ex">The exception to be examined</param>
+ /// <returns>True if it's an NUnit AssertionException</returns>
+ protected override bool IsAssertException(Exception ex)
+ {
+ return ex.GetType().FullName == NUnitFramework.AssertException;
+ }
+
+ /// <summary>
+ /// Determine if an exception is an NUnit IgnoreException
+ /// </summary>
+ /// <param name="ex">The exception to be examined</param>
+ /// <returns>True if it's an NUnit IgnoreException</returns>
+ protected override bool IsIgnoreException(Exception ex)
+ {
+ return ex.GetType().FullName == NUnitFramework.IgnoreException;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NamespaceTreeBuilder.cs b/mcs/nunit24/NUnitCore/core/NamespaceTreeBuilder.cs
new file mode 100644
index 00000000000..2e2546c7130
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NamespaceTreeBuilder.cs
@@ -0,0 +1,165 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Collections;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Class that can build a tree of automatic namespace
+ /// suites from a group of fixtures.
+ /// </summary>
+ public class NamespaceTreeBuilder
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// Hashtable of all test suites we have created to represent namespaces.
+ /// Used to locate namespace parent suites for fixtures.
+ /// </summary>
+ Hashtable namespaceSuites = new Hashtable();
+
+ /// <summary>
+ /// The root of the test suite being created by this builder.
+ /// </summary>
+ TestSuite rootSuite;
+
+ #endregion
+
+ #region Constructor
+
+ public NamespaceTreeBuilder( TestSuite rootSuite )
+ {
+ this.rootSuite = rootSuite;
+ }
+
+ #endregion
+
+ #region Properties
+
+ public TestSuite RootSuite
+ {
+ get { return rootSuite; }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public void Add( IList fixtures )
+ {
+ foreach (TestSuite fixture in fixtures)
+ //if (fixture is SetUpFixture)
+ // Add(fixture as SetUpFixture);
+ //else
+ Add( fixture );
+ }
+
+ public void Add( TestSuite fixture )
+ {
+
+ string ns = fixture.TestName.FullName;
+ int index = ns.LastIndexOf( '.' );
+ ns = index > 0 ? ns.Substring( 0, index ) : string.Empty;
+ TestSuite containingSuite = BuildFromNameSpace( ns );
+
+ if (fixture is SetUpFixture)
+ {
+ // The SetUpFixture must replace the namespace suite
+ // in which it is "contained".
+ //
+ // First, add the old suite's children
+ foreach (TestSuite child in containingSuite.Tests)
+ fixture.Add(child);
+
+ // Make the parent of the containing suite point to this
+ // fixture instead
+ // TODO: Get rid of this somehow?
+ TestSuite parent = (TestSuite)containingSuite.Parent;
+ if (parent == null)
+ {
+ fixture.TestName.Name = rootSuite.TestName.Name;
+ rootSuite = fixture;
+ }
+ else
+ {
+ parent.Tests.Remove(containingSuite);
+ parent.Add(fixture);
+ }
+
+ // Update the hashtable
+ namespaceSuites[ns] = fixture;
+ }
+ else
+ containingSuite.Add( fixture );
+ }
+
+ //public void Add( SetUpFixture fixture )
+ //{
+ // string ns = fixture.FullName;
+ // int index = ns.LastIndexOf( '.' );
+ // ns = index > 0 ? ns.Substring( 0, index ) : string.Empty;
+ // TestSuite suite = BuildFromNameSpace( ns );
+
+ // // Make the parent point to this instead
+ // // TODO: Get rid of this somehow?
+ // TestSuite parent = suite.Parent;
+ // if ( parent != null )
+ // {
+ // parent.Tests.Remove( suite );
+ // parent.Add( fixture );
+ // }
+
+ // // Add the old suite's children
+ // foreach( TestSuite child in suite.Tests )
+ // fixture.Add( child );
+
+ // if (parent == null && fixture is SetUpFixture)
+ // {
+ // suite.Tests.Clear();
+ // suite.Add(fixture);
+ // }
+ // // Update the hashtable
+ // namespaceSuites[ns] = fixture;
+ //}
+
+ #endregion
+
+ #region Helper Method
+
+ private TestSuite BuildFromNameSpace( string nameSpace )
+ {
+ if( nameSpace == null || nameSpace == "" ) return rootSuite;
+ TestSuite suite = (TestSuite)namespaceSuites[nameSpace];
+ if(suite!=null) return suite;
+
+ int index = nameSpace.LastIndexOf(".");
+ //string prefix = string.Format( "[{0}]" );
+ if( index == -1 )
+ {
+ suite = new TestSuite( nameSpace );
+ if ( rootSuite == null )
+ rootSuite = suite;
+ else
+ rootSuite.Add(suite);
+ namespaceSuites[nameSpace]=suite;
+ }
+ else
+ {
+ string parentNameSpace = nameSpace.Substring( 0,index );
+ TestSuite parent = BuildFromNameSpace( parentNameSpace );
+ string suiteName = nameSpace.Substring( index+1 );
+ suite = new TestSuite( parentNameSpace, suiteName );
+ parent.Add( suite );
+ namespaceSuites[nameSpace] = suite;
+ }
+
+ return suite;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NoTestFixturesException.cs b/mcs/nunit24/NUnitCore/core/NoTestFixturesException.cs
new file mode 100644
index 00000000000..c8943693f52
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NoTestFixturesException.cs
@@ -0,0 +1,28 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Summary description for NoTestFixtureException.
+ /// </summary>
+ [Serializable]
+ public class NoTestFixturesException : ApplicationException
+ {
+ public NoTestFixturesException() : base () {}
+
+ public NoTestFixturesException(string message) : base(message)
+ {}
+
+ public NoTestFixturesException(string message, Exception inner) : base(message, inner) {}
+
+ protected NoTestFixturesException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {}
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/NotRunnableTestCase.cs b/mcs/nunit24/NUnitCore/core/NotRunnableTestCase.cs
new file mode 100644
index 00000000000..a2c02afaff3
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NotRunnableTestCase.cs
@@ -0,0 +1,50 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Summary description for NotRunnableTestCase.
+ /// </summary>
+ public class NotRunnableTestCase : TestCase
+ {
+ public NotRunnableTestCase(MethodInfo method, string reason) : base(method.DeclaringType.FullName, method.Name)
+ {
+ RunState = RunState.NotRunnable;
+ IgnoreReason = reason;
+ }
+
+ public NotRunnableTestCase(MethodInfo method) : base(method.DeclaringType.FullName, method.Name)
+ {
+ string reason;
+
+ if (method.IsAbstract)
+ reason = "it must not be abstract";
+ else if (method.IsStatic)
+ reason = "it must be an instance method";
+ else if (!method.IsPublic)
+ reason = "it must be a public method";
+ else if (method.GetParameters().Length != 0)
+ reason = "it must not have parameters";
+ else if (!method.ReturnType.Equals(typeof(void)))
+ reason = "it must return void";
+ else
+ reason = "reason not known";
+
+ RunState = RunState.NotRunnable;
+ IgnoreReason = String.Format("Method {0}'s signature is not correct: {1}.", method.Name, reason);
+ }
+
+ public override void Run(TestCaseResult result)
+ {
+ result.Ignore(base.IgnoreReason);
+ }
+ }
+}
+
diff --git a/mcs/nunit24/NUnitCore/core/NullListener.cs b/mcs/nunit24/NUnitCore/core/NullListener.cs
new file mode 100644
index 00000000000..283b06b61f9
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/NullListener.cs
@@ -0,0 +1,41 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Summary description for NullListener.
+ /// </summary>
+ ///
+ [Serializable]
+ public class NullListener : EventListener
+ {
+ public void RunStarted( string name, int testCount ){ }
+
+ public void RunFinished( TestResult result ) { }
+
+ public void RunFinished( Exception exception ) { }
+
+ public void TestStarted(TestName testName){}
+
+ public void TestFinished(TestCaseResult result){}
+
+ public void SuiteStarted(TestName testName){}
+
+ public void SuiteFinished(TestSuiteResult result){}
+
+ public void UnhandledException( Exception exception ) {}
+
+ public void TestOutput(TestOutput testOutput) {}
+
+ public static EventListener NULL
+ {
+ get { return new NullListener();}
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/PlatformHelper.cs b/mcs/nunit24/NUnitCore/core/PlatformHelper.cs
new file mode 100644
index 00000000000..ccf048e3d50
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/PlatformHelper.cs
@@ -0,0 +1,244 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ public class PlatformHelper
+ {
+ private OperatingSystem os;
+ private RuntimeFramework rt;
+
+ // Set whenever we fail to support a list of platforms
+ private string reason = string.Empty;
+
+ // Defined here and used in tests. We can't use PlatformID.Unix
+ // if we are building on .NET 1.0 or 1.1 and the values are different on Mono
+ public static readonly PlatformID UnixPlatformID_Microsoft = (PlatformID) 4;
+ public static readonly PlatformID UnixPlatformID_Mono = (PlatformID)128;
+
+ /// <summary>
+ /// Comma-delimited list of all supported OS platform constants
+ /// </summary>
+ public static readonly string OSPlatforms =
+ "Win,Win32,Win32S,Win32NT,Win32Windows,WinCE,Win95,Win98,WinMe,NT3,NT4,NT5,NT6,Win2K,WinXP,Win2003Server,Vista,Win2008Server,Unix,Linux";
+
+ /// <summary>
+ /// Comma-delimited list of all supported Runtime platform constants
+ /// </summary>
+ public static readonly string RuntimePlatforms =
+ "Net,NetCF,SSCLI,Rotor,Mono";
+
+ /// <summary>
+ /// Default constructor uses the operating system and
+ /// common language runtime of the system.
+ /// </summary>
+ public PlatformHelper()
+ {
+ this.os = Environment.OSVersion;
+ this.rt = RuntimeFramework.CurrentFramework;
+ }
+
+ /// <summary>
+ /// Contruct a PlatformHelper for a particular operating
+ /// system and common language runtime. Used in testing.
+ /// </summary>
+ /// <param name="os">OperatingSystem to be used</param>
+ public PlatformHelper( OperatingSystem os, RuntimeFramework rt )
+ {
+ this.os = os;
+ this.rt = rt;
+ }
+
+ /// <summary>
+ /// Test to determine if one of a collection of platforms
+ /// is being used currently.
+ /// </summary>
+ /// <param name="platforms"></param>
+ /// <returns></returns>
+ public bool IsPlatformSupported( string[] platforms )
+ {
+ foreach( string platform in platforms )
+ if ( IsPlatformSupported( platform ) )
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Tests to determine if the current platform is supported
+ /// based on a platform attribute.
+ /// </summary>
+ /// <param name="platformAttribute">The attribute to examine</param>
+ /// <returns></returns>
+ public bool IsPlatformSupported( Attribute platformAttribute )
+ {
+ //Use reflection to avoid dependency on a particular framework version
+ string include = (string)Reflect.GetPropertyValue(
+ platformAttribute, "Include",
+ BindingFlags.Public | BindingFlags.Instance );
+
+ string exclude = (string)Reflect.GetPropertyValue(
+ platformAttribute, "Exclude",
+ BindingFlags.Public | BindingFlags.Instance );
+
+ try
+ {
+ if (include != null && !IsPlatformSupported(include))
+ {
+ reason = string.Format("Only supported on {0}", include);
+ return false;
+ }
+
+ if (exclude != null && IsPlatformSupported(exclude))
+ {
+ reason = string.Format("Not supported on {0}", exclude);
+ return false;
+ }
+ }
+ catch( ArgumentException ex )
+ {
+ reason = string.Format( "Invalid platform name: {0}", ex.ParamName );
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Test to determine if the a particular platform or comma-
+ /// delimited set of platforms is in use.
+ /// </summary>
+ /// <param name="platform">Name of the platform or comma-separated list of platform names</param>
+ /// <returns>True if the platform is in use on the system</returns>
+ public bool IsPlatformSupported( string platform )
+ {
+ if ( platform.IndexOf( ',' ) >= 0 )
+ return IsPlatformSupported( platform.Split( new char[] { ',' } ) );
+
+ string platformName = platform.Trim();
+ bool nameOK = false;
+
+ string versionSpecification = null;
+
+ string[] parts = platformName.Split( new char[] { '-' } );
+ if ( parts.Length == 2 )
+ {
+ platformName = parts[0];
+ versionSpecification = parts[1];
+ }
+
+ switch( platformName.ToUpper() )
+ {
+ case "WIN":
+ case "WIN32":
+ nameOK = os.Platform.ToString().StartsWith( "Win" );
+ break;
+ case "WIN32S":
+ nameOK = os.Platform == PlatformID.Win32S;
+ break;
+ case "WIN32WINDOWS":
+ nameOK = os.Platform == PlatformID.Win32Windows;
+ break;
+ case "WIN32NT":
+ nameOK = os.Platform == PlatformID.Win32NT;
+ break;
+ case "WINCE":
+ nameOK = (int)os.Platform == 3; // Not defined in .NET 1.0
+ break;
+ case "WIN95":
+ nameOK = os.Platform == PlatformID.Win32Windows && os.Version.Major == 4 && os.Version.Minor == 0;
+ break;
+ case "WIN98":
+ nameOK = os.Platform == PlatformID.Win32Windows && os.Version.Major == 4 && os.Version.Minor == 10;
+ break;
+ case "WINME":
+ nameOK = os.Platform == PlatformID.Win32Windows && os.Version.Major == 4 && os.Version.Minor == 90;
+ break;
+ case "NT3":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 3;
+ break;
+ case "NT4":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 4;
+ break;
+ case "NT5":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 5;
+ break;
+ case "WIN2K":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 5 && os.Version.Minor == 0;
+ break;
+ case "WINXP":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 5 && os.Version.Minor == 1;
+ break;
+ case "WIN2003SERVER":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 5 && os.Version.Minor == 2;
+ break;
+ case "NT6":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 6;
+ break;
+ // TODO: Distinguish Vista SP1 from Server 2008
+ case "VISTA":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 6 && os.Version.Minor == 0 && os.Version.Build != 6001;
+ break;
+ case "WIN2008SERVER":
+ nameOK = os.Platform == PlatformID.Win32NT && os.Version.Major == 6 && os.Version.Minor == 0 && os.Version.Build == 6001;
+ break;
+ case "UNIX":
+ case "LINUX":
+ nameOK = os.Platform == UnixPlatformID_Microsoft
+ || os.Platform == UnixPlatformID_Mono;
+ break;
+ case "NET":
+ nameOK = rt.Runtime == RuntimeType.Net;
+ break;
+ case "NETCF":
+ nameOK = rt.Runtime == RuntimeType.NetCF;
+ break;
+ case "SSCLI":
+ case "ROTOR":
+ nameOK = rt.Runtime == RuntimeType.SSCLI;
+ break;
+ case "MONO":
+ nameOK = rt.Runtime == RuntimeType.Mono;
+ // Special handling because Mono 1.0 profile has version 1.1
+ if ( versionSpecification == "1.0" )
+ versionSpecification = "1.1";
+ break;
+ default:
+ throw new ArgumentException( "Invalid platform name", platform.ToString() );
+ }
+
+ if ( nameOK )
+ {
+ if ( versionSpecification == null )
+ return true;
+
+ Version version = new Version( versionSpecification );
+
+ if ( rt.Version.Major == version.Major &&
+ rt.Version.Minor == version.Minor &&
+ ( version.Build == -1 || rt.Version.Build == version.Build ) &&
+ ( version.Revision == -1 || rt.Version.Revision == version.Revision ) )
+ return true;
+ }
+
+ this.reason = "Only supported on " + platform;
+ return false;
+ }
+
+ /// <summary>
+ /// Return the last failure reason. Results are not
+ /// defined if called before IsSupported( Attribute )
+ /// is called.
+ /// </summary>
+ public string Reason
+ {
+ get { return reason; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/ProxyTestRunner.cs b/mcs/nunit24/NUnitCore/core/ProxyTestRunner.cs
new file mode 100644
index 00000000000..e171aa61f63
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/ProxyTestRunner.cs
@@ -0,0 +1,174 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+namespace NUnit.Core
+{
+ using System;
+ using System.Collections;
+ using System.IO;
+
+ /// <summary>
+ /// DelegatingTestRUnner is the abstract base for core TestRunner
+ /// implementations that operate by controlling a downstream
+ /// TestRunner. All calls are simply passed on to the
+ /// TestRunner that is provided to the constructor.
+ ///
+ /// Although the class is abstract, it has no abstract
+ /// methods specified because each implementation will
+ /// need to override different methods. All methods are
+ /// specified using interface syntax and the derived class
+ /// must explicitly implement TestRunner in order to
+ /// redefine the selected methods.
+ /// </summary>
+ public abstract class ProxyTestRunner : MarshalByRefObject, TestRunner
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// Our runner ID
+ /// </summary>
+ protected int runnerID;
+
+ /// <summary>
+ /// The downstream TestRunner
+ /// </summary>
+ private TestRunner testRunner;
+
+ /// <summary>
+ /// The event listener for the currently running test
+ /// </summary>
+ protected EventListener listener;
+
+ #endregion
+
+ #region Construction
+ public ProxyTestRunner(TestRunner testRunner)
+ {
+ this.testRunner = testRunner;
+ this.runnerID = testRunner.ID;
+ }
+
+ /// <summary>
+ /// Protected constructor for runners that delay creation
+ /// of their downstream runner.
+ /// </summary>
+ protected ProxyTestRunner( int runnerID )
+ {
+ this.runnerID = runnerID;
+ }
+ #endregion
+
+ #region Properties
+ public virtual int ID
+ {
+ get { return runnerID; }
+ }
+
+ public virtual bool Running
+ {
+ get { return testRunner != null && testRunner.Running; }
+ }
+
+ public virtual IList AssemblyInfo
+ {
+ get { return testRunner == null ? null : testRunner.AssemblyInfo; }
+ }
+
+ public virtual ITest Test
+ {
+ get { return testRunner == null ? null : testRunner.Test; }
+ }
+
+ public virtual TestResult TestResult
+ {
+ get { return testRunner == null ? null : testRunner.TestResult; }
+ }
+
+ /// <summary>
+ /// Protected property copies any settings to the downstream test runner
+ /// when it is set. Derived runners overriding this should call the base
+ /// or copy the settings themselves.
+ /// </summary>
+ protected virtual TestRunner TestRunner
+ {
+ get { return testRunner; }
+ set { testRunner = value; }
+ }
+ #endregion
+
+ #region Load and Unload Methods
+ public virtual bool Load( TestPackage package )
+ {
+ return this.testRunner.Load( package );
+ }
+
+ public virtual void Unload()
+ {
+ if ( this.testRunner != null )
+ this.testRunner.Unload();
+ }
+ #endregion
+
+ #region CountTestCases
+ public virtual int CountTestCases( ITestFilter filter )
+ {
+ return this.testRunner.CountTestCases( filter );
+ }
+ #endregion
+
+ #region Methods for Running Tests
+ public virtual TestResult Run(EventListener listener)
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ return this.testRunner.Run(listener);
+ }
+
+ public virtual TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ return this.testRunner.Run(listener, filter);
+ }
+
+ public virtual void BeginRun( EventListener listener )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ this.testRunner.BeginRun( listener );
+ }
+
+ public virtual void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ // Save active listener for derived classes
+ this.listener = listener;
+ this.testRunner.BeginRun( listener, filter );
+ }
+
+ public virtual TestResult EndRun()
+ {
+ return this.testRunner.EndRun();
+ }
+
+ public virtual void CancelRun()
+ {
+ this.testRunner.CancelRun();
+ }
+
+ public virtual void Wait()
+ {
+ this.testRunner.Wait();
+ }
+ #endregion
+
+ #region InitializeLifetimeService Override
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ #endregion
+
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/QueuingEventListener.cs b/mcs/nunit24/NUnitCore/core/QueuingEventListener.cs
new file mode 100644
index 00000000000..eef442e6bbe
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/QueuingEventListener.cs
@@ -0,0 +1,110 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// QueuingEventListener uses an EventQueue to store any
+ /// events received on its EventListener interface.
+ /// </summary>
+ public class QueuingEventListener : EventListener
+ {
+ private EventQueue events = new EventQueue();
+
+ /// <summary>
+ /// The EvenQueue created and filled by this listener
+ /// </summary>
+ public EventQueue Events
+ {
+ get { return events; }
+ }
+
+ #region EventListener Methods
+ /// <summary>
+ /// Run is starting
+ /// </summary>
+ /// <param name="tests">Array of tests to be run</param>
+ public void RunStarted( string name, int testCount )
+ {
+ events.Enqueue( new RunStartedEvent( name, testCount ) );
+ }
+
+ /// <summary>
+ /// Run finished successfully
+ /// </summary>
+ /// <param name="results">Array of test results</param>
+ public void RunFinished( TestResult result )
+ {
+ events.Enqueue( new RunFinishedEvent( result ) );
+ }
+
+ /// <summary>
+ /// Run was terminated due to an exception
+ /// </summary>
+ /// <param name="exception">Exception that was thrown</param>
+ public void RunFinished( Exception exception )
+ {
+ events.Enqueue( new RunFinishedEvent( exception ) );
+ }
+
+ /// <summary>
+ /// A single test case is starting
+ /// </summary>
+ /// <param name="testCase">The test case</param>
+ public void TestStarted(TestName testName)
+ {
+ events.Enqueue( new TestStartedEvent( testName ) );
+ }
+
+ /// <summary>
+ /// A test case finished
+ /// </summary>
+ /// <param name="result">Result of the test case</param>
+ public void TestFinished(TestCaseResult result)
+ {
+ events.Enqueue( new TestFinishedEvent( result ) );
+ }
+
+ /// <summary>
+ /// A suite is starting
+ /// </summary>
+ /// <param name="suite">The suite that is starting</param>
+ public void SuiteStarted(TestName testName)
+ {
+ events.Enqueue( new SuiteStartedEvent( testName ) );
+ }
+
+ /// <summary>
+ /// A suite finished
+ /// </summary>
+ /// <param name="result">Result of the suite</param>
+ public void SuiteFinished(TestSuiteResult result)
+ {
+ events.Enqueue( new SuiteFinishedEvent( result ) );
+ }
+
+ /// <summary>
+ /// An unhandled exception occured while running a test,
+ /// but the test was not terminated.
+ /// </summary>
+ /// <param name="exception"></param>
+ public void UnhandledException( Exception exception )
+ {
+ events.Enqueue( new UnhandledExceptionEvent( exception ) );
+ }
+
+ /// <summary>
+ /// A message has been output to the console.
+ /// </summary>
+ /// <param name="testOutput">A console message</param>
+ public void TestOutput( TestOutput output )
+ {
+ events.Enqueue( new OutputEvent( output ) );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Reflect.cs b/mcs/nunit24/NUnitCore/core/Reflect.cs
new file mode 100644
index 00000000000..38a49ebd401
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Reflect.cs
@@ -0,0 +1,430 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+using System.Collections;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Helper methods for inspecting a type by reflection.
+ ///
+ /// Many of these methods take a MemberInfo as an argument to avoid
+ /// duplication, even though certain attributes can only appear on
+ /// specific types of members, like MethodInfo or Type.
+ ///
+ /// In the case where a type is being examined for the presence of
+ /// an attribute, interface or named member, the Reflect methods
+ /// operate with the full name of the member being sought. This
+ /// removes the necessity of the caller having a reference to the
+ /// assembly that defines the item being sought and allows the
+ /// NUnit core to inspect assemblies that reference an older
+ /// version of the NUnit framework.
+ /// </summary>
+ public class Reflect
+ {
+ #region Attributes
+
+ /// <summary>
+ /// Check presence of attribute of a given type on a member.
+ /// </summary>
+ /// <param name="member">The member to examine</param>
+ /// <param name="attrName">The FullName of the attribute type to look for</param>
+ /// <param name="inherit">True to include inherited attributes</param>
+ /// <returns>True if the attribute is present</returns>
+ public static bool HasAttribute( MemberInfo member, string attrName, bool inherit )
+ {
+ object[] attributes = member.GetCustomAttributes( inherit );
+ foreach( Attribute attribute in attributes )
+ if ( IsInstanceOfType( attrName, attribute ) )
+ return true;
+ return false;
+ }
+
+ /// <summary>
+ /// Get attribute of a given type on a member. If multiple attributes
+ /// of a type are present, the first one found is returned.
+ /// </summary>
+ /// <param name="member">The member to examine</param>
+ /// <param name="attrName">The FullName of the attribute type to look for</param>
+ /// <param name="inherit">True to include inherited attributes</param>
+ /// <returns>The attribute or null</returns>
+ public static System.Attribute GetAttribute(MemberInfo member, string attrName, bool inherit)
+ {
+ object[] attributes = member.GetCustomAttributes(inherit);
+ foreach (Attribute attribute in attributes)
+ if ( IsInstanceOfType( attrName, attribute ) )
+ return attribute;
+ return null;
+ }
+
+ /// <summary>
+ /// Get attribute of a given type on an assembly. If multiple attributes
+ /// of a type are present, the first one found is returned.
+ /// </summary>
+ /// <param name="assembly">The assembly to examine</param>
+ /// <param name="attrName">The FullName of the attribute type to look for</param>
+ /// <param name="inherit">True to include inherited attributes</param>
+ /// <returns>The attribute or null</returns>
+ public static System.Attribute GetAttribute(Assembly assembly, string attrName, bool inherit)
+ {
+ object[] attributes = assembly.GetCustomAttributes(inherit);
+ foreach (Attribute attribute in attributes)
+ if ( IsInstanceOfType(attrName, attribute) )
+ return attribute;
+ return null;
+ }
+
+ /// <summary>
+ /// Get all attributes of a given type on a member.
+ /// </summary>
+ /// <param name="member">The member to examine</param>
+ /// <param name="attrName">The FullName of the attribute type to look for</param>
+ /// <param name="inherit">True to include inherited attributes</param>
+ /// <returns>The attribute or null</returns>
+ public static System.Attribute[] GetAttributes( MemberInfo member, string attrName, bool inherit )
+ {
+ object[] attributes = member.GetCustomAttributes( inherit );
+ ArrayList result = new ArrayList();
+ foreach( Attribute attribute in attributes )
+ if ( IsInstanceOfType( attrName, attribute ) )
+ result.Add( attribute );
+ return (System.Attribute[])result.ToArray( typeof( System.Attribute ) );
+ }
+
+ /// <summary>
+ /// Get all attributes on a member.
+ /// </summary>
+ /// <param name="member">The member to examine</param>
+ /// <param name="inherit">True to include inherited attributes</param>
+ /// <returns>The attribute or null</returns>
+ public static System.Attribute[] GetAttributes(MemberInfo member, bool inherit)
+ {
+ object[] attributes = member.GetCustomAttributes(inherit);
+ System.Attribute[] result = new System.Attribute[attributes.Length];
+ int n = 0;
+ foreach (Attribute attribute in attributes)
+ result[n++] = attribute;
+ return result;
+ }
+
+ /// <summary>
+ /// Get all attributes on an assembly.
+ /// </summary>
+ /// <param name="assembly">The assembly to examine</param>
+ /// <param name="inherit">True to include inherited attributes</param>
+ /// <returns>The attributes or null</returns>
+ public static System.Attribute[] GetAttributes(Assembly assembly, bool inherit)
+ {
+ object[] attributes = assembly.GetCustomAttributes(inherit);
+ System.Attribute[] result = new System.Attribute[attributes.Length];
+ int n = 0;
+ foreach (Attribute attribute in attributes)
+ result[n++] = attribute;
+ return result;
+ }
+
+ #endregion
+
+ #region Interfaces
+
+ /// <summary>
+ /// Check to see if a type implements a named interface.
+ /// </summary>
+ /// <param name="fixtureType">The type to examine</param>
+ /// <param name="interfaceName">The FullName of the interface to check for</param>
+ /// <returns>True if the interface is implemented by the type</returns>
+ public static bool HasInterface( Type fixtureType, string interfaceName )
+ {
+ foreach( Type type in fixtureType.GetInterfaces() )
+ if ( type.FullName == interfaceName )
+ return true;
+ return false;
+ }
+
+ #endregion
+
+ #region Inheritance
+ //SHMARYA: [ 10/12/2005 ]
+ /// <summary>
+ /// Checks to see if a type inherits from a named type.
+ /// </summary>
+ /// <param name="type">The type to examine</param>
+ /// <param name="parentType">The FullName of the inherited type to look for</param>
+ /// <returns>True if the type inherits from the named type.</returns>
+ public static bool InheritsFrom( Type type, string typeName )
+ {
+ for( Type current = type; current != typeof( object ); current = current.BaseType )
+ if( current.FullName == typeName )
+ return true;
+
+ return false;
+ }
+
+ public static bool InheritsFrom( object obj, string typeName )
+ {
+ return InheritsFrom( obj.GetType(), typeName );
+ }
+
+ public static bool IsInstanceOfType( string typeName, Attribute attr )
+ {
+ Type type = attr.GetType();
+ return type.FullName == typeName || InheritsFrom( type, typeName );
+ }
+ #endregion
+
+ #region Get Methods of a type
+
+ /// <summary>
+ /// Find the default constructor on a type
+ /// </summary>
+ /// <param name="fixtureType"></param>
+ /// <returns></returns>
+ public static ConstructorInfo GetConstructor( Type fixtureType )
+ {
+ return fixtureType.GetConstructor( Type.EmptyTypes );
+ }
+
+ /// <summary>
+ /// Find the default constructor on a type
+ /// </summary>
+ /// <param name="fixtureType"></param>
+ /// <returns></returns>
+ public static ConstructorInfo GetConstructor( Type fixtureType, Type[] types )
+ {
+ return fixtureType.GetConstructor( types );
+ }
+
+ /// <summary>
+ /// Examine a fixture type and return a method having a particular attribute.
+ /// In the case of multiple methods, the first one found is returned.
+ /// </summary>
+ /// <param name="fixtureType">The type to examine</param>
+ /// <param name="attributeName">The FullName of the attribute to look for</param>
+ /// <param name="bindingFlags">BindingFlags to use in looking for method</param>
+ /// <returns>A MethodInfo or null</returns>
+ public static MethodInfo GetMethodWithAttribute( Type fixtureType, string attributeName, BindingFlags bindingFlags, bool inherit )
+ {
+ foreach(MethodInfo method in fixtureType.GetMethods( bindingFlags ) )
+ {
+ if( HasAttribute( method, attributeName, inherit ) )
+ return method;
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Examine a fixture type and return a count of the methods having a
+ /// particular attribute.
+ /// </summary>
+ /// <param name="fixtureType">The type to examine</param>
+ /// <param name="attributeName">The FullName of the attribute to look for</param>
+ /// <param name="bindingFlags">BindingFlags to use in looking for method</param>
+ /// <returns>The number of such methods found</returns>
+ public static int CountMethodsWithAttribute( Type fixtureType, string attributeName, BindingFlags bindingFlags, bool inherit )
+ {
+ int count = 0;
+
+ foreach(MethodInfo method in fixtureType.GetMethods( bindingFlags ) )
+ {
+ if( HasAttribute( method, attributeName, inherit ) )
+ count++;
+ }
+
+ return count;
+ }
+
+ /// <summary>
+ /// Examine a fixture type and get a method with a particular name.
+ /// In the case of overloads, the first one found is returned.
+ /// </summary>
+ /// <param name="fixtureType">The type to examine</param>
+ /// <param name="methodName">The name of the method</param>
+ /// <param name="bindingFlags">BindingFlags to use in the search</param>
+ /// <returns>A MethodInfo or null</returns>
+ public static MethodInfo GetNamedMethod(Type fixtureType, string methodName, BindingFlags bindingFlags)
+ {
+ foreach (MethodInfo method in fixtureType.GetMethods(bindingFlags))
+ {
+ if (method.Name == methodName)
+ return method;
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Examine a fixture type and get a method with a particular name and list
+ /// of arguments. In the case of overloads, the first one found is returned.
+ /// </summary>
+ /// <param name="fixtureType">The type to examine</param>
+ /// <param name="methodName">The name of the method</param>
+ /// <param name="argTypes">The full names of the argument types to search for</param>
+ /// <param name="bindingFlags">BindingFlags to use in the search</param>
+ /// <returns>A MethodInfo or null</returns>
+ public static MethodInfo GetNamedMethod(Type fixtureType, string methodName,
+ string[] argTypes, BindingFlags bindingFlags)
+ {
+ foreach (MethodInfo method in fixtureType.GetMethods(bindingFlags))
+ {
+ if (method.Name == methodName)
+ {
+ ParameterInfo[] parameters = method.GetParameters();
+ if (parameters.Length == argTypes.Length)
+ {
+ bool match = true;
+ for (int i = 0; i < argTypes.Length; i++)
+ if (parameters[i].ParameterType.FullName != argTypes[i])
+ {
+ match = false;
+ break;
+ }
+
+ if (match)
+ return method;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ #endregion
+
+ #region Get Properties of a type
+
+ /// <summary>
+ /// Examine a type and return a property having a particular attribute.
+ /// In the case of multiple methods, the first one found is returned.
+ /// </summary>
+ /// <param name="fixtureType">The type to examine</param>
+ /// <param name="attributeName">The FullName of the attribute to look for</param>
+ /// <param name="bindingFlags">Binding flags to use in searching</param>
+ /// <returns>A PropertyInfo or null</returns>
+ public static PropertyInfo GetPropertyWithAttribute( Type fixtureType, string attributeName, BindingFlags bindingFlags )
+ {
+ foreach(PropertyInfo property in fixtureType.GetProperties( bindingFlags ) )
+ {
+ if( HasAttribute( property, attributeName, true ) )
+ return property;
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Examine a type and get a property with a particular name.
+ /// In the case of overloads, the first one found is returned.
+ /// </summary>
+ /// <param name="type">The type to examine</param>
+ /// <param name="bindingFlags">BindingFlags to use</param>
+ /// <returns>A PropertyInfo or null</returns>
+ public static PropertyInfo GetNamedProperty( Type type, string name, BindingFlags bindingFlags )
+ {
+ return type.GetProperty( name, bindingFlags );
+ }
+
+ /// <summary>
+ /// Get the value of a named property on an object using binding flags of Public and Instance
+ /// </summary>
+ /// <param name="obj">The object for which the property value is needed</param>
+ /// <param name="name">The name of a non-indexed property of the object</param>
+ /// <returns></returns>
+ public static object GetPropertyValue( object obj, string name )
+ {
+ return GetPropertyValue( obj, name, BindingFlags.Public | BindingFlags.Instance );
+ }
+
+ /// <summary>
+ /// Get the value of a named property on an object
+ /// </summary>
+ /// <param name="obj">The object for which the property value is needed</param>
+ /// <param name="name">The name of a non-indexed property of the object</param>
+ /// <param name="bindingFlags">BindingFlags for use in determining which properties are needed</param>param>
+ /// <returns></returns>
+ public static object GetPropertyValue( object obj, string name, BindingFlags bindingFlags )
+ {
+ PropertyInfo property = GetNamedProperty( obj.GetType(), name, bindingFlags );
+ if ( property != null )
+ return property.GetValue( obj, null );
+ return null;
+ }
+
+ /// <summary>
+ /// Set the value of a named property on an object
+ /// </summary>
+ /// <param name="obj">The object for which the property value is to be set</param>
+ /// <param name="name">The name of a non-indexed property of the object</param>
+ /// <param name="val">The value to which the property is to be set</param>
+ /// <param name="bindingFlags">BindingFlags for use in determining which properties are needed</param>param>
+ public static void SetPropertyValue( object obj, string name, object val, BindingFlags bindingFlags )
+ {
+ PropertyInfo property = GetNamedProperty( obj.GetType(), name, bindingFlags );
+ if ( property != null )
+ property.SetValue( obj, val, null );
+ }
+
+ #endregion
+
+ #region Invoke Methods
+
+ /// <summary>
+ /// Invoke the default constructor on a type
+ /// </summary>
+ /// <param name="type">The type to be constructed</param>
+ /// <returns>An instance of the type</returns>
+ public static object Construct( Type type )
+ {
+ ConstructorInfo ctor = GetConstructor( type );
+ if ( ctor == null )
+ throw new InvalidTestFixtureException(type.FullName + " does not have a valid constructor");
+
+ return ctor.Invoke( Type.EmptyTypes );
+ }
+
+ /// <summary>
+ /// Invoke a parameterless method returning void on an object.
+ /// </summary>
+ /// <param name="method">A MethodInfo for the method to be invoked</param>
+ /// <param name="fixture">The object on which to invoke the method</param>
+ public static void InvokeMethod( MethodInfo method, object fixture )
+ {
+ InvokeMethod( method, fixture, null );
+ }
+
+ /// <summary>
+ /// Invoke a method returning void, converting any TargetInvocationException
+ /// to an NUnitException
+ /// </summary>
+ /// <param name="method">A MethodInfo for the method to be invoked</param>
+ /// <param name="fixture">The object on which to invoke the method</param>
+ public static void InvokeMethod( MethodInfo method, object fixture, params object[] args )
+ {
+ if(method != null)
+ {
+ try
+ {
+ method.Invoke( fixture, args );
+ }
+ catch(TargetInvocationException e)
+ {
+ Exception inner = e.InnerException;
+ throw new NUnitException("Rethrown",inner);
+ }
+ }
+ }
+
+ #endregion
+
+ #region Private Constructor for static-only class
+
+ private Reflect() { }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/RemoteTestRunner.cs b/mcs/nunit24/NUnitCore/core/RemoteTestRunner.cs
new file mode 100644
index 00000000000..b4a69c5bec1
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/RemoteTestRunner.cs
@@ -0,0 +1,97 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System.Collections;
+ using System;
+
+ /// <summary>
+ /// RemoteTestRunner is tailored for use as the initial runner to
+ /// receive control in a remote domain. It provides isolation for the return
+ /// value by using a ThreadedTestRunner and for the events through use of
+ /// an EventPump.
+ /// </summary>
+ public class RemoteTestRunner : ProxyTestRunner
+ {
+ #region Constructors
+ public RemoteTestRunner() : this( 0 ) { }
+
+ public RemoteTestRunner( int runnerID ) : base( runnerID ) { }
+ #endregion
+
+ #region Method Overrides
+ public override bool Load(TestPackage package)
+ {
+ NTrace.Info( "Loading test package " + package.Name );
+
+ // Initialize ExtensionHost if not already done
+ if ( !CoreExtensions.Host.Initialized )
+ CoreExtensions.Host.InitializeService();
+
+ // Delayed creation of downstream runner allows us to
+ // use a different runner type based on the package
+ bool useThreadedRunner = package.GetSetting( "UseThreadedRunner", true );
+
+ TestRunner runner = new SimpleTestRunner( this.runnerID );
+ if ( useThreadedRunner )
+ runner = new ThreadedTestRunner( runner );
+
+ this.TestRunner = runner;
+
+ return base.Load (package);
+ }
+
+ public override TestResult Run( EventListener listener )
+ {
+ return Run( listener, TestFilter.Empty );
+ }
+
+ public override TestResult Run( EventListener listener, ITestFilter filter )
+ {
+ NTrace.Debug( "Running test synchronously" );
+ QueuingEventListener queue = new QueuingEventListener();
+
+ StartTextCapture( queue );
+
+ using( EventPump pump = new EventPump( listener, queue.Events, true ) )
+ {
+ pump.Start();
+ return base.Run( queue, filter );
+ }
+ }
+
+ public override void BeginRun( EventListener listener )
+ {
+ BeginRun( listener, TestFilter.Empty );
+ }
+
+ public override void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ NTrace.Debug( "Running test asynchronously" );
+ QueuingEventListener queue = new QueuingEventListener();
+
+ StartTextCapture( queue );
+
+ EventPump pump = new EventPump( listener, queue.Events, true);
+ pump.Start(); // Will run till RunFinished is received
+ // TODO: Make sure the thread is cleaned up if we abort the run
+
+ base.BeginRun( queue, filter );
+ }
+
+ private void StartTextCapture( EventListener queue )
+ {
+ TestContext.Out = new EventListenerTextWriter( queue, TestOutputType.Out );
+ TestContext.Error = new EventListenerTextWriter( queue, TestOutputType.Error );
+ TestContext.TraceWriter = new EventListenerTextWriter( queue, TestOutputType.Trace );
+ TestContext.Tracing = true;
+ TestContext.LogWriter = new EventListenerTextWriter( queue, TestOutputType.Log );
+ TestContext.Logging = true;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/Results.xsd b/mcs/nunit24/NUnitCore/core/Results.xsd
new file mode 100644
index 00000000000..c1697e3b75d
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Results.xsd
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+ <xs:complexType name="failureType">
+ <xs:sequence>
+ <xs:element ref="message" />
+ <xs:element ref="stack-trace" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="reasonType">
+ <xs:sequence>
+ <xs:element ref="message" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="message" type="xs:string" />
+ <xs:complexType name="resultsType">
+ <xs:choice>
+ <xs:element name="test-suite" type="test-suiteType" maxOccurs="unbounded" />
+ <xs:element name="test-case" type="test-caseType" maxOccurs="unbounded" minOccurs="0" />
+ </xs:choice>
+ </xs:complexType>
+ <xs:element name="stack-trace" type="xs:string" />
+ <xs:element name="test-results" type="resultType" />
+ <xs:complexType name="categoriesType">
+ <xs:sequence>
+ <xs:element name="category" type="categoryType" maxOccurs="unbounded" minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="categoryType">
+ <xs:attribute name="name" type="xs:string" use="required" />
+ </xs:complexType>
+ <xs:complexType name="propertiesType">
+ <xs:sequence>
+ <xs:element name="property" type="propertyType" maxOccurs="unbounded" minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="propertyType">
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="value" type="xs:string" use="required" />
+ </xs:complexType>
+ <xs:complexType name="environmentType">
+ <xs:attribute name="nunit-version" type="xs:string" use="required" />
+ <xs:attribute name="clr-version" type="xs:string" use="required" />
+ <xs:attribute name="os-version" type="xs:string" use="required" />
+ <xs:attribute name="platform" type="xs:string" use="required" />
+ <xs:attribute name="cwd" type="xs:string" use="required" />
+ <xs:attribute name="machine-name" type="xs:string" use="required" />
+ <xs:attribute name="user" type="xs:string" use="required" />
+ <xs:attribute name="user-domain" type="xs:string" use="required" />
+ </xs:complexType>
+ <xs:complexType name="culture-infoType">
+ <xs:attribute name="current-culture" type="xs:string" use="required" />
+ <xs:attribute name="current-uiculture" type="xs:string" use="required" />
+ </xs:complexType>
+ <xs:complexType name="resultType">
+ <xs:sequence>
+ <xs:element name="environment" type="environmentType" />
+ <xs:element name="culture-info" type="culture-infoType" />
+ <xs:element name="test-suite" type="test-suiteType" />
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="total" type="xs:decimal" use="required" />
+ <xs:attribute name="failures" type="xs:decimal" use="required" />
+ <xs:attribute name="not-run" type="xs:decimal" use="required" />
+ <xs:attribute name="date" type="xs:string" use="required" />
+ <xs:attribute name="time" type="xs:string" use="required" />
+ </xs:complexType>
+ <xs:complexType name="test-caseType">
+ <xs:sequence>
+ <xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
+ <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" />
+ <xs:choice>
+ <xs:element name="failure" type="failureType" minOccurs="0" />
+ <xs:element name="reason" type="reasonType" minOccurs="0" />
+ </xs:choice>
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="description" type="xs:string" use="optional" />
+ <xs:attribute name="success" type="xs:string" use="optional" />
+ <xs:attribute name="time" type="xs:string" use="optional" />
+ <xs:attribute name="executed" type="xs:string" use="required" />
+ <xs:attribute name="asserts" type="xs:string" use="optional" />
+ </xs:complexType>
+ <xs:complexType name="test-suiteType">
+ <xs:sequence>
+ <xs:element name="categories" type="categoriesType" minOccurs="0" maxOccurs="1" />
+ <xs:element name="properties" type="propertiesType" minOccurs="0" maxOccurs="1" />
+ <xs:choice>
+ <xs:element name="failure" type="failureType" minOccurs="0" />
+ <xs:element name="reason" type="reasonType" minOccurs="0" />
+ </xs:choice>
+ <xs:element name="results" type="resultsType" />
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="description" type="xs:string" use="optional" />
+ <xs:attribute name="success" type="xs:string" use="required" />
+ <xs:attribute name="time" type="xs:string" use="required" />
+ <xs:attribute name="asserts" type="xs:string" use="optional" />
+ </xs:complexType>
+</xs:schema> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/core/SetUpFixture.cs b/mcs/nunit24/NUnitCore/core/SetUpFixture.cs
new file mode 100644
index 00000000000..3542dce27e2
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/SetUpFixture.cs
@@ -0,0 +1,44 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// SetUpFixture extends TestSuite and supports
+ /// Setup and TearDown methods.
+ /// </summary>
+ public class SetUpFixture : TestSuite
+ {
+ #region Constructor
+ public SetUpFixture( Type type ) : base( type )
+ {
+ this.TestName.Name = type.Namespace;
+ if (this.TestName.Name == null)
+ this.TestName.Name = "[default namespace]";
+ int index = TestName.Name.LastIndexOf('.');
+ if (index > 0)
+ this.TestName.Name = this.TestName.Name.Substring(index + 1);
+
+ this.fixtureSetUp = NUnitFramework.GetSetUpMethod( type );
+ this.fixtureTearDown = NUnitFramework.GetTearDownMethod( type );
+ }
+ #endregion
+
+ #region TestSuite Overrides
+ public override TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ using ( new DirectorySwapper( Path.GetDirectoryName( TestFixtureBuilder.GetAssemblyPath( FixtureType ) ) ) )
+ {
+ return base.Run(listener, filter);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/SimpleTestRunner.cs b/mcs/nunit24/NUnitCore/core/SimpleTestRunner.cs
new file mode 100644
index 00000000000..94d03754f73
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/SimpleTestRunner.cs
@@ -0,0 +1,218 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.IO;
+using System.Threading;
+using System.Collections;
+using System.Collections.Specialized;
+using NUnit.Core.Filters;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// SimpleTestRunner is the simplest direct-running TestRunner. It
+ /// passes the event listener interface that is provided on to the tests
+ /// to use directly and does nothing to redirect text output. Both
+ /// Run and BeginRun are actually synchronous, although the client
+ /// can usually ignore this. BeginRun + EndRun operates as expected.
+ /// </summary>
+ public class SimpleTestRunner : MarshalByRefObject, TestRunner
+ {
+ #region Instance Variables
+
+ /// <summary>
+ /// Identifier for this runner. Must be unique among all
+ /// active runners in order to locate tests. Default
+ /// value of 0 is adequate in applications with a single
+ /// runner or a non-branching chain of runners.
+ /// </summary>
+ private int runnerID = 0;
+
+ /// <summary>
+ /// The loaded test suite
+ /// </summary>
+ private Test test;
+
+ /// <summary>
+ /// The builder we use to load tests, created for each load
+ /// </summary>
+ private TestSuiteBuilder builder;
+
+ /// <summary>
+ /// Results from the last test run
+ /// </summary>
+ private TestResult testResult;
+
+ /// <summary>
+ /// The thread on which Run was called. Set to the
+ /// current thread while a run is in process.
+ /// </summary>
+ private Thread runThread;
+
+ #endregion
+
+ #region Constructor
+ public SimpleTestRunner() : this( 0 ) { }
+
+ public SimpleTestRunner( int runnerID )
+ {
+ this.runnerID = runnerID;
+ }
+ #endregion
+
+ #region Properties
+ public virtual int ID
+ {
+ get { return runnerID; }
+ }
+
+ public IList AssemblyInfo
+ {
+ get { return builder.AssemblyInfo; }
+ }
+
+ public ITest Test
+ {
+ get { return test == null ? null : new TestNode( test ); }
+ }
+
+ /// <summary>
+ /// Results from the last test run
+ /// </summary>
+ public TestResult TestResult
+ {
+ get { return testResult; }
+ }
+
+ public virtual bool Running
+ {
+ get { return runThread != null && runThread.IsAlive; }
+ }
+ #endregion
+
+ #region Methods for Loading Tests
+ /// <summary>
+ /// Load a TestPackage
+ /// </summary>
+ /// <param name="package">The package to be loaded</param>
+ /// <returns>True on success, false on failure</returns>
+ public bool Load( TestPackage package )
+ {
+ this.builder = new TestSuiteBuilder();
+
+ this.test = builder.Build( package );
+ if ( test == null ) return false;
+
+ test.SetRunnerID( this.runnerID, true );
+ return true;
+ }
+
+ /// <summary>
+ /// Unload all tests previously loaded
+ /// </summary>
+ public void Unload()
+ {
+ this.test = null; // All for now
+ }
+ #endregion
+
+ #region CountTestCases
+ public int CountTestCases( ITestFilter filter )
+ {
+ return test.CountTestCases( filter );
+ }
+ #endregion
+
+ #region Methods for Running Tests
+ public virtual TestResult Run( EventListener listener )
+ {
+ return Run( listener, TestFilter.Empty );
+ }
+
+ public virtual TestResult Run( EventListener listener, ITestFilter filter )
+ {
+ try
+ {
+ // Take note of the fact that we are running
+ this.runThread = Thread.CurrentThread;
+
+ listener.RunStarted( this.Test.TestName.FullName, test.CountTestCases( filter ) );
+
+ testResult = test.Run( listener, filter );
+
+ // Signal that we are done
+ listener.RunFinished( testResult );
+
+ // Return result array
+ return testResult;
+ }
+ catch( Exception exception )
+ {
+ // Signal that we finished with an exception
+ listener.RunFinished( exception );
+ // Rethrow - should we do this?
+ throw;
+ }
+ finally
+ {
+ runThread = null;
+ }
+ }
+
+ public void BeginRun( EventListener listener )
+ {
+ testResult = this.Run( listener );
+ }
+
+ public void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ testResult = this.Run( listener, filter );
+ }
+
+ public virtual TestResult EndRun()
+ {
+ return TestResult;
+ }
+
+ /// <summary>
+ /// Wait is a NOP for SimpleTestRunner
+ /// </summary>
+ public virtual void Wait()
+ {
+ }
+
+ public virtual void CancelRun()
+ {
+ if (this.runThread != null)
+ {
+ // Cancel Synchronous run only if on another thread
+ if ( runThread == Thread.CurrentThread )
+ throw new InvalidOperationException( "May not CancelRun on same thread that is running the test" );
+
+ // Make a copy of runThread, which will be set to
+ // null when the thread terminates.
+ Thread cancelThread = this.runThread;
+
+ // Tell the thread to abort
+ this.runThread.Abort();
+
+ // Wake up the thread if necessary
+ // Figure out if we need to do an interupt
+ if ( (cancelThread.ThreadState & ThreadState.WaitSleepJoin ) != 0 )
+ cancelThread.Interrupt();
+ }
+ }
+ #endregion
+
+ #region InitializeLifetimeService Override
+ public override object InitializeLifetimeService()
+ {
+ return null;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/StringTextWriter.cs b/mcs/nunit24/NUnitCore/core/StringTextWriter.cs
new file mode 100644
index 00000000000..4e706086a2c
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/StringTextWriter.cs
@@ -0,0 +1,128 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.IO;
+using System.Text;
+
+namespace NUnit.Core
+{
+ // TODO: This class is not currently being used. Review to
+ // see if we will use it again, otherwise drop it.
+ #region StringTextWriter
+
+ /// <summary>
+ /// Use this wrapper to ensure that only strings get passed accross the AppDomain
+ /// boundary. Otherwise tests will break when non-remotable objects are passed to
+ /// Console.Write/WriteLine.
+ /// </summary>
+ public class StringTextWriter : TextWriter
+ {
+ public StringTextWriter( TextWriter aTextWriter )
+ {
+ theTextWriter = aTextWriter;
+ }
+
+ protected TextWriter theTextWriter;
+
+ override public void Write(char aChar)
+ {
+ theTextWriter.Write(aChar);
+ }
+
+ override public void Write(string aString)
+ {
+ theTextWriter.Write(aString);
+ }
+
+ override public void WriteLine(string aString)
+ {
+ theTextWriter.WriteLine(aString);
+ }
+
+ override public System.Text.Encoding Encoding
+ {
+ get { return theTextWriter.Encoding; }
+ }
+
+ public override void Close()
+ {
+ this.Flush();
+ theTextWriter.Close ();
+ }
+
+ public override void Flush()
+ {
+ theTextWriter.Flush ();
+ }
+ }
+
+ #endregion
+
+ #region BufferedStringTextWriter
+
+ /// <summary>
+ /// This wrapper derives from StringTextWriter and adds buffering
+ /// to improve cross-domain performance. The buffer is flushed whenever
+ /// it reaches or exceeds a maximum size or when Flush is called.
+ /// </summary>
+ public class BufferedStringTextWriter : StringTextWriter
+ {
+ public BufferedStringTextWriter( TextWriter aTextWriter ) : base( aTextWriter ){ }
+
+ private static readonly int MAX_BUFFER = 1000;
+ private StringBuilder sb = new StringBuilder( MAX_BUFFER );
+
+ override public void Write(char aChar)
+ {
+ lock( sb )
+ {
+ sb.Append( aChar );
+ this.CheckBuffer();
+ }
+ }
+
+ override public void Write(string aString)
+ {
+ lock( sb )
+ {
+ sb.Append( aString );
+ this.CheckBuffer();
+ }
+ }
+
+ override public void WriteLine(string aString)
+ {
+ lock( sb )
+ {
+ sb.Append( aString );
+ sb.Append( '\n' );
+ this.CheckBuffer();
+ }
+ }
+
+ override public void Flush()
+ {
+ if ( sb.Length > 0 )
+ {
+ lock( sb )
+ {
+ theTextWriter.Write( sb.ToString() );
+ sb.Length = 0;
+ }
+ }
+
+ theTextWriter.Flush();
+ }
+
+ private void CheckBuffer()
+ {
+ if ( sb.Length >= MAX_BUFFER )
+ this.Flush();
+ }
+ }
+
+ #endregion
+}
diff --git a/mcs/nunit24/NUnitCore/core/SuiteBuilderAttribute.cs b/mcs/nunit24/NUnitCore/core/SuiteBuilderAttribute.cs
new file mode 100644
index 00000000000..e79b3ece9b7
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/SuiteBuilderAttribute.cs
@@ -0,0 +1,18 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// SuiteBuilderAttribute is used to mark custom suite builders.
+ /// The class so marked must implement the ISuiteBuilder interface.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
+ public sealed class SuiteBuilderAttribute : Attribute
+ {}
+}
diff --git a/mcs/nunit24/NUnitCore/core/Summary.xslt b/mcs/nunit24/NUnitCore/core/Summary.xslt
new file mode 100644
index 00000000000..c5156c3cf7d
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/Summary.xslt
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method='text'/>
+
+<xsl:template match="/">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="test-results">
+<xsl:text>Tests run: </xsl:text>
+<xsl:value-of select="@total"/>
+<xsl:text>, Failures: </xsl:text>
+<xsl:value-of select="@failures"/>
+<xsl:text>, Not run: </xsl:text>
+<xsl:value-of select="@not-run"/>
+<xsl:text>, Time: </xsl:text>
+<xsl:value-of select="test-suite/@time"/>
+<xsl:text> seconds
+</xsl:text>
+<xsl:text>
+</xsl:text>
+
+<xsl:if test="//test-suite[failure]"><xsl:text>Test Fixture SetUp Failures:
+</xsl:text></xsl:if>
+<xsl:apply-templates select="//test-suite[failure]|//test-suite[failure]"/>
+<xsl:if test="//test-case[failure]"><xsl:text>Test Case Failures:
+</xsl:text></xsl:if>
+<xsl:apply-templates select="//test-case[failure]|//test-suite[failure]"/>
+<xsl:if test="//test-case[@executed='False']"><xsl:text>Tests not run:
+</xsl:text></xsl:if>
+<xsl:apply-templates select="//test-case[@executed='False']"/>
+<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
+</xsl:template>
+
+<xsl:template match="test-case|test-suite">
+ <xsl:value-of select="position()"/><xsl:text>) </xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text> : </xsl:text>
+ <xsl:value-of select="child::node()/message"/>
+<xsl:text disable-output-escaping='yes'>&#xD;&#xA;</xsl:text>
+ <xsl:if test="failure">
+ <xsl:value-of select="failure/stack-trace"/>
+<xsl:text>
+</xsl:text>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
+
+ \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/core/TestBuilderAttribute.cs b/mcs/nunit24/NUnitCore/core/TestBuilderAttribute.cs
new file mode 100644
index 00000000000..7d8228f31b7
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestBuilderAttribute.cs
@@ -0,0 +1,26 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core
+{
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
+ public class TestBuilderAttribute : Attribute
+ {
+ private Type builderType;
+
+ public TestBuilderAttribute(Type builderType)
+ {
+ this.builderType = builderType;
+ }
+
+ public Type BuilderType
+ {
+ get { return builderType; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestCase.cs b/mcs/nunit24/NUnitCore/core/TestCase.cs
new file mode 100644
index 00000000000..4722bcb954f
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestCase.cs
@@ -0,0 +1,96 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Collections;
+ using System.Reflection;
+
+ /// <summary>
+ /// The abstract TestCase class represents a single test case.
+ /// In the present implementation, the only derived class is
+ /// TestMethod, but we allow for future test cases which are
+ /// implemented in other ways.
+ /// </summary>
+ public abstract class TestCase : Test
+ {
+ public TestCase( string path, string name ) : base( path, name ) { }
+
+ public TestCase( MethodInfo method ) : base ( method ) { }
+
+ public TestCase( TestName testName ) : base ( testName ) { }
+
+ public override int CountTestCases( ITestFilter filter )
+ {
+ if (filter.Pass(this))
+ return 1;
+
+ return 0;
+ }
+
+ protected virtual TestCaseResult MakeTestCaseResult()
+ {
+ return new TestCaseResult( new TestInfo(this) );
+ }
+
+ public override TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ return Run( listener ); // Ignore filter for now
+ }
+
+ public override TestResult Run( EventListener listener )
+ {
+ using( new TestContext() )
+ {
+ TestCaseResult testResult = MakeTestCaseResult();
+
+ listener.TestStarted( this.TestName );
+ long startTime = DateTime.Now.Ticks;
+
+ switch (this.RunState)
+ {
+ case RunState.Runnable:
+ case RunState.Explicit:
+ Run(testResult);
+ break;
+ case RunState.Skipped:
+ testResult.Skip(IgnoreReason);
+ break;
+ default:
+ case RunState.NotRunnable:
+ case RunState.Ignored:
+ testResult.Ignore(IgnoreReason);
+ break;
+ }
+
+ long stopTime = DateTime.Now.Ticks;
+ double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
+ testResult.Time = time;
+
+ listener.TestFinished(testResult);
+ return testResult;
+ }
+ }
+
+ public override string TestType
+ {
+ get { return "Test Case"; }
+ }
+
+ public override bool IsSuite
+ {
+ get { return false; }
+ }
+
+ public override IList Tests
+ {
+ get { return null; }
+ }
+
+ public abstract void Run(TestCaseResult result);
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestCaseBuilder.cs b/mcs/nunit24/NUnitCore/core/TestCaseBuilder.cs
new file mode 100644
index 00000000000..8aec8c76492
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestCaseBuilder.cs
@@ -0,0 +1,45 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// This class collects static methods that build test cases.
+ public class TestCaseBuilder
+ {
+ /// <summary>
+ /// Makes a test case from a given method if any builders
+ /// know how to do it and returns null otherwise.
+ /// </summary>
+ /// <param name="method">MethodInfo for the particular method</param>
+ /// <returns>A test case or null</returns>
+// public static Test BuildFrom( MethodInfo method )
+// {
+// Test test = CoreExtensions.Host.TestBuilders.BuildFrom( method );
+//
+// if ( test != null )
+// test = CoreExtensions.Host.TestDecorators.Decorate( test, method );
+//
+// return test;
+// }
+//
+// public static Test Decorate( test, method )
+// {
+// if ( test != null )
+// test = CoreExtensions.Host.TestDecorators.Decorate( test, method );
+//
+// return test;
+// }
+//
+ /// <summary>
+ /// Private constructor to prevent object creation
+ /// </summary>
+ private TestCaseBuilder() { }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestCaseBuilderAttribute.cs b/mcs/nunit24/NUnitCore/core/TestCaseBuilderAttribute.cs
new file mode 100644
index 00000000000..55009dc0cfb
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestCaseBuilderAttribute.cs
@@ -0,0 +1,18 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestBuilderAttribute is used to mark custom test case builders.
+ /// The class so marked must implement the ITestCaseBuilder interface.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
+ public sealed class TestCaseBuilderAttribute : System.Attribute
+ {}
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestContext.cs b/mcs/nunit24/NUnitCore/core/TestContext.cs
new file mode 100644
index 00000000000..b819d046a18
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestContext.cs
@@ -0,0 +1,362 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections.Specialized;
+using System.Configuration;
+using System.IO;
+using System.Diagnostics;
+using System.Globalization;
+using System.Threading;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Helper class used to save and restore certain static or
+ /// singleton settings in the environment that affect tests
+ /// or which might be changed by the user tests.
+ ///
+ /// An internal class is used to hold settings and a stack
+ /// of these objects is pushed and popped as Save and Restore
+ /// are called.
+ ///
+ /// Static methods for each setting forward to the internal
+ /// object on the top of the stack.
+ ///
+ /// When TestContext itself is instantiated, it is used to
+ /// save and restore settings for a block. It should be
+ /// used with using() or Disposed in a finally block.
+ /// </summary>
+ public class TestContext : IDisposable
+ {
+ #region Instance Variables
+ /// <summary>
+ /// The current context, head of the list of saved contexts.
+ /// </summary>
+ private static ContextHolder current = new ContextHolder();
+ #endregion
+
+ #region Static Methods
+ public static bool Tracing
+ {
+ get { return current.Tracing; }
+ set { current.Tracing = value; }
+ }
+
+ public static bool Logging
+ {
+ get { return current.Logging; }
+ set { current.Logging = value; }
+ }
+
+ /// <summary>
+ /// Controls where Console.Out is directed
+ /// </summary>
+ public static TextWriter Out
+ {
+ get { return current.Out; }
+ set { current.Out = value; }
+ }
+
+ /// <summary>
+ /// Controls where Console.Error is directed
+ /// </summary>
+ public static TextWriter Error
+ {
+ get { return current.Error; }
+ set { current.Error = value; }
+ }
+
+ /// <summary>
+ /// Controls where Trace output is directed
+ /// </summary>
+ public static TextWriter TraceWriter
+ {
+ get { return current.TraceWriter; }
+ set { current.TraceWriter = value; }
+ }
+
+ public static TextWriter LogWriter
+ {
+ get { return current.LogWriter; }
+ set { current.LogWriter = value; }
+ }
+
+ /// <summary>
+ /// The current directory setting
+ /// </summary>
+ public static string CurrentDirectory
+ {
+ get { return current.CurrentDirectory; }
+ set { current.CurrentDirectory = value; }
+ }
+
+ public static CultureInfo CurrentCulture
+ {
+ get { return current.CurrentCulture; }
+ set { current.CurrentCulture = value; }
+ }
+
+ /// <summary>
+ /// Saves the old context and makes a fresh one
+ /// current without changing any settings.
+ /// </summary>
+ public static void Save()
+ {
+ TestContext.current = new ContextHolder( current );
+ }
+
+ /// <summary>
+ /// Restores the last saved context and puts
+ /// any saved settings back into effect.
+ /// </summary>
+ public static void Restore()
+ {
+ current.ReverseChanges();
+ current = current.prior;
+ }
+ #endregion
+
+ #region Construct and Dispose
+ /// <summary>
+ /// The constructor saves the current context.
+ /// </summary>
+ public TestContext()
+ {
+ TestContext.Save();
+ }
+
+ /// <summary>
+ /// Dispose restores the old context
+ /// </summary>
+ public void Dispose()
+ {
+ TestContext.Restore();
+ }
+ #endregion
+
+ #region ContextHolder internal class
+ private class ContextHolder
+ {
+ /// <summary>
+ /// Indicates whether trace is enabled
+ /// </summary>
+ private bool tracing;
+
+ /// <summary>
+ /// Indicates whether logging is enabled
+ /// </summary>
+ private bool logging;
+
+ /// <summary>
+ /// Destination for standard output
+ /// </summary>
+ private TextWriter outWriter;
+
+ /// <summary>
+ /// Destination for standard error
+ /// </summary>
+ private TextWriter errorWriter;
+
+ /// <summary>
+ /// Destination for Trace output
+ /// </summary>
+ private TextWriter traceWriter;
+
+ private Log4NetCapture logCapture;
+
+ /// <summary>
+ /// The current working directory
+ /// </summary>
+ private string currentDirectory;
+
+ /// <summary>
+ /// The current culture
+ /// </summary>
+ private CultureInfo currentCulture;
+
+ /// <summary>
+ /// Link to a prior saved context
+ /// </summary>
+ public ContextHolder prior;
+
+ public ContextHolder()
+ {
+ this.prior = null;
+ this.tracing = false;
+ this.logging = false;
+ this.outWriter = Console.Out;
+ this.errorWriter = Console.Error;
+ this.traceWriter = null;
+ this.logCapture = new Log4NetCapture();
+
+ this.currentDirectory = Environment.CurrentDirectory;
+ this.currentCulture = CultureInfo.CurrentCulture;
+ }
+
+ public ContextHolder( ContextHolder other )
+ {
+ this.prior = other;
+ this.tracing = other.tracing;
+ this.logging = other.logging;
+ this.outWriter = other.outWriter;
+ this.errorWriter = other.errorWriter;
+ this.traceWriter = other.traceWriter;
+ this.logCapture = other.logCapture;
+
+ this.currentDirectory = Environment.CurrentDirectory;
+ this.currentCulture = CultureInfo.CurrentCulture;
+ }
+
+ /// <summary>
+ /// Used to restore settings to their prior
+ /// values before reverting to a prior context.
+ /// </summary>
+ public void ReverseChanges()
+ {
+ if ( prior == null )
+ throw new InvalidOperationException( "TestContext: too many Restores" );
+
+ this.Tracing = prior.Tracing;
+ this.Out = prior.Out;
+ this.Error = prior.Error;
+ this.CurrentDirectory = prior.CurrentDirectory;
+ this.CurrentCulture = prior.CurrentCulture;
+ }
+
+ /// <summary>
+ /// Controls whether trace and debug output are written
+ /// to the standard output.
+ /// </summary>
+ public bool Tracing
+ {
+ get { return tracing; }
+ set
+ {
+ if ( tracing != value )
+ {
+ if ( traceWriter != null && tracing )
+ StopTracing();
+
+ tracing = value;
+
+ if ( traceWriter != null && tracing )
+ StartTracing();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Controls whether log output is captured
+ /// </summary>
+ public bool Logging
+ {
+ get { return logCapture.Enabled; }
+ set { logCapture.Enabled = value; }
+ }
+
+ /// <summary>
+ /// Controls where Console.Out is directed
+ /// </summary>
+ public TextWriter Out
+ {
+ get { return outWriter; }
+ set
+ {
+ if ( outWriter != value )
+ {
+ outWriter = value;
+ Console.Out.Flush();
+ Console.SetOut( outWriter );
+ }
+ }
+ }
+
+ /// <summary>
+ /// Controls where Console.Error is directed
+ /// </summary>
+ public TextWriter Error
+ {
+ get { return errorWriter; }
+ set
+ {
+ if ( errorWriter != value )
+ {
+ errorWriter = value;
+ Console.Error.Flush();
+ Console.SetError( errorWriter );
+ }
+ }
+ }
+
+ public TextWriter TraceWriter
+ {
+ get { return traceWriter; }
+ set
+ {
+ if ( traceWriter != value )
+ {
+ if ( traceWriter != null && tracing )
+ StopTracing();
+
+ traceWriter = value;
+
+ if ( traceWriter != null && tracing )
+ StartTracing();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the Log writer, which is actually held by a log4net
+ /// TextWriterAppender. When first set, the appender will be created
+ /// and will thereafter send any log events to the writer.
+ ///
+ /// In normal operation, LogWriter is set to an EventListenerTextWriter
+ /// connected to the EventQueue in the test domain. The events are
+ /// subsequently captured in the Gui an the output displayed in
+ /// the Log tab. The application under test does not need to define
+ /// any additional appenders.
+ /// </summary>
+ public TextWriter LogWriter
+ {
+ get { return logCapture.Writer; }
+ set { logCapture.Writer = value; }
+ }
+
+ private void StopTracing()
+ {
+ traceWriter.Close();
+ System.Diagnostics.Trace.Listeners.Remove( "NUnit" );
+ }
+
+ private void StartTracing()
+ {
+ System.Diagnostics.Trace.Listeners.Add( new TextWriterTraceListener( traceWriter, "NUnit" ) );
+ }
+
+ public string CurrentDirectory
+ {
+ get { return currentDirectory; }
+ set
+ {
+ currentDirectory = value;
+ Environment.CurrentDirectory = currentDirectory;
+ }
+ }
+
+ public CultureInfo CurrentCulture
+ {
+ get { return currentCulture; }
+ set
+ {
+ currentCulture = value;
+ Thread.CurrentThread.CurrentCulture = currentCulture;
+ }
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestDecoratorAttribute.cs b/mcs/nunit24/NUnitCore/core/TestDecoratorAttribute.cs
new file mode 100644
index 00000000000..b05c76fca8c
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestDecoratorAttribute.cs
@@ -0,0 +1,17 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestDecoratorAttribute is used to mark custom suite builders.
+ /// The class so marked must implement the ISuiteBuilder interface.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
+ public sealed class TestDecoratorAttribute : Attribute
+ {}
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestFixture.cs b/mcs/nunit24/NUnitCore/core/TestFixture.cs
new file mode 100644
index 00000000000..e30d1a57b9e
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestFixture.cs
@@ -0,0 +1,40 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestFixture is a surrogate for a user test fixture class,
+ /// containing one or more tests.
+ /// </summary>
+ public class TestFixture : TestSuite
+ {
+ #region Constructors
+ public TestFixture( Type fixtureType )
+ : base( fixtureType ) { }
+ #endregion
+
+ #region Properties
+ public override string TestType
+ {
+ get { return "Test Fixture"; }
+ }
+ #endregion
+
+ #region TestSuite Overrides
+ public override TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ using ( new DirectorySwapper( Path.GetDirectoryName( TestFixtureBuilder.GetAssemblyPath( FixtureType ) ) ) )
+ {
+ return base.Run(listener, filter);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestFixtureBuilder.cs b/mcs/nunit24/NUnitCore/core/TestFixtureBuilder.cs
new file mode 100644
index 00000000000..79bfc9c7f44
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestFixtureBuilder.cs
@@ -0,0 +1,84 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestFixtureBuilder contains static methods for building
+ /// TestFixtures from types. It uses builtin SuiteBuilders
+ /// and any installed extensions to do it.
+ /// </summary>
+ public class TestFixtureBuilder
+ {
+ public static bool CanBuildFrom( Type type )
+ {
+ return CoreExtensions.Host.SuiteBuilders.CanBuildFrom( type );
+ }
+
+ /// <summary>
+ /// Build a test fixture from a given type.
+ /// </summary>
+ /// <param name="type">The type to be used for the fixture</param>
+ /// <returns>A TestSuite if the fixture can be built, null if not</returns>
+ public static Test BuildFrom( Type type )
+ {
+ Test suite = CoreExtensions.Host.SuiteBuilders.BuildFrom( type );
+
+ if ( suite != null )
+ suite = CoreExtensions.Host.TestDecorators.Decorate( suite, type );
+
+ return suite;
+ }
+
+ /// <summary>
+ /// Build a fixture from an object.
+ /// </summary>
+ /// <param name="fixture">The object to be used for the fixture</param>
+ /// <returns>A TestSuite if fixture type can be built, null if not</returns>
+ public static Test BuildFrom( object fixture )
+ {
+ Test suite = BuildFrom( fixture.GetType() );
+ if( suite != null)
+ suite.Fixture = fixture;
+ return suite;
+ }
+
+ public static string GetAssemblyPath( Type fixtureType )
+ {
+ return GetAssemblyPath( fixtureType.Assembly );
+ }
+
+ // TODO: This logic should be in shared source
+ public static string GetAssemblyPath( Assembly assembly )
+ {
+ string path = assembly.CodeBase;
+ Uri uri = new Uri( path );
+
+ // If it wasn't loaded locally, use the Location
+ if ( !uri.IsFile )
+ return assembly.Location;
+
+ if ( uri.IsUnc )
+ return path.Substring( Uri.UriSchemeFile.Length+1 );
+
+
+ int start = Uri.UriSchemeFile.Length + Uri.SchemeDelimiter.Length;
+
+ if ( path[start] == '/' && path[start+2] == ':' )
+ ++start;
+
+ return path.Substring( start );
+ }
+
+ /// <summary>
+ /// Private constructor to prevent instantiation
+ /// </summary>
+ private TestFixtureBuilder() { }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestMethod.cs b/mcs/nunit24/NUnitCore/core/TestMethod.cs
new file mode 100644
index 00000000000..189d0079d00
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestMethod.cs
@@ -0,0 +1,401 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using System.Reflection;
+
+ /// <summary>
+ /// The TestMethod class represents a TestCase implemented as a method
+ /// call on a fixture object. At the moment, this is the only way we
+ /// implement a TestCase, but others are expected in the future.
+ ///
+ /// Because of how exceptions are handled internally, this class
+ /// must incorporate processing of expected exceptions. A change to
+ /// the TestCase interface might make it easier to process exceptions
+ /// in an object that aggregates a TestMethod in the future.
+ /// </summary>
+ public abstract class TestMethod : TestCase
+ {
+ #region Fields
+ /// <summary>
+ /// The test method
+ /// </summary>
+ private MethodInfo method;
+
+ /// <summary>
+ /// The SetUp method.
+ /// </summary>
+ protected MethodInfo setUpMethod;
+
+ /// <summary>
+ /// The teardown method
+ /// </summary>
+ protected MethodInfo tearDownMethod;
+
+ /// <summary>
+ /// The exception handler method
+ /// </summary>
+ internal MethodInfo exceptionHandler;
+
+ /// <summary>
+ /// True if an exception is expected
+ /// </summary>
+ internal bool exceptionExpected;
+
+ /// <summary>
+ /// The type of any expected exception
+ /// </summary>
+ internal Type expectedExceptionType;
+
+ /// <summary>
+ /// The full name of any expected exception type
+ /// </summary>
+ internal string expectedExceptionName;
+
+ /// <summary>
+ /// The value of any message associated with an expected exception
+ /// </summary>
+ internal string expectedMessage;
+
+ /// <summary>
+ /// A string indicating how to match the expected message
+ /// </summary>
+ internal string matchType;
+
+ /// <summary>
+ /// A string containing any user message specified for the expected exception
+ /// </summary>
+ internal string userMessage;
+
+ #endregion
+
+ #region Constructors
+ public TestMethod( MethodInfo method )
+ : base( method )
+ {
+ this.method = method;
+ }
+ #endregion
+
+ #region Properties
+ public MethodInfo Method
+ {
+ get { return method; }
+ }
+
+ public bool ExceptionExpected
+ {
+ get { return exceptionExpected; }
+ set { exceptionExpected = value; }
+ }
+
+ public MethodInfo ExceptionHandler
+ {
+ get { return exceptionHandler; }
+ set { exceptionHandler = value; }
+ }
+
+ public Type ExpectedExceptionType
+ {
+ get { return expectedExceptionType; }
+ set
+ {
+ expectedExceptionType = value;
+ expectedExceptionName = expectedExceptionType != null
+ ? expectedExceptionType.FullName
+ : null;
+ }
+ }
+
+ public string ExpectedExceptionName
+ {
+ get { return expectedExceptionName; }
+ set
+ {
+ expectedExceptionType = null;
+ expectedExceptionName = value;
+ }
+ }
+
+ public string ExpectedMessage
+ {
+ get { return expectedMessage; }
+ set { expectedMessage = value; }
+ }
+
+ public string MatchType
+ {
+ get { return matchType; }
+ set { matchType = value; }
+ }
+
+ public string UserMessage
+ {
+ get { return userMessage; }
+ set { userMessage = value; }
+ }
+ #endregion
+
+ #region Run Methods
+ public override void Run(TestCaseResult testResult)
+ {
+ try
+ {
+ if ( this.Parent != null)
+ Fixture = this.Parent.Fixture;
+
+ if (!testResult.IsFailure)
+ {
+ // Temporary... to allow for tests that directly execute a test case
+ if (Fixture == null)
+ Fixture = Reflect.Construct(this.FixtureType);
+
+ if (this.Properties["_SETCULTURE"] != null)
+ TestContext.CurrentCulture =
+ new System.Globalization.CultureInfo((string)Properties["_SETCULTURE"]);
+
+ doRun(testResult);
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex is NUnitException)
+ ex = ex.InnerException;
+
+ RecordException(ex, testResult);
+ }
+ finally
+ {
+ Fixture = null;
+ }
+ }
+
+ /// <summary>
+ /// The doRun method is used to run a test internally.
+ /// It assumes that the caller is taking care of any
+ /// TestFixtureSetUp and TestFixtureTearDown needed.
+ /// </summary>
+ /// <param name="testResult">The result in which to record success or failure</param>
+ public virtual void doRun( TestCaseResult testResult )
+ {
+ DateTime start = DateTime.Now;
+
+ try
+ {
+ if ( setUpMethod != null )
+ Reflect.InvokeMethod( setUpMethod, this.Fixture );
+
+ doTestCase( testResult );
+ }
+ catch(Exception ex)
+ {
+ if ( ex is NUnitException )
+ ex = ex.InnerException;
+
+ RecordException( ex, testResult );
+ }
+ finally
+ {
+ doTearDown( testResult );
+
+ DateTime stop = DateTime.Now;
+ TimeSpan span = stop.Subtract(start);
+ testResult.Time = (double)span.Ticks / (double)TimeSpan.TicksPerSecond;
+ }
+ }
+ #endregion
+
+ #region Invoke Methods by Reflection, Recording Errors
+
+ private void doTearDown( TestCaseResult testResult )
+ {
+ try
+ {
+ if ( tearDownMethod != null )
+ tearDownMethod.Invoke( this.Fixture, new object[0] );
+ }
+ catch(Exception ex)
+ {
+ if ( ex is NUnitException )
+ ex = ex.InnerException;
+ // TODO: What about ignore exceptions in teardown?
+ testResult.Error( ex,FailureSite.TearDown );
+ }
+ }
+
+ private void doTestCase( TestCaseResult testResult )
+ {
+ try
+ {
+ RunTestMethod(testResult);
+ ProcessNoException(testResult);
+ }
+ catch( Exception ex )
+ {
+ if ( ex is NUnitException )
+ ex = ex.InnerException;
+
+ if ( IsIgnoreException( ex ) )
+ testResult.Ignore( ex );
+ else
+ ProcessException(ex, testResult);
+ }
+ }
+
+ public virtual void RunTestMethod(TestCaseResult testResult)
+ {
+ Reflect.InvokeMethod( this.method, this.Fixture );
+ }
+
+ #endregion
+
+ #region Record Info About An Exception
+
+ protected void RecordException( Exception ex, TestResult testResult )
+ {
+ if ( IsIgnoreException( ex ) )
+ testResult.Ignore( ex.Message );
+ else if ( IsAssertException( ex ) )
+ testResult.Failure( ex.Message, ex.StackTrace );
+ else
+ testResult.Error( ex );
+ }
+
+ protected string GetStackTrace(Exception exception)
+ {
+ try
+ {
+ return exception.StackTrace;
+ }
+ catch( Exception )
+ {
+ return "No stack trace available";
+ }
+ }
+
+ #endregion
+
+ #region Exception Processing
+ protected internal virtual void ProcessNoException(TestCaseResult testResult)
+ {
+ if ( ExceptionExpected )
+ testResult.Failure(NoExceptionMessage(), null);
+ else
+ testResult.Success();
+ }
+
+ protected internal virtual void ProcessException(Exception exception, TestCaseResult testResult)
+ {
+ if (!ExceptionExpected)
+ {
+ RecordException(exception, testResult);
+ return;
+ }
+
+ if (IsExpectedExceptionType(exception))
+ {
+ if (IsExpectedMessageMatch(exception))
+ {
+ if ( exceptionHandler != null )
+ Reflect.InvokeMethod( exceptionHandler, this.Fixture, exception );
+
+ testResult.Success();
+ }
+ else
+ {
+ testResult.Failure(WrongTextMessage(exception), GetStackTrace(exception));
+ }
+ }
+ else if (IsAssertException(exception))
+ {
+ testResult.Failure(exception.Message, exception.StackTrace);
+ }
+ else
+ {
+ testResult.Failure(WrongTypeMessage(exception), GetStackTrace(exception));
+ }
+ }
+ #endregion
+
+ #region Abstract Methods
+ protected abstract bool IsAssertException(Exception ex);
+
+ protected abstract bool IsIgnoreException(Exception ex);
+ #endregion
+
+ #region Helper Methods
+ protected bool IsExpectedExceptionType(Exception exception)
+ {
+ return expectedExceptionName == null || expectedExceptionName.Equals(exception.GetType().FullName);
+ }
+
+ protected bool IsExpectedMessageMatch(Exception exception)
+ {
+ if (expectedMessage == null)
+ return true;
+
+ switch (matchType)
+ {
+ case "Exact":
+ default:
+ return expectedMessage.Equals(exception.Message);
+ case "Contains":
+ return exception.Message.IndexOf(expectedMessage) >= 0;
+ case "Regex":
+ return Regex.IsMatch(exception.Message, expectedMessage);
+ }
+ }
+
+ protected string NoExceptionMessage()
+ {
+ string expectedType = expectedExceptionName == null ? "An Exception" : expectedExceptionName;
+ return CombineWithUserMessage( expectedType + " was expected" );
+ }
+
+ protected string WrongTypeMessage(Exception exception)
+ {
+ return CombineWithUserMessage(
+ "An unexpected exception type was thrown" + Environment.NewLine +
+ "Expected: " + expectedExceptionName + Environment.NewLine +
+ " but was: " + exception.GetType().FullName + " : " + exception.Message );
+ }
+
+ protected string WrongTextMessage(Exception exception)
+ {
+ string expectedText;
+ switch (matchType)
+ {
+ default:
+ case "Exact":
+ expectedText = "Expected: ";
+ break;
+ case "Contains":
+ expectedText = "Expected message containing: ";
+ break;
+ case "Regex":
+ expectedText = "Expected message matching: ";
+ break;
+ }
+
+ return CombineWithUserMessage(
+ "The exception message text was incorrect" + Environment.NewLine +
+ expectedText + expectedMessage + Environment.NewLine +
+ " but was: " + exception.Message );
+ }
+
+ private string CombineWithUserMessage( string message )
+ {
+ if ( userMessage == null )
+ return message;
+ return userMessage + Environment.NewLine + message;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestRunnerThread.cs b/mcs/nunit24/NUnitCore/core/TestRunnerThread.cs
new file mode 100644
index 00000000000..6c4ebfa4319
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestRunnerThread.cs
@@ -0,0 +1,162 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Threading;
+using System.Configuration;
+using System.Collections.Specialized;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestRunnerThread encapsulates running a test on a thread.
+ /// It knows how to create the thread based on configuration
+ /// settings and can cancel abort the test if necessary.
+ /// </summary>
+ public class TestRunnerThread
+ {
+ #region Private Fields
+
+ /// <summary>
+ /// The Test runner to be used in running tests on the thread
+ /// </summary>
+ private TestRunner runner;
+
+ /// <summary>
+ /// The System.Threading.Thread created by the object
+ /// </summary>
+ private Thread thread;
+
+ /// <summary>
+ /// Collection of TestRunner settings from the config file
+ /// </summary>
+ private NameValueCollection settings;
+
+ /// <summary>
+ /// The EventListener interface to receive test events
+ /// </summary>
+ private NUnit.Core.EventListener listener;
+
+ /// <summary>
+ /// Array of test names for ues by the thread proc
+ /// </summary>
+ //private string[] testNames;
+ private ITestFilter filter;
+
+ /// <summary>
+ /// Array of returned results
+ /// </summary>
+ private TestResult[] results;
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// True if the thread is executing
+ /// </summary>
+ public bool IsAlive
+ {
+ get { return this.thread.IsAlive; }
+ }
+
+ /// <summary>
+ /// Array of returned results
+ /// </summary>
+ public TestResult[] Results
+ {
+ get { return results; }
+ }
+
+ #endregion
+
+ #region Constructor
+
+ public TestRunnerThread( TestRunner runner )
+ {
+ this.runner = runner;
+ this.thread = new Thread( new ThreadStart( TestRunnerThreadProc ) );
+ thread.IsBackground = true;
+ thread.Name = "TestRunnerThread";
+
+ this.settings = (NameValueCollection)
+ ConfigurationSettings.GetConfig( "NUnit/TestRunner" );
+
+ if ( settings != null )
+ {
+ try
+ {
+ string apartment = settings["ApartmentState"];
+ if ( apartment != null )
+ thread.ApartmentState = (ApartmentState)
+ System.Enum.Parse( typeof( ApartmentState ), apartment, true );
+
+ string priority = settings["ThreadPriority"];
+ if ( priority != null )
+ thread.Priority = (ThreadPriority)
+ System.Enum.Parse( typeof( ThreadPriority ), priority, true );
+ }
+ catch( ArgumentException ex )
+ {
+ string msg = string.Format( "Invalid configuration setting in {0}",
+ AppDomain.CurrentDomain.SetupInformation.ConfigurationFile );
+ throw new ArgumentException( msg, ex );
+ }
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ public void Wait()
+ {
+ if ( this.thread.IsAlive )
+ this.thread.Join();
+ }
+
+ public void Cancel()
+ {
+ this.thread.Abort(); // Request abort first
+
+ // Wake up the thread if necessary
+ if ( ( this.thread.ThreadState & ThreadState.WaitSleepJoin ) != 0 )
+ this.thread.Interrupt();
+ }
+
+ public void StartRun( EventListener listener )
+ {
+ StartRun( listener, TestFilter.Empty );
+ }
+
+ public void StartRun( EventListener listener, ITestFilter filter )
+ {
+ this.listener = listener;
+ this.filter = filter;
+
+ thread.Start();
+ }
+
+ #endregion
+
+ #region Thread Proc
+ /// <summary>
+ /// The thread proc for our actual test run
+ /// </summary>
+ private void TestRunnerThreadProc()
+ {
+ try
+ {
+ results = new TestResult[] { runner.Run(this.listener, this.filter) };
+ }
+ catch (Exception ex)
+ {
+ throw new ApplicationException("Exception in TestRunnerThread", ex);
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestSuite.cs b/mcs/nunit24/NUnitCore/core/TestSuite.cs
new file mode 100644
index 00000000000..b6a68c2a47e
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestSuite.cs
@@ -0,0 +1,376 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Collections;
+ using System.Reflection;
+ using NUnit.Core.Filters;
+
+ /// <summary>
+ /// Summary description for TestSuite.
+ /// </summary>
+ ///
+ [Serializable]
+ public class TestSuite : Test
+ {
+ #region Fields
+ /// <summary>
+ /// Our collection of child tests
+ /// </summary>
+ private ArrayList tests = new ArrayList();
+
+ /// <summary>
+ /// The fixture setup method for this suite
+ /// </summary>
+ protected MethodInfo fixtureSetUp;
+
+ /// <summary>
+ /// The fixture teardown method for this suite
+ /// </summary>
+ protected MethodInfo fixtureTearDown;
+
+ #endregion
+
+ #region Constructors
+ public TestSuite( string name )
+ : base( name ) { }
+
+ public TestSuite( string parentSuiteName, string name )
+ : base( parentSuiteName, name ) { }
+
+ public TestSuite( Type fixtureType )
+ : base( fixtureType ) { }
+ #endregion
+
+ #region Public Methods
+ public void Sort()
+ {
+ this.tests.Sort();
+
+ foreach( Test test in Tests )
+ {
+ TestSuite suite = test as TestSuite;
+ if ( suite != null )
+ suite.Sort();
+ }
+ }
+
+ public void Sort(IComparer comparer)
+ {
+ this.tests.Sort(comparer);
+
+ foreach( Test test in Tests )
+ {
+ TestSuite suite = test as TestSuite;
+ if ( suite != null )
+ suite.Sort(comparer);
+ }
+ }
+
+ public void Add( Test test )
+ {
+// if( test.RunState == RunState.Runnable )
+// {
+// test.RunState = this.RunState;
+// test.IgnoreReason = this.IgnoreReason;
+// }
+ test.Parent = this;
+ tests.Add(test);
+ }
+
+ public void Add( object fixture )
+ {
+ Test test = TestFixtureBuilder.BuildFrom( fixture );
+ if ( test != null )
+ Add( test );
+ }
+ #endregion
+
+ #region Properties
+ public override IList Tests
+ {
+ get { return tests; }
+ }
+
+ public override bool IsSuite
+ {
+ get { return true; }
+ }
+
+ public override int TestCount
+ {
+ get
+ {
+ int count = 0;
+
+ foreach(Test test in Tests)
+ {
+ count += test.TestCount;
+ }
+ return count;
+ }
+ }
+ #endregion
+
+ #region Test Overrides
+ public override string TestType
+ {
+ get { return "Test Suite"; }
+ }
+
+ public override int CountTestCases(ITestFilter filter)
+ {
+ int count = 0;
+
+ if(filter.Pass(this))
+ {
+ foreach(Test test in Tests)
+ {
+ count += test.CountTestCases(filter);
+ }
+ }
+ return count;
+ }
+
+ public override TestResult Run(EventListener listener)
+ {
+ return Run( listener, TestFilter.Empty );
+ }
+
+ public override TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ using( new TestContext() )
+ {
+ TestSuiteResult suiteResult = new TestSuiteResult( new TestInfo(this), TestName.Name);
+
+ listener.SuiteStarted( this.TestName );
+ long startTime = DateTime.Now.Ticks;
+
+ switch (this.RunState)
+ {
+ case RunState.Runnable:
+ case RunState.Explicit:
+ suiteResult.RunState = RunState.Executed;
+ DoOneTimeSetUp(suiteResult);
+ if ( suiteResult.IsFailure )
+ MarkTestsFailed(Tests, suiteResult, listener, filter);
+ else
+ {
+ try
+ {
+ RunAllTests(suiteResult, listener, filter);
+ }
+ finally
+ {
+ DoOneTimeTearDown(suiteResult);
+ }
+ }
+ break;
+
+ case RunState.Skipped:
+ suiteResult.Skip(this.IgnoreReason);
+ MarkTestsNotRun(Tests, RunState.Skipped, IgnoreReason, suiteResult, listener, filter);
+ break;
+
+ default:
+ case RunState.Ignored:
+ case RunState.NotRunnable:
+ suiteResult.Ignore(this.IgnoreReason);
+ MarkTestsNotRun(Tests, RunState.Ignored, IgnoreReason, suiteResult, listener, filter);
+ break;
+ }
+
+ long stopTime = DateTime.Now.Ticks;
+ double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
+ suiteResult.Time = time;
+
+ listener.SuiteFinished(suiteResult);
+ return suiteResult;
+ }
+ }
+ #endregion
+
+ #region Virtual Methods
+ protected virtual void DoOneTimeSetUp(TestResult suiteResult)
+ {
+ if (FixtureType != null)
+ {
+ try
+ {
+ if (Fixture == null) // In case TestFixture was created with fixture object
+ CreateUserFixture();
+
+ if (this.Properties["_SETCULTURE"] != null)
+ TestContext.CurrentCulture =
+ new System.Globalization.CultureInfo((string)Properties["_SETCULTURE"]);
+
+ if (this.fixtureSetUp != null)
+ Reflect.InvokeMethod(fixtureSetUp, Fixture);
+ }
+ catch (Exception ex)
+ {
+ if (ex is NUnitException || ex is System.Reflection.TargetInvocationException)
+ ex = ex.InnerException;
+
+ if (IsIgnoreException(ex))
+ {
+ this.RunState = RunState.Ignored;
+ suiteResult.Ignore(ex.Message);
+ suiteResult.StackTrace = ex.StackTrace;
+ this.IgnoreReason = ex.Message;
+ }
+ else
+ {
+ if (IsAssertException(ex))
+ suiteResult.Failure(ex.Message, ex.StackTrace, FailureSite.SetUp);
+ else
+ suiteResult.Error(ex, FailureSite.SetUp);
+ }
+ }
+ }
+ }
+
+ protected virtual void CreateUserFixture()
+ {
+ Fixture = Reflect.Construct(FixtureType);
+ }
+
+ protected virtual void DoOneTimeTearDown(TestResult suiteResult)
+ {
+ if ( this.Fixture != null)
+ {
+ try
+ {
+ if (this.fixtureTearDown != null)
+ Reflect.InvokeMethod(fixtureTearDown, Fixture);
+
+ IDisposable disposable = Fixture as IDisposable;
+ if (disposable != null)
+ disposable.Dispose();
+ }
+ catch (Exception ex)
+ {
+ // Error in TestFixtureTearDown or Dispose causes the
+ // suite to be marked as a failure, even if
+ // all the contained tests passed.
+ NUnitException nex = ex as NUnitException;
+ if (nex != null)
+ ex = nex.InnerException;
+
+
+ suiteResult.Failure(ex.Message, ex.StackTrace, FailureSite.TearDown);
+ }
+
+ this.Fixture = null;
+ }
+ }
+
+ private void RunAllTests(
+ TestSuiteResult suiteResult, EventListener listener, ITestFilter filter )
+ {
+ foreach (Test test in ArrayList.Synchronized(Tests))
+ {
+ if (filter.Pass(test))
+ {
+ RunState saveRunState = test.RunState;
+
+ if (test.RunState == RunState.Runnable && this.RunState != RunState.Runnable && this.RunState != RunState.Explicit )
+ {
+ test.RunState = this.RunState;
+ test.IgnoreReason = this.IgnoreReason;
+ }
+
+ TestResult result = test.Run(listener, filter);
+
+ suiteResult.AddResult(result);
+
+ if (saveRunState != test.RunState)
+ {
+ test.RunState = saveRunState;
+ test.IgnoreReason = null;
+ }
+ }
+ }
+ }
+
+ private void MarkTestsNotRun(
+ IList tests, RunState runState, string ignoreReason, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
+ {
+ foreach (Test test in ArrayList.Synchronized(tests))
+ {
+ if (filter.Pass(test))
+ MarkTestNotRun(test, runState, ignoreReason, suiteResult, listener, filter);
+ }
+ }
+
+ private void MarkTestNotRun(
+ Test test, RunState runState, string ignoreReason, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
+ {
+ if (test is TestSuite)
+ {
+ listener.SuiteStarted(test.TestName);
+ TestSuiteResult result = new TestSuiteResult( new TestInfo(test), test.TestName.FullName);
+ result.NotRun( runState, ignoreReason, null );
+ MarkTestsNotRun(test.Tests, runState, ignoreReason, suiteResult, listener, filter);
+ suiteResult.AddResult(result);
+ listener.SuiteFinished(result);
+ }
+ else
+ {
+ listener.TestStarted(test.TestName);
+ TestCaseResult result = new TestCaseResult( new TestInfo(test) );
+ result.NotRun( runState, ignoreReason, null );
+ suiteResult.AddResult(result);
+ listener.TestFinished(result);
+ }
+ }
+
+ private void MarkTestsFailed(
+ IList tests, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
+ {
+ foreach (Test test in ArrayList.Synchronized(tests))
+ if (filter.Pass(test))
+ MarkTestFailed(test, suiteResult, listener, filter);
+ }
+
+ private void MarkTestFailed(
+ Test test, TestSuiteResult suiteResult, EventListener listener, ITestFilter filter)
+ {
+ if (test is TestSuite)
+ {
+ listener.SuiteStarted(test.TestName);
+ TestSuiteResult result = new TestSuiteResult( new TestInfo(test), test.TestName.FullName);
+ string msg = string.Format( "Parent SetUp failed in {0}", this.FixtureType.Name );
+ result.Failure(msg, null, FailureSite.Parent);
+ MarkTestsFailed(test.Tests, suiteResult, listener, filter);
+ suiteResult.AddResult(result);
+ listener.SuiteFinished(result);
+ }
+ else
+ {
+ listener.TestStarted(test.TestName);
+ TestCaseResult result = new TestCaseResult( new TestInfo(test) );
+ string msg = string.Format( "TestFixtureSetUp failed in {0}", this.FixtureType.Name );
+ result.Failure(msg, null, FailureSite.Parent);
+ suiteResult.AddResult(result);
+ listener.TestFinished(result);
+ }
+ }
+
+ protected virtual bool IsAssertException(Exception ex)
+ {
+ return ex.GetType().FullName == NUnitFramework.AssertException;
+ }
+
+ protected virtual bool IsIgnoreException(Exception ex)
+ {
+ return ex.GetType().FullName == NUnitFramework.IgnoreException;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TestSuiteBuilder.cs b/mcs/nunit24/NUnitCore/core/TestSuiteBuilder.cs
new file mode 100644
index 00000000000..fc793179200
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TestSuiteBuilder.cs
@@ -0,0 +1,125 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using NUnit.Core.Builders;
+ using System.Collections;
+ using System.Reflection;
+
+ /// <summary>
+ /// This is the master suite builder for NUnit. It builds a test suite from
+ /// one or more assemblies using a list of internal and external suite builders
+ /// to create fixtures from the qualified types in each assembly. It implements
+ /// the ISuiteBuilder interface itself, allowing it to be used by other classes
+ /// for queries and suite construction.
+ /// </summary>D:\Dev\NUnit\nunit20\src\NUnitFramework\core\TestBuilderAttribute.cs
+ public class TestSuiteBuilder
+ {
+ #region Instance Variables
+
+ private ArrayList builders = new ArrayList();
+
+ #endregion
+
+ #region Properties
+ public IList Assemblies
+ {
+ get
+ {
+ ArrayList assemblies = new ArrayList();
+ foreach( TestAssemblyBuilder builder in builders )
+ assemblies.Add( builder.Assembly );
+ return assemblies;
+ }
+ }
+
+ public IList AssemblyInfo
+ {
+ get
+ {
+ ArrayList info = new ArrayList();
+ foreach( TestAssemblyBuilder builder in this.builders )
+ info.Add( builder.AssemblyInfo );
+
+ return info;
+ }
+ }
+ #endregion
+
+ #region Build Methods
+ /// <summary>
+ /// Build a suite based on a TestPackage
+ /// </summary>
+ /// <param name="package">The TestPackage</param>
+ /// <returns>A TestSuite</returns>
+ public TestSuite Build( TestPackage package )
+ {
+ bool autoNamespaceSuites = package.GetSetting( "AutoNamespaceSuites", true );
+ bool mergeAssemblies = package.GetSetting( "MergeAssemblies", false );
+
+ if ( package.IsSingleAssembly )
+ return BuildSingleAssembly( package );
+ string targetAssemblyName = null;
+ if( package.TestName != null && package.Assemblies.Contains( package.TestName ) )
+ {
+ targetAssemblyName = package.TestName;
+ package.TestName = null;
+ }
+
+ TestSuite rootSuite = new TestSuite( package.FullName );
+ NamespaceTreeBuilder namespaceTree =
+ new NamespaceTreeBuilder( rootSuite );
+
+ builders.Clear();
+ foreach(string assemblyName in package.Assemblies)
+ {
+ if ( targetAssemblyName == null || targetAssemblyName == assemblyName )
+ {
+ TestAssemblyBuilder builder = new TestAssemblyBuilder();
+ builders.Add( builder );
+
+ Test testAssembly = builder.Build( assemblyName, package.TestName, autoNamespaceSuites && !mergeAssemblies );
+
+ if ( testAssembly != null )
+ {
+ if (!mergeAssemblies)
+ {
+ rootSuite.Add(testAssembly);
+ }
+ else if (autoNamespaceSuites)
+ {
+ namespaceTree.Add(testAssembly.Tests);
+ rootSuite = namespaceTree.RootSuite;
+ }
+ else
+ {
+ foreach (Test test in testAssembly.Tests)
+ rootSuite.Add(test);
+ }
+ }
+ }
+ }
+
+ if ( rootSuite.Tests.Count == 0 )
+ return null;
+
+ return rootSuite;
+ }
+
+ private TestSuite BuildSingleAssembly( TestPackage package )
+ {
+ TestAssemblyBuilder builder = new TestAssemblyBuilder();
+ builders.Clear();
+ builders.Add( builder );
+
+ return (TestSuite)builder.Build(
+ package.FullName,
+ package.TestName, package.GetSetting( "AutoNamespaceSuites", true ) );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/TextCapture.cs b/mcs/nunit24/NUnitCore/core/TextCapture.cs
new file mode 100644
index 00000000000..705f8196e42
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/TextCapture.cs
@@ -0,0 +1,95 @@
+// ****************************************************************
+// Copyright 2008, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System.IO;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Abstract base for classes that capture text output
+ /// and redirect it to a TextWriter.
+ /// </summary>
+ public abstract class TextCapture
+ {
+ #region Private Fields
+ /// <summary>
+ /// True if capture is enabled
+ /// </summary>
+ private bool enabled;
+
+ /// <summary>
+ /// The TextWriter to which text is redirected
+ /// </summary>
+ private TextWriter writer;
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// The TextWriter to which text is redirected
+ /// </summary>
+ public TextWriter Writer
+ {
+ get { return writer; }
+ set
+ {
+ writer = value;
+
+ if (writer != null && enabled)
+ StartCapture();
+ }
+ }
+
+ /// <summary>
+ /// Controls whether text is captured or not
+ /// </summary>
+ public bool Enabled
+ {
+ get { return enabled; }
+ set
+ {
+ if (enabled != value)
+ {
+ if (writer != null && enabled)
+ StopCapture();
+
+ enabled = value;
+
+ if (writer != null && enabled && DefaultThreshold != "Off")
+ StartCapture();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns the default threshold value, which represents
+ /// the degree of verbosity of the output text stream.
+ /// Returns "None" in the base class. Derived classes that
+ /// support verbosity levels should override it.
+ /// </summary>
+ public virtual string DefaultThreshold
+ {
+ get { return "None"; }
+ }
+ #endregion
+
+ #region Abstract Members
+ /// <summary>
+ /// Override this to perform whatever actions are needed
+ /// to start capturing text and sending it to the Writer.
+ /// </summary>
+ protected abstract void StartCapture();
+
+ /// <summary>
+ /// Override this to perform whatever actions are needed
+ /// to flush remaining output and stop capturing text.
+ /// The Writer should not be changed, allowing capture
+ /// to be restarted at a future point.
+ /// </summary>
+ protected abstract void StopCapture();
+ #endregion
+ }
+
+}
diff --git a/mcs/nunit24/NUnitCore/core/ThreadedTestRunner.cs b/mcs/nunit24/NUnitCore/core/ThreadedTestRunner.cs
new file mode 100644
index 00000000000..45017f1e550
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/ThreadedTestRunner.cs
@@ -0,0 +1,74 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+namespace NUnit.Core
+{
+ using System;
+ using System.Threading;
+ using System.Collections.Specialized;
+
+ /// <summary>
+ /// ThreadedTestRunner overrides the Run and BeginRun methods
+ /// so that they are always run on a separate thread. The actual
+ /// </summary>
+ public class ThreadedTestRunner : ProxyTestRunner
+ {
+ #region Instance Variables
+ private TestRunnerThread testRunnerThread;
+ #endregion
+
+ #region Constructors
+ public ThreadedTestRunner( TestRunner testRunner ) : base ( testRunner ) { }
+ #endregion
+
+ #region Overrides
+ public override TestResult Run( EventListener listener )
+ {
+ BeginRun( listener );
+ return EndRun();
+ }
+
+ public override TestResult Run( EventListener listener, ITestFilter filter )
+ {
+ BeginRun( listener, filter );
+ return EndRun();
+ }
+
+ public override void BeginRun( EventListener listener )
+ {
+ testRunnerThread = new TestRunnerThread( this.TestRunner );
+
+ testRunnerThread.StartRun( listener );
+ }
+
+ public override void BeginRun( EventListener listener, ITestFilter filter )
+ {
+ testRunnerThread = new TestRunnerThread( this.TestRunner );
+
+ testRunnerThread.StartRun( listener, filter );
+ }
+
+ public override TestResult EndRun()
+ {
+ this.Wait();
+ return this.TestRunner.TestResult;
+ }
+
+
+ public override void Wait()
+ {
+ if ( testRunnerThread != null )
+ testRunnerThread.Wait();
+ }
+
+ public override void CancelRun()
+ {
+ if ( testRunnerThread != null )
+ testRunnerThread.Cancel();
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/core/nunit.core.build b/mcs/nunit24/NUnitCore/core/nunit.core.build
new file mode 100644
index 00000000000..1565628e88f
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/nunit.core.build
@@ -0,0 +1,89 @@
+<?xml version="1.0"?>
+<project name="NUnitCore" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.core.dll"
+ debug="${build.debug}"
+ define="${build.defines}">
+ <sources>
+ <include name="AbstractTestCaseDecoration.cs"/>
+ <include name="AssemblyInfo.cs"/>
+ <include name="AssemblyReader.cs"/>
+ <include name="AssemblyResolver.cs"/>
+ <include name="CoreExtensions.cs"/>
+ <include name="CultureDetector.cs"/>
+ <include name="DirectorySwapper.cs"/>
+ <include name="EventListenerTextWriter.cs"/>
+ <include name="EventPump.cs"/>
+ <include name="EventQueue.cs"/>
+ <include name="ExtensionHost.cs"/>
+ <include name="ExtensionPoint.cs"/>
+ <include name="IgnoreDecorator.cs"/>
+ <include name="InvalidSuiteException.cs"/>
+ <include name="InvalidTestFixtureException.cs"/>
+ <include name="LegacySuite.cs"/>
+ <include name="Log4NetCapture.cs"/>
+ <include name="LogCapture.cs"/>
+ <include name="NamespaceTreeBuilder.cs"/>
+ <include name="NoTestFixturesException.cs"/>
+ <include name="NotRunnableTestCase.cs"/>
+ <include name="NTrace.cs"/>
+ <include name="NullListener.cs"/>
+ <include name="NUnitException.cs"/>
+ <include name="NUnitFramework.cs"/>
+ <include name="NUnitTestFixture.cs"/>
+ <include name="NUnitTestMethod.cs"/>
+ <include name="PlatformHelper.cs"/>
+ <include name="ProxyTestRunner.cs"/>
+ <include name="QueuingEventListener.cs"/>
+ <include name="Reflect.cs"/>
+ <include name="RemoteTestRunner.cs"/>
+ <include name="SetUpFixture.cs"/>
+ <include name="SimpleTestRunner.cs"/>
+ <include name="StringTextWriter.cs"/>
+ <include name="SuiteBuilderAttribute.cs"/>
+ <include name="TestBuilderAttribute.cs"/>
+ <include name="TestCase.cs"/>
+ <include name="TestCaseBuilder.cs"/>
+ <include name="TestCaseBuilderAttribute.cs"/>
+ <include name="TestContext.cs"/>
+ <include name="TestDecoratorAttribute.cs"/>
+ <include name="TestFixture.cs"/>
+ <include name="TestFixtureBuilder.cs"/>
+ <include name="TestMethod.cs"/>
+ <include name="TestRunnerThread.cs"/>
+ <include name="TestSuite.cs"/>
+ <include name="TestSuiteBuilder.cs"/>
+ <include name="TextCapture.cs"/>
+ <include name="ThreadedTestRunner.cs"/>
+ <include name="Builders/AbstractFixtureBuilder.cs"/>
+ <include name="Builders/AbstractTestCaseBuilder.cs"/>
+ <include name="Builders/LegacySuiteBuilder.cs"/>
+ <include name="Builders/NUnitTestCaseBuilder.cs"/>
+ <include name="Builders/NUnitTestFixtureBuilder.cs"/>
+ <include name="Builders/SetUpFixtureBuilder.cs"/>
+ <include name="Builders/TestAssemblyBuilder.cs"/>
+ <include name="Extensibility/EventListenerCollection.cs"/>
+ <include name="Extensibility/FrameworkRegistry.cs"/>
+ <include name="Extensibility/SuiteBuilderCollection.cs"/>
+ <include name="Extensibility/TestCaseBuilderCollection.cs"/>
+ <include name="Extensibility/TestDecoratorCollection.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="618,1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.core.interfaces.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitCore/core">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/core/nunit.core.dll.csproj b/mcs/nunit24/NUnitCore/core/nunit.core.dll.csproj
new file mode 100644
index 00000000000..8b5adaac357
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/nunit.core.dll.csproj
@@ -0,0 +1,419 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.core"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Core"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "E:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "E:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "E:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.core.interfaces.dll"
+ Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AbstractTestCaseDecoration.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyReader.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyResolver.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CoreExtensions.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CultureDetector.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DirectorySwapper.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventListenerTextWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventPump.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventQueue.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExtensionHost.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExtensionPoint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IgnoreDecorator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidSuiteException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "InvalidTestFixtureException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LegacySuite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Log4NetCapture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "LogCapture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NamespaceTreeBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NoTestFixturesException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NotRunnableTestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NTrace.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NullListener.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitFramework.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitTestFixture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "NUnitTestMethod.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PlatformHelper.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ProxyTestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "QueuingEventListener.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Reflect.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RemoteTestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Results.xsd"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "Results.xsx"
+ DependentUpon = "Results.xsd"
+ BuildAction = "None"
+ />
+ <File
+ RelPath = "SetUpFixture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SimpleTestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StringTextWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SuiteBuilderAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Summary.xslt"
+ BuildAction = "Content"
+ />
+ <File
+ RelPath = "TestBuilderAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestCaseBuilderAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestContext.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestDecoratorAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFixture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFixtureBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestMethod.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestRunnerThread.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestSuite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestSuiteBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TextCapture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ThreadedTestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\AbstractFixtureBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\AbstractTestCaseBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\LegacySuiteBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\NUnitTestCaseBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\NUnitTestFixtureBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\SetUpFixtureBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Builders\TestAssemblyBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\EventListenerCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\FrameworkRegistry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\SuiteBuilderCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\TestCaseBuilderCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\TestDecoratorCollection.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitCore/core/nunit.core.dll.sources b/mcs/nunit24/NUnitCore/core/nunit.core.dll.sources
new file mode 100644
index 00000000000..d5389b72b6e
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/nunit.core.dll.sources
@@ -0,0 +1,64 @@
+../../CommonAssemblyInfo.cs
+AbstractTestCaseDecoration.cs
+AssemblyInfo.cs
+AssemblyReader.cs
+AssemblyResolver.cs
+Builders/AbstractFixtureBuilder.cs
+Builders/AbstractTestCaseBuilder.cs
+Builders/LegacySuiteBuilder.cs
+Builders/NUnitTestCaseBuilder.cs
+Builders/NUnitTestFixtureBuilder.cs
+Builders/SetUpFixtureBuilder.cs
+Builders/TestAssemblyBuilder.cs
+CoreExtensions.cs
+CultureDetector.cs
+DelegatingTestRunner.cs
+DirectorySwapper.cs
+EventListenerTextWriter.cs
+EventPump.cs
+EventQueue.cs
+Extensibility/EventListenerCollection.cs
+Extensibility/FrameworkRegistry.cs
+Extensibility/SuiteBuilderCollection.cs
+Extensibility/TestCaseBuilderCollection.cs
+Extensibility/TestDecoratorCollection.cs
+ExtensionHost.cs
+ExtensionPoint.cs
+IgnoreDecorator.cs
+InvalidSuiteException.cs
+InvalidTestFixtureException.cs
+LegacySuite.cs
+Log4NetCapture.cs
+LogCapture.cs
+NTrace.cs
+NUnitException.cs
+NUnitFramework.cs
+NUnitTestFixture.cs
+NUnitTestMethod.cs
+NamespaceTreeBuilder.cs
+NoTestFixturesException.cs
+NotRunnableTestCase.cs
+NullListener.cs
+PlatformHelper.cs
+ProxyTestRunner.cs
+QueuingEventListener.cs
+Reflect.cs
+RemoteTestRunner.cs
+SetUpFixture.cs
+SimpleTestRunner.cs
+StringTextWriter.cs
+SuiteBuilderAttribute.cs
+TestBuilderAttribute.cs
+TestCase.cs
+TestCaseBuilder.cs
+TestCaseBuilderAttribute.cs
+TestContext.cs
+TestDecoratorAttribute.cs
+TestFixture.cs
+TestFixtureBuilder.cs
+TestMethod.cs
+TestRunnerThread.cs
+TestSuite.cs
+TestSuiteBuilder.cs
+TextCapture.cs
+ThreadedTestRunner.cs
diff --git a/mcs/nunit24/NUnitCore/core/nunit.core.dll_VS2005.csproj b/mcs/nunit24/NUnitCore/core/nunit.core.dll_VS2005.csproj
new file mode 100644
index 00000000000..eee7a8c3e18
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/core/nunit.core.dll_VS2005.csproj
@@ -0,0 +1,221 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.core</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Core</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <SignAssembly>false</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <NoWarn>618,1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <NoWarn>618,1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="AbstractTestCaseDecoration.cs" />
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssemblyReader.cs" />
+ <Compile Include="AssemblyResolver.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="CoreExtensions.cs" />
+ <Compile Include="CultureDetector.cs" />
+ <Compile Include="ExtensionPoint.cs" />
+ <Compile Include="Log4NetCapture.cs" />
+ <Compile Include="LogCapture.cs" />
+ <Compile Include="NTrace.cs" />
+ <Compile Include="ProxyTestRunner.cs" />
+ <Compile Include="DirectorySwapper.cs" />
+ <Compile Include="EventListenerTextWriter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="EventPump.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="EventQueue.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Extensibility\EventListenerCollection.cs" />
+ <Compile Include="Extensibility\FrameworkRegistry.cs" />
+ <Compile Include="Extensibility\SuiteBuilderCollection.cs" />
+ <Compile Include="Extensibility\TestCaseBuilderCollection.cs" />
+ <Compile Include="Extensibility\TestDecoratorCollection.cs" />
+ <Compile Include="ExtensionHost.cs" />
+ <Compile Include="IgnoreDecorator.cs" />
+ <Compile Include="InvalidSuiteException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="InvalidTestFixtureException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="LegacySuite.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NamespaceTreeBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NoTestFixturesException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NotRunnableTestCase.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NullListener.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NUnitException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NUnitFramework.cs" />
+ <Compile Include="NUnitTestFixture.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="NUnitTestMethod.cs" />
+ <Compile Include="PlatformHelper.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="QueuingEventListener.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Reflect.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="RemoteTestRunner.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SetUpFixture.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SimpleTestRunner.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="StringTextWriter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SuiteBuilderAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestBuilderAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestCase.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestCaseBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestCaseBuilderAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestContext.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestDecoratorAttribute.cs" />
+ <Compile Include="TestFixture.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestFixtureBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestMethod.cs" />
+ <Compile Include="TestRunnerThread.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestSuite.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestSuiteBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TextCapture.cs" />
+ <Compile Include="ThreadedTestRunner.cs" />
+ <Compile Include="Builders\AbstractFixtureBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Builders\AbstractTestCaseBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Builders\LegacySuiteBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Builders\NUnitTestCaseBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Builders\NUnitTestFixtureBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Builders\SetUpFixtureBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Builders\TestAssemblyBuilder.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Content Include="Results.xsd">
+ <SubType>Designer</SubType>
+ </Content>
+ <Content Include="Summary.xslt" />
+ <None Include="Results.xsx">
+ <DependentUpon>Results.xsd</DependentUpon>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
+ <Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
+ <Name>nunit.core.interfaces.dll_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs b/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs
new file mode 100644
index 00000000000..fa86732b3d3
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitCore/interfaces/EventListener.cs b/mcs/nunit24/NUnitCore/interfaces/EventListener.cs
new file mode 100644
index 00000000000..a707a58cf39
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/EventListener.cs
@@ -0,0 +1,75 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+
+ /// <summary>
+ /// The EventListener interface is used within the NUnit core to receive
+ /// notifications of significant events while a test is being run. These
+ /// events are propogated to any client, which may choose to convert them
+ /// to .NET events or to use them directly.
+ /// </summary>
+ public interface EventListener
+ {
+ /// <summary>
+ /// Called when a test run is starting
+ /// </summary>
+ /// <param name="name">The name of the test being started</param>
+ /// <param name="testCount">The number of test cases under this test</param>
+ void RunStarted( string name, int testCount );
+
+ /// <summary>
+ /// Called when a run finishes normally
+ /// </summary>
+ /// <param name="result">The result of the test</param>
+ void RunFinished( TestResult result );
+
+ /// <summary>
+ /// Called when a run is terminated due to an exception
+ /// </summary>
+ /// <param name="exception">Exception that was thrown</param>
+ void RunFinished( Exception exception );
+
+ /// <summary>
+ /// Called when a test case is starting
+ /// </summary>
+ /// <param name="testName">The name of the test case</param>
+ void TestStarted(TestName testName);
+
+ /// <summary>
+ /// Called when a test case has finished
+ /// </summary>
+ /// <param name="result">The result of the test</param>
+ void TestFinished(TestCaseResult result);
+
+ /// <summary>
+ /// Called when a suite is starting
+ /// </summary>
+ /// <param name="testName">The name of the suite</param>
+ void SuiteStarted(TestName testName);
+
+ /// <summary>
+ /// Called when a suite has finished
+ /// </summary>
+ /// <param name="result">The result of the suite</param>
+ void SuiteFinished(TestSuiteResult result);
+
+ /// <summary>
+ /// Called when an unhandled exception is detected during
+ /// the execution of a test run.
+ /// </summary>
+ /// <param name="exception">The exception thta was detected</param>
+ void UnhandledException( Exception exception );
+
+ /// <summary>
+ /// Called when the test direts output to the console.
+ /// </summary>
+ /// <param name="testOutput">A console message</param>
+ void TestOutput(TestOutput testOutput);
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/Addin.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/Addin.cs
new file mode 100644
index 00000000000..db621a7f438
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/Addin.cs
@@ -0,0 +1,110 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The Addin class holds information about an addin.
+ /// </summary>
+ [Serializable]
+ public class Addin
+ {
+ #region Private Fields
+ private string typeName;
+ private string name;
+ private string description;
+ private ExtensionType extensionType;
+ private AddinStatus status;
+ private string message;
+ #endregion
+
+ #region Constructor
+ /// <summary>
+ /// Construct an Addin for a type.
+ /// </summary>
+ /// <param name="type">The type to be used</param>
+ public Addin( Type type )
+ {
+ this.typeName = type.AssemblyQualifiedName;
+
+ object[] attrs = type.GetCustomAttributes( typeof(NUnitAddinAttribute), false );
+ if ( attrs.Length == 1 )
+ {
+ NUnitAddinAttribute attr = (NUnitAddinAttribute)attrs[0];
+ this.name = attr.Name;
+ this.description = attr.Description;
+ this.extensionType = attr.Type;
+ }
+
+ if ( this.name == null )
+ this.name = type.Name;
+
+ if ( this.extensionType == 0 )
+ this.extensionType = ExtensionType.Core;
+
+ this.status = AddinStatus.Enabled;
+ }
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// The name of the Addin
+ /// </summary>
+ public string Name
+ {
+ get { return name; }
+ }
+
+ /// <summary>
+ /// Brief description of what the Addin does
+ /// </summary>
+ public string Description
+ {
+ get { return description; }
+ }
+
+ /// <summary>
+ /// The type or types of extension provided, using
+ /// one or more members of the ExtensionType enumeration.
+ /// </summary>
+ public ExtensionType ExtensionType
+ {
+ get { return extensionType; }
+ }
+
+ /// <summary>
+ /// The AssemblyQualifiedName of the type that implements
+ /// the addin.
+ /// </summary>
+ public string TypeName
+ {
+ get { return typeName; }
+ }
+
+ /// <summary>
+ /// The status of the addin
+ /// </summary>
+ public AddinStatus Status
+ {
+ get { return status; }
+ set { status = value; }
+ }
+
+ /// <summary>
+ /// Any message that clarifies the status of the Addin,
+ /// such as an error message or an explanation of why
+ /// the addin is disabled.
+ /// </summary>
+ public string Message
+ {
+ get { return message; }
+ set { message = value; }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/AddinStatus.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/AddinStatus.cs
new file mode 100644
index 00000000000..c47465126aa
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/AddinStatus.cs
@@ -0,0 +1,36 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The AddinStatus enum indicates the load status of an addin.
+ /// </summary>
+ public enum AddinStatus
+ {
+ /// <summary>
+ /// Not known - default
+ /// </summary>
+ Unknown,
+ /// <summary>
+ /// The addin is enabled but not loaded
+ /// </summary>
+ Enabled,
+ /// <summary>
+ /// The addin is disabled
+ /// </summary>
+ Disabled,
+ /// <summary>
+ /// The addin was loaded successfully
+ /// </summary>
+ Loaded,
+ /// <summary>
+ /// An error was encountered loading the addin
+ /// </summary>
+ Error
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/ExtensionType.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ExtensionType.cs
new file mode 100644
index 00000000000..d22b0644a23
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ExtensionType.cs
@@ -0,0 +1,35 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The ExtensionType enumeration is used to indicate the
+ /// kinds of extensions provided by an Addin. The addin
+ /// is only installed by hosts supporting one of its
+ /// extension types.
+ /// </summary>
+ [Flags]
+ public enum ExtensionType
+ {
+ /// <summary>
+ /// A Core extension is installed by the CoreExtensions
+ /// host in each test domain.
+ /// </summary>
+ Core=1,
+
+ /// <summary>
+ /// A Client extension is installed by all clients
+ /// </summary>
+ Client=2,
+
+ /// <summary>
+ /// A Gui extension is installed by the gui client
+ /// </summary>
+ Gui=4
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddin.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddin.cs
new file mode 100644
index 00000000000..ef6ab221e13
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddin.cs
@@ -0,0 +1,29 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// Add-ins are used to extend NUnti. All add-ins must
+ /// implement the IAddin interface.
+ /// </summary>
+ public interface IAddin
+ {
+ /// <summary>
+ /// When called, the add-in installs itself into
+ /// the host, if possible. Because NUnit uses separate
+ /// hosts for the client and test domain environments,
+ /// an add-in may be invited to istall itself more than
+ /// once. The add-in is responsible for checking which
+ /// extension points are supported by the host that is
+ /// passed to it and taking the appropriate action.
+ /// </summary>
+ /// <param name="host">The host in which to install the add-in</param>
+ /// <returns>True if the add-in was installed, otehrwise false</returns>
+ bool Install( IExtensionHost host );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinManager.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinManager.cs
new file mode 100644
index 00000000000..29772067462
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinManager.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ public interface IAddinManager
+ {
+ Addin[] Addins { get; }
+
+ TestFramework[] Frameworks { get; }
+ }
+
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinRegistry.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinRegistry.cs
new file mode 100644
index 00000000000..f05d2cecdd5
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IAddinRegistry.cs
@@ -0,0 +1,36 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The IAddinRegistry interface allows registering addins
+ /// and retrieving information about them. It is also used
+ /// to record the load status of an addin.
+ /// </summary>
+ public interface IAddinRegistry
+ {
+ /// <summary>
+ /// Gets a list of all addins as Addin objects
+ /// </summary>
+ System.Collections.IList Addins { get; }
+
+ /// <summary>
+ /// Registers an addin
+ /// </summary>
+ /// <param name="addin">The addin to be registered</param>
+ void Register( Addin addin );
+
+ /// <summary>
+ /// Sets the load status of an addin
+ /// </summary>
+ /// <param name="name">The name of the addin</param>
+ /// <param name="status">The status to be set</param>
+ /// <param name="message">An optional message explaining the status</param>
+ void SetStatus( string name, AddinStatus status, string message );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionHost.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionHost.cs
new file mode 100644
index 00000000000..f30f58f2d76
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionHost.cs
@@ -0,0 +1,46 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The IExtensionHost interface is implemented by each
+ /// of NUnit's Extension hosts. Currently, there is
+ /// only one host, which resides in the test domain.
+ /// </summary>
+ public interface IExtensionHost
+ {
+ /// <summary>
+ /// Get a list of the ExtensionPoints provided by this host.
+ /// </summary>
+ IExtensionPoint[] ExtensionPoints
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Get an interface to the framework registry
+ /// </summary>
+ IFrameworkRegistry FrameworkRegistry
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Return an extension point by name, if present
+ /// </summary>
+ /// <param name="name">The name of the extension point</param>
+ /// <returns>The extension point, if found, otherwise null</returns>
+ IExtensionPoint GetExtensionPoint( string name );
+
+ /// <summary>
+ /// Gets the ExtensionTypes supported by this host
+ /// </summary>
+ /// <returns>An enum indicating the ExtensionTypes supported</returns>
+ ExtensionType ExtensionTypes { get; }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionPoint.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionPoint.cs
new file mode 100644
index 00000000000..d10c0f88de1
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IExtensionPoint.cs
@@ -0,0 +1,42 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// Represents a single point of extension for NUnit. Some extension
+ /// points may accept only a single extension, while others may
+ /// accept more than one at the same time.
+ /// </summary>
+ public interface IExtensionPoint
+ {
+ /// <summary>
+ /// Get the name of this extension point
+ /// </summary>
+ string Name { get; }
+
+ /// <summary>
+ /// Get the host that provides this extension point
+ /// </summary>
+ IExtensionHost Host { get; }
+
+ /// <summary>
+ /// Install an extension at this extension point. If the
+ /// extension object does not meet the requirements for
+ /// this extension point, an exception is thrown.
+ /// </summary>
+ /// <param name="extension">The extension to install</param>
+ void Install( object extension );
+
+ /// <summary>
+ /// Removes an extension from this extension point. If the
+ /// extension object is not present, the method returns
+ /// without error.
+ /// <param name="extension"></param>
+ void Remove( object extension );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/IFrameworkRegistry.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IFrameworkRegistry.cs
new file mode 100644
index 00000000000..7d2945eb297
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/IFrameworkRegistry.cs
@@ -0,0 +1,23 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The IFrameworkRegistry allows extensions to register new
+ /// frameworks or emulations of other frameworks.
+ /// </summary>
+ public interface IFrameworkRegistry
+ {
+ /// <summary>
+ /// Register a framework
+ /// </summary>
+ /// <param name="frameworkName">The name of the framework</param>
+ /// <param name="assemblyName">The name of the assembly that the tests reference</param>
+ void Register( string frameworkName, string assemblyName );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/ISuiteBuilder.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ISuiteBuilder.cs
new file mode 100644
index 00000000000..3bbf7c14163
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ISuiteBuilder.cs
@@ -0,0 +1,37 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The ISuiteBuilder interface is exposed by a class that knows how to
+ /// build a suite from one or more Types.
+ /// </summary>
+ public interface ISuiteBuilder
+ {
+ /// <summary>
+ /// Examine the type and determine if it is suitable for
+ /// this builder to use in building a TestSuite.
+ ///
+ /// Note that returning false will cause the type to be ignored
+ /// in loading the tests. If it is desired to load the suite
+ /// but label it as non-runnable, ignored, etc., then this
+ /// method must return true.
+ /// </summary>
+ /// <param name="type">The type of the fixture to be used</param>
+ /// <returns>True if the type can be used to build a TestSuite</returns>
+ bool CanBuildFrom( Type type );
+
+ /// <summary>
+ /// Build a TestSuite from type provided.
+ /// </summary>
+ /// <param name="type">The type of the fixture to be used</param>
+ /// <returns>A TestSuite</returns>
+ Test BuildFrom( Type type );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestCaseBuilder.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestCaseBuilder.cs
new file mode 100644
index 00000000000..22ca86f8b01
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestCaseBuilder.cs
@@ -0,0 +1,39 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The ITestCaseBuilder interface is exposed by a class that knows how to
+ /// build a test case from certain methods.
+ /// </summary>
+ public interface ITestCaseBuilder
+ {
+ /// <summary>
+ /// Examine the method and determine if it is suitable for
+ /// this builder to use in building a TestCase.
+ ///
+ /// Note that returning false will cause the method to be ignored
+ /// in loading the tests. If it is desired to load the method
+ /// but label it as non-runnable, ignored, etc., then this
+ /// method must return true.
+ ///
+ /// Derived classes must override this method.
+ /// </summary>
+ /// <param name="method">The test method to examine</param>
+ /// <returns>True is the builder can use this method</returns>
+ bool CanBuildFrom( MethodInfo method );
+
+ /// <summary>
+ /// Build a TestCase from the provided MethodInfo.
+ /// </summary>
+ /// <param name="method">The method to be used as a test case</param>
+ /// <returns>A TestCase or null</returns>
+ Test BuildFrom( MethodInfo method );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestDecorator.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestDecorator.cs
new file mode 100644
index 00000000000..4b1933f9df2
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/ITestDecorator.cs
@@ -0,0 +1,26 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// The ITestDecorator interface is exposed by a class that knows how to
+ /// enhance the functionality of a test case or suite by decorating it.
+ /// </summary>
+ public interface ITestDecorator
+ {
+ /// <summary>
+ /// Examine the a Test and either return it as is, modify it
+ /// or return a different TestCase.
+ /// </summary>
+ /// <param name="test">The Test to be decorated</param>
+ /// <param name="member">The MethodInfo used to construct the test</param>
+ /// <returns>The resulting Test</returns>
+ Test Decorate( Test test, MemberInfo member );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/NUnitAddinAttribute.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/NUnitAddinAttribute.cs
new file mode 100644
index 00000000000..cf8c88c93da
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/NUnitAddinAttribute.cs
@@ -0,0 +1,40 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// NUnitAddinAttribute is used to mark all add-ins. The marked class
+ /// must implement the IAddin interface.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=false)]
+ public sealed class NUnitAddinAttribute : Attribute
+ {
+ /// <summary>
+ /// The name of this addin
+ /// </summary>
+ public string Name;
+
+ /// <summary>
+ /// A description for the addin
+ /// </summary>
+ public string Description;
+
+ /// <summary>
+ /// The type of extension provided
+ /// </summary>
+ public ExtensionType Type;
+
+ /// <summary>
+ /// Default Constructor
+ /// </summary>
+ public NUnitAddinAttribute()
+ {
+ this.Type = ExtensionType.Core;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Extensibility/TestFramework.cs b/mcs/nunit24/NUnitCore/interfaces/Extensibility/TestFramework.cs
new file mode 100644
index 00000000000..ccbeac13ef7
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Extensibility/TestFramework.cs
@@ -0,0 +1,42 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core.Extensibility
+{
+ /// <summary>
+ /// Summary description for TestFramework.
+ /// </summary>
+ [Serializable]
+ public class TestFramework
+ {
+ #region Instance Fields
+ /// <summary>
+ /// The name of the framework
+ /// </summary>
+ public string Name;
+
+ /// <summary>
+ /// The file name of the assembly that defines the framwork
+ /// </summary>
+ public string AssemblyName;
+ #endregion
+
+ #region Constructor
+ /// <summary>
+ /// Constructs a TestFramwork object given its name and assembly name.
+ /// </summary>
+ /// <param name="frameworkName"></param>
+ /// <param name="assemblyName"></param>
+ public TestFramework( string frameworkName, string assemblyName )
+ {
+ this.Name = frameworkName;
+ this.AssemblyName = assemblyName;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Filters/AndFilter.cs b/mcs/nunit24/NUnitCore/interfaces/Filters/AndFilter.cs
new file mode 100644
index 00000000000..d85d8c5c2c4
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Filters/AndFilter.cs
@@ -0,0 +1,82 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+
+namespace NUnit.Core.Filters
+{
+ /// <summary>
+ /// Combines multiple filters so that a test must pass all
+ /// of them in order to pass this filter.
+ /// </summary>
+ [Serializable]
+ public class AndFilter : TestFilter
+ {
+ private ArrayList filters = new ArrayList();
+
+ /// <summary>
+ /// Constructs an empty AndFilter
+ /// </summary>
+ public AndFilter() { }
+
+ /// <summary>
+ /// Constructs an AndFilter from an array of filters
+ /// </summary>
+ /// <param name="filters"></param>
+ public AndFilter( params ITestFilter[] filters )
+ {
+ this.filters.AddRange( filters );
+ }
+
+ /// <summary>
+ /// Adds a filter to the list of filters
+ /// </summary>
+ /// <param name="filter">The filter to be added</param>
+ public void Add( ITestFilter filter )
+ {
+ this.filters.Add( filter );
+ }
+
+ /// <summary>
+ /// Return an array of the composing filters
+ /// </summary>
+ public ITestFilter[] Filters
+ {
+ get
+ {
+ return (ITestFilter[])filters.ToArray(typeof(ITestFilter));
+ }
+ }
+
+ /// <summary>
+ /// Checks whether the AndFilter is matched by a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if all the component filters pass, otherwise false</returns>
+ public override bool Pass( ITest test )
+ {
+ foreach( ITestFilter filter in filters )
+ if ( !filter.Pass( test ) )
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Checks whether the AndFilter is matched by a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if all the component filters match, otherwise false</returns>
+ public override bool Match( ITest test )
+ {
+ foreach( ITestFilter filter in filters )
+ if ( !filter.Match( test ) )
+ return false;
+
+ return true;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Filters/CategoryFilter.cs b/mcs/nunit24/NUnitCore/interfaces/Filters/CategoryFilter.cs
new file mode 100644
index 00000000000..9131bb93ae0
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Filters/CategoryFilter.cs
@@ -0,0 +1,102 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Text;
+using System.Collections;
+
+namespace NUnit.Core.Filters
+{
+ /// <summary>
+ /// CategoryFilter is able to select or exclude tests
+ /// based on their categories.
+ /// </summary>
+ ///
+ [Serializable]
+ public class CategoryFilter : TestFilter
+ {
+ ArrayList categories;
+
+ /// <summary>
+ /// Construct an empty CategoryFilter
+ /// </summary>
+ public CategoryFilter()
+ {
+ categories = new ArrayList();
+ }
+
+ /// <summary>
+ /// Construct a CategoryFilter using a single category name
+ /// </summary>
+ /// <param name="name">A category name</param>
+ public CategoryFilter( string name )
+ {
+ categories = new ArrayList();
+ if ( name != null && name != string.Empty )
+ categories.Add( name );
+ }
+
+ /// <summary>
+ /// Construct a CategoryFilter using an array of category names
+ /// </summary>
+ /// <param name="names">An array of category names</param>
+ public CategoryFilter( string[] names )
+ {
+ categories = new ArrayList();
+ if ( names != null )
+ categories.AddRange( names );
+ }
+
+ /// <summary>
+ /// Add a category name to the filter
+ /// </summary>
+ /// <param name="name">A category name</param>
+ public void AddCategory(string name)
+ {
+ categories.Add( name );
+ }
+
+ /// <summary>
+ /// Check whether the filter matches a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns></returns>
+ public override bool Match(ITest test)
+ {
+ if ( test.Categories == null )
+ return false;
+
+ foreach( string cat in categories )
+ if ( test.Categories.Contains( cat ) )
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Return the string representation of a category filter
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ for( int i = 0; i < categories.Count; i++ )
+ {
+ if ( i > 0 ) sb.Append( ',' );
+ sb.Append( categories[i] );
+ }
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// Gets the list of categories from this filter
+ /// </summary>
+ public IList Categories
+ {
+ get { return categories; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Filters/NameFilter.cs b/mcs/nunit24/NUnitCore/interfaces/Filters/NameFilter.cs
new file mode 100644
index 00000000000..326517e1fb1
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Filters/NameFilter.cs
@@ -0,0 +1,58 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Core.Filters
+{
+ /// <summary>
+ /// Summary description for NameFilter.
+ /// </summary>
+ ///
+ [Serializable]
+ public class NameFilter : TestFilter
+ {
+ private ArrayList testNames = new ArrayList();
+
+ /// <summary>
+ /// Construct an empty NameFilter
+ /// </summary>
+ public NameFilter() { }
+
+ /// <summary>
+ /// Construct a NameFilter for a single TestName
+ /// </summary>
+ /// <param name="testName"></param>
+ public NameFilter( TestName testName )
+ {
+ testNames.Add( testName );
+ }
+
+ /// <summary>
+ /// Add a TestName to a NameFilter
+ /// </summary>
+ /// <param name="testName"></param>
+ public void Add( TestName testName )
+ {
+ testNames.Add( testName );
+ }
+
+ /// <summary>
+ /// Check if a test matches the filter
+ /// </summary>
+ /// <param name="test">The test to match</param>
+ /// <returns>True if it matches, false if not</returns>
+ public override bool Match( ITest test )
+ {
+ foreach( TestName testName in testNames )
+ if ( test.TestName == testName )
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Filters/NotFilter.cs b/mcs/nunit24/NUnitCore/interfaces/Filters/NotFilter.cs
new file mode 100644
index 00000000000..42af81b85c1
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Filters/NotFilter.cs
@@ -0,0 +1,64 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core.Filters
+{
+ /// <summary>
+ /// NotFilter negates the operation of another filter
+ /// </summary>
+ [Serializable]
+ public class NotFilter : TestFilter
+ {
+ ITestFilter baseFilter;
+
+ /// <summary>
+ /// Construct a not filter on another filter
+ /// </summary>
+ /// <param name="baseFilter">The filter to be negated</param>
+ public NotFilter( ITestFilter baseFilter)
+ {
+ this.baseFilter = baseFilter;
+ }
+
+ /// <summary>
+ /// Gets the base filter
+ /// </summary>
+ public ITestFilter BaseFilter
+ {
+ get { return baseFilter; }
+ }
+
+ /// <summary>
+ /// Check whether the filter matches a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if it matches, otherwise false</returns>
+ public override bool Match( ITest test )
+ {
+ return test.RunState != RunState.Explicit && !baseFilter.Pass( test );
+ }
+
+ /// <summary>
+ /// Determine whether any descendant of the test matches the filter criteria.
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if at least one descendant matches the filter criteria</returns>
+ protected override bool MatchDescendant(ITest test)
+ {
+ if (!test.IsSuite || test.Tests == null || test.RunState == RunState.Explicit)
+ return false;
+
+ foreach (ITest child in test.Tests)
+ {
+ if (Match(child) || MatchDescendant(child))
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Filters/OrFilter.cs b/mcs/nunit24/NUnitCore/interfaces/Filters/OrFilter.cs
new file mode 100644
index 00000000000..dc28008298b
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Filters/OrFilter.cs
@@ -0,0 +1,82 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+
+namespace NUnit.Core.Filters
+{
+ /// <summary>
+ /// Combines multiple filters so that a test must pass one
+ /// of them in order to pass this filter.
+ /// </summary>
+ [Serializable]
+ public class OrFilter : TestFilter
+ {
+ private ArrayList filters = new ArrayList();
+
+ /// <summary>
+ /// Constructs an empty OrFilter
+ /// </summary>
+ public OrFilter() { }
+
+ /// <summary>
+ /// Constructs an AndFilter from an array of filters
+ /// </summary>
+ /// <param name="filters"></param>
+ public OrFilter( params ITestFilter[] filters )
+ {
+ this.filters.AddRange( filters );
+ }
+
+ /// <summary>
+ /// Adds a filter to the list of filters
+ /// </summary>
+ /// <param name="filter">The filter to be added</param>
+ public void Add( ITestFilter filter )
+ {
+ this.filters.Add( filter );
+ }
+
+ /// <summary>
+ /// Return an array of the composing filters
+ /// </summary>
+ public ITestFilter[] Filters
+ {
+ get
+ {
+ return (ITestFilter[])filters.ToArray(typeof(ITestFilter));
+ }
+ }
+
+ /// <summary>
+ /// Checks whether the OrFilter is matched by a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if any of the component filters pass, otherwise false</returns>
+ public override bool Pass( ITest test )
+ {
+ foreach( ITestFilter filter in filters )
+ if ( filter.Pass( test ) )
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Checks whether the OrFilter is matched by a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if any of the component filters match, otherwise false</returns>
+ public override bool Match( ITest test )
+ {
+ foreach( ITestFilter filter in filters )
+ if ( filter.Match( test ) )
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Filters/SimpleNameFilter.cs b/mcs/nunit24/NUnitCore/interfaces/Filters/SimpleNameFilter.cs
new file mode 100644
index 00000000000..3104ca3686b
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Filters/SimpleNameFilter.cs
@@ -0,0 +1,57 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Text;
+
+namespace NUnit.Core.Filters
+{
+ /// <summary>
+ /// SimpleName filter selects tests based on their name
+ /// </summary>
+ [Serializable]
+ public class SimpleNameFilter : TestFilter
+ {
+ private ArrayList names = new ArrayList();
+
+ /// <summary>
+ /// Construct an empty SimpleNameFilter
+ /// </summary>
+ public SimpleNameFilter() { }
+
+ /// <summary>
+ /// Construct a SimpleNameFilter for a single name
+ /// </summary>
+ /// <param name="name">The name the filter will recognize</param>
+ public SimpleNameFilter( string name )
+ {
+ this.names.Add( name );
+ }
+
+ /// <summary>
+ /// Add a name to a SimpleNameFilter
+ /// </summary>
+ /// <param name="name">The name to be added</param>
+ public void Add( string name )
+ {
+ names.Add( name );
+ }
+
+ /// <summary>
+ /// Check whether the filter matches a test
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if it matches, otherwise false</returns>
+ public override bool Match( ITest test )
+ {
+ foreach( string name in names )
+ if ( test.TestName.FullName == name )
+ return true;
+
+ return false;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/IService.cs b/mcs/nunit24/NUnitCore/interfaces/IService.cs
new file mode 100644
index 00000000000..0a4541a1aea
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/IService.cs
@@ -0,0 +1,25 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// The IService interface is implemented by all Services.
+ /// </summary>
+ public interface IService
+ {
+ /// <summary>
+ /// Initialize the Service
+ /// </summary>
+ void InitializeService();
+
+ /// <summary>
+ /// Do any cleanup needed before terminating the service
+ /// </summary>
+ void UnloadService();
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/ITest.cs b/mcs/nunit24/NUnitCore/interfaces/ITest.cs
new file mode 100644
index 00000000000..6a4a5b22411
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/ITest.cs
@@ -0,0 +1,91 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System.Collections;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Common interface supported by all representations
+ /// of a test. Only includes informational fields.
+ /// The Run method is specifically excluded to allow
+ /// for data-only representations of a test.
+ /// </summary>
+ public interface ITest
+ {
+ #region Properties
+ /// <summary>
+ /// Gets the completely specified name of the test
+ /// encapsulated in a TestName object.
+ /// </summary>
+ TestName TestName { get; }
+
+ /// <summary>
+ /// Gets a string representing the type of test, e.g.: "Test Case"
+ /// </summary>
+ string TestType { get; }
+
+ /// <summary>
+ /// Indicates whether the test can be run using
+ /// the RunState enum.
+ /// </summary>
+ RunState RunState { get; set; }
+
+ /// <summary>
+ /// Reason for not running the test, if applicable
+ /// </summary>
+ string IgnoreReason { get; set; }
+
+ /// <summary>
+ /// Count of the test cases ( 1 if this is a test case )
+ /// </summary>
+ int TestCount { get; }
+
+ /// <summary>
+ /// Categories available for this test
+ /// </summary>
+ IList Categories { get; }
+
+ /// <summary>
+ /// Return the description field.
+ /// </summary>
+ string Description { get; set; }
+
+ /// <summary>
+ /// Return additional properties of the test
+ /// </summary>
+ IDictionary Properties { get; }
+
+ /// <summary>
+ /// True if this is a suite
+ /// </summary>
+ bool IsSuite { get; }
+
+ /// <summary>
+ /// Gets the parent test of this test
+ /// </summary>
+ ITest Parent { get; }
+
+ /// <summary>
+ /// For a test suite, the child tests or suites
+ /// Null if this is not a test suite
+ /// </summary>
+ IList Tests { get; }
+ #endregion
+
+ #region Methods
+ /// <summary>
+ /// Count the test cases that pass a filter. The
+ /// result should match those that would execute
+ /// when passing the same filter to Run.
+ /// </summary>
+ /// <param name="filter">The filter to apply</param>
+ /// <returns>The count of test cases</returns>
+ int CountTestCases(ITestFilter filter);
+ #endregion
+ }
+}
+
diff --git a/mcs/nunit24/NUnitCore/interfaces/ITestFilter.cs b/mcs/nunit24/NUnitCore/interfaces/ITestFilter.cs
new file mode 100644
index 00000000000..3faa4e7fc42
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/ITestFilter.cs
@@ -0,0 +1,39 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Interface to be implemented by filters applied to tests.
+ /// The filter applies when running the test, after it has been
+ /// loaded, since this is the only time an ITest exists.
+ /// </summary>
+ public interface ITestFilter
+ {
+ /// <summary>
+ /// Indicates whether this is the EmptyFilter
+ /// </summary>
+ bool IsEmpty { get; }
+
+ /// <summary>
+ /// Determine if a particular test passes the filter criteria. Pass
+ /// may examine the parents and/or descendants of a test, depending
+ /// on the semantics of the particular filter
+ /// </summary>
+ /// <param name="test">The test to which the filter is applied</param>
+ /// <returns>True if the test passes the filter, otherwise false</returns>
+ bool Pass( ITest test );
+
+ /// <summary>
+ /// Determine whether the test itself matches the filter criteria,
+ /// without examining either parents or descendants.
+ /// </summary>
+ /// <param name="test">The test to which the filter is applied</param>
+ /// <returns>True if the filter matches the any parent of the test</returns>
+ bool Match( ITest test );
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Makefile b/mcs/nunit24/NUnitCore/interfaces/Makefile
new file mode 100644
index 00000000000..d13d24d33c4
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Makefile
@@ -0,0 +1,27 @@
+thisdir = nunit24/NUnitCore/interfaces
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit.core.interfaces.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LOCAL_MCS_FLAGS= -debug -r:nunit.framework.dll -r:System.dll /d:StronglyNamedAssembly
+NO_TEST = yo
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+EXTRA_DISTFILES = nunit.core.dll.csproj nunit.core.dll_VS2005.csproj
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/NUnitCore/interfaces/ResultState.cs b/mcs/nunit24/NUnitCore/interfaces/ResultState.cs
new file mode 100644
index 00000000000..f84a729255e
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/ResultState.cs
@@ -0,0 +1,68 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// The ResultState enum indicates the result of running a test
+ /// </summary>
+ public enum ResultState
+ {
+ /// <summary>
+ /// The test succeeded
+ /// </summary>
+ Success,
+
+ /// <summary>
+ /// The test failed
+ /// </summary>
+ Failure,
+
+ /// <summary>
+ /// The test encountered an unexpected exception
+ /// </summary>
+ Error
+ }
+
+ /// <summary>
+ /// The FailureSite enum indicates the stage of a test
+ /// in which an error or failure occured.
+ /// </summary>
+ public enum FailureSite
+ {
+ /// <summary>
+ /// The location of the failure is not known
+ /// </summary>
+ Unknown,
+
+ /// <summary>
+ /// Failure in the test itself
+ /// </summary>
+ Test,
+
+ /// <summary>
+ /// Failure in the SetUp method
+ /// </summary>
+ SetUp,
+
+ /// <summary>
+ /// Failure in the TearDown method
+ /// </summary>
+ TearDown,
+
+ /// <summary>
+ /// Failure of a parent test
+ /// </summary>
+ Parent,
+
+ /// <summary>
+ /// Failure of a child test
+ /// </summary>
+ Child
+ }
+
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/ResultVisitor.cs b/mcs/nunit24/NUnitCore/interfaces/ResultVisitor.cs
new file mode 100644
index 00000000000..e2e00427ae8
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/ResultVisitor.cs
@@ -0,0 +1,27 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// The ResultVisitor interface implements the
+ /// Visitor pattern over TestResults
+ /// </summary>
+ public interface ResultVisitor
+ {
+ /// <summary>
+ /// Visit a TestCaseResult
+ /// </summary>
+ /// <param name="caseResult">The result to visit</param>
+ void Visit(TestCaseResult caseResult);
+
+ /// <summary>
+ /// Visit a TestSuiteResult
+ /// </summary>
+ /// <param name="suiteResult">The result to visit</param>
+ void Visit(TestSuiteResult suiteResult);
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/RunState.cs b/mcs/nunit24/NUnitCore/interfaces/RunState.cs
new file mode 100644
index 00000000000..0ac551bba6f
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/RunState.cs
@@ -0,0 +1,46 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// The RunState enum indicates whether a test
+ /// has been or can be executed.
+ /// </summary>
+ public enum RunState
+ {
+ /// <summary>
+ /// The test is not runnable
+ /// </summary>
+ NotRunnable,
+
+ /// <summary>
+ /// The test is runnable
+ /// </summary>
+ Runnable,
+
+ /// <summary>
+ /// The test can only be run explicitly
+ /// </summary>
+ Explicit,
+
+ /// <summary>
+ /// The test has been skipped
+ /// </summary>
+ Skipped,
+
+ /// <summary>
+ /// The test has been ignored
+ /// </summary>
+ Ignored,
+
+ /// <summary>
+ /// The test has been executed
+ /// </summary>
+ Executed
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/RuntimeFramework.cs b/mcs/nunit24/NUnitCore/interfaces/RuntimeFramework.cs
new file mode 100644
index 00000000000..2920feb8dd4
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/RuntimeFramework.cs
@@ -0,0 +1,97 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Enumeration identifying a common language
+ /// runtime implementation.
+ /// </summary>
+ public enum RuntimeType
+ {
+ /// <summary>Microsoft .NET Framework</summary>
+ Net,
+ /// <summary>Microsoft .NET Compact Framework</summary>
+ NetCF,
+ /// <summary>Microsoft Shared Source CLI</summary>
+ SSCLI,
+ /// <summary>Mono</summary>
+ Mono
+ }
+
+ /// <summary>
+ /// RuntimeFramework represents a particular version
+ /// of a common language runtime implementation.
+ /// </summary>
+ public sealed class RuntimeFramework
+ {
+ private RuntimeType runtime;
+ private Version version;
+
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ /// <param name="runtime">The runtime type of the framework</param>
+ /// <param name="version">The version of the framework</param>
+ public RuntimeFramework( RuntimeType runtime, Version version )
+ {
+ this.runtime = runtime;
+ this.version = version;
+ }
+
+ /// <summary>
+ /// Static method to return a RuntimeFramework object
+ /// for the frameowrk that is currently in use.
+ /// </summary>
+ public static RuntimeFramework CurrentFramework
+ {
+ get
+ {
+ RuntimeType runtime = Type.GetType( "Mono.Runtime", false ) != null
+ ? RuntimeType.Mono : RuntimeType.Net;
+
+ return new RuntimeFramework( runtime, Environment.Version );
+ }
+ }
+
+ /// <summary>
+ /// The type of this runtime framework
+ /// </summary>
+ public RuntimeType Runtime
+ {
+ get { return runtime; }
+ }
+
+ /// <summary>
+ /// The version of this runtime framework
+ /// </summary>
+ public Version Version
+ {
+ get { return version; }
+ }
+
+ /// <summary>
+ /// Gets a display string for the particular framework version
+ /// </summary>
+ /// <returns>A string used to display the framework in use</returns>
+ public string GetDisplayName()
+ {
+ if ( runtime == RuntimeType.Mono )
+ {
+ Type monoRuntimeType = Type.GetType( "Mono.Runtime", false );
+ MethodInfo getDisplayNameMethod = monoRuntimeType.GetMethod(
+ "GetDisplayName", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding );
+ if ( getDisplayNameMethod != null )
+ return (string)getDisplayNameMethod.Invoke( null, new object[0] );
+ }
+
+ return runtime.ToString() + " " + Version.ToString();
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/Test.cs b/mcs/nunit24/NUnitCore/interfaces/Test.cs
new file mode 100644
index 00000000000..071b19c8d07
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/Test.cs
@@ -0,0 +1,330 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Collections;
+ using System.Collections.Specialized;
+ using System.Reflection;
+
+ /// <summary>
+ /// Test Class.
+ /// </summary>
+ public abstract class Test : ITest, IComparable
+ {
+ #region Fields
+ /// <summary>
+ /// TestName that identifies this test
+ /// </summary>
+ private TestName testName;
+
+ /// <summary>
+ /// Indicates whether the test should be executed
+ /// </summary>
+ private RunState runState;
+
+ /// <summary>
+ /// The reason for not running the test
+ /// </summary>
+ private string ignoreReason;
+
+ /// <summary>
+ /// Description for this test
+ /// </summary>
+ private string description;
+
+ /// <summary>
+ /// Test suite containing this test, or null
+ /// </summary>
+ private Test parent;
+
+ /// <summary>
+ /// List of categories applying to this test
+ /// </summary>
+ private IList categories;
+
+ /// <summary>
+ /// A dictionary of properties, used to add information
+ /// to tests without requiring the class to change.
+ /// </summary>
+ private IDictionary properties;
+
+ /// <summary>
+ /// The System.Type of the fixture for this test suite, if there is one
+ /// </summary>
+ private Type fixtureType;
+
+ /// <summary>
+ /// The fixture object, if it has been created
+ /// </summary>
+ private object fixture;
+
+ #endregion
+
+ #region Construction
+
+ /// <summary>
+ /// Constructs a test given its name
+ /// </summary>
+ /// <param name="name">The name of the test</param>
+ protected Test( string name )
+ {
+ this.testName = new TestName();
+ this.testName.FullName = name;
+ this.testName.Name = name;
+ this.testName.TestID = new TestID();
+
+ this.runState = RunState.Runnable;
+ }
+
+ /// <summary>
+ /// Constructs a test given the path through the
+ /// test hierarchy to its parent and a name.
+ /// </summary>
+ /// <param name="pathName">The parent tests full name</param>
+ /// <param name="name">The name of the test</param>
+ protected Test( string pathName, string name )
+ {
+ this.testName = new TestName();
+ this.testName.FullName = pathName == null || pathName == string.Empty
+ ? name : pathName + "." + name;
+ this.testName.Name = name;
+ this.testName.TestID = new TestID();
+
+ this.runState = RunState.Runnable;
+ }
+
+ /// <summary>
+ /// Constructs a test given a TestName object
+ /// </summary>
+ /// <param name="testName">The TestName for this test</param>
+ protected Test( TestName testName )
+ {
+ this.testName = testName;
+
+ this.runState = RunState.Runnable;
+ }
+
+ /// <summary>
+ /// Constructs a test given a fixture type
+ /// </summary>
+ /// <param name="fixtureType">The type to use in constructiong the test</param>
+ protected Test( Type fixtureType )
+ {
+ this.testName = new TestName();
+ this.testName.FullName = fixtureType.FullName;
+ this.testName.Name = fixtureType.Namespace != null
+ ? TestName.FullName.Substring( TestName.FullName.LastIndexOf( '.' ) + 1 )
+ : fixtureType.FullName;
+ this.testName.TestID = new TestID();
+
+ this.fixtureType = fixtureType;
+ this.RunState = RunState.Runnable;
+ }
+
+ /// <summary>
+ /// Construct a test given a MethodInfo
+ /// </summary>
+ /// <param name="method">The method to be used</param>
+ protected Test( MethodInfo method )
+ : this( method.ReflectedType )
+ {
+ this.testName.Name = method.DeclaringType == method.ReflectedType
+ ? method.Name : method.DeclaringType.Name + "." + method.Name;
+ this.testName.FullName = method.ReflectedType.FullName + "." + method.Name;
+ }
+
+ /// <summary>
+ /// Sets the runner id of a test and optionally its children
+ /// </summary>
+ /// <param name="runnerID">The runner id to be used</param>
+ /// <param name="recursive">True if all children should get the same id</param>
+ public void SetRunnerID( int runnerID, bool recursive )
+ {
+ this.testName.RunnerID = runnerID;
+
+ if ( recursive && this.Tests != null )
+ foreach( Test child in this.Tests )
+ child.SetRunnerID( runnerID, true );
+ }
+
+ #endregion
+
+ #region ITest Members
+
+ #region Properties
+ /// <summary>
+ /// Gets the TestName of the test
+ /// </summary>
+ public TestName TestName
+ {
+ get { return testName; }
+ }
+
+ /// <summary>
+ /// Gets a string representing the kind of test
+ /// that this object represents, for use in display.
+ /// </summary>
+ public abstract string TestType { get; }
+
+ /// <summary>
+ /// Whether or not the test should be run
+ /// </summary>
+ public RunState RunState
+ {
+ get { return runState; }
+ set { runState = value; }
+ }
+
+ /// <summary>
+ /// Reason for not running the test, if applicable
+ /// </summary>
+ public string IgnoreReason
+ {
+ get { return ignoreReason; }
+ set { ignoreReason = value; }
+ }
+
+ /// <summary>
+ /// Gets a count of test cases represented by
+ /// or contained under this test.
+ /// </summary>
+ public virtual int TestCount
+ {
+ get { return 1; }
+ }
+
+ /// <summary>
+ /// Gets a list of categories associated with this test.
+ /// </summary>
+ public IList Categories
+ {
+ get { return categories; }
+ set { categories = value; }
+ }
+
+ /// <summary>
+ /// Gets a desctiption associated with this test.
+ /// </summary>
+ public String Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+
+ /// <summary>
+ /// Gets the property dictionary for this test
+ /// </summary>
+ public IDictionary Properties
+ {
+ get
+ {
+ if ( properties == null )
+ properties = new ListDictionary();
+
+ return properties;
+ }
+ set
+ {
+ properties = value;
+ }
+ }
+
+ /// <summary>
+ /// Indicates whether this test is a suite
+ /// </summary>
+ public abstract bool IsSuite { get; }
+
+ /// <summary>
+ /// Gets the parent test of this test
+ /// </summary>
+ ITest ITest.Parent
+ {
+ get { return parent; }
+ }
+
+ /// <summary>
+ /// Gets the parent as a Test object.
+ /// Used by the core to set the parent.
+ /// </summary>
+ public Test Parent
+ {
+ get { return parent; }
+ set { parent = value; }
+ }
+
+ /// <summary>
+ /// Gets this test's child tests
+ /// </summary>
+ public abstract IList Tests { get; }
+
+ /// <summary>
+ /// Gets the Type of the fixture used in running this test
+ /// </summary>
+ public Type FixtureType
+ {
+ get { return fixtureType; }
+ }
+
+ /// <summary>
+ /// Gets or sets a fixture object for running this test
+ /// </summary>
+ public object Fixture
+ {
+ get { return fixture; }
+ set { fixture = value; }
+ }
+ #endregion
+
+ #region Methods
+ /// <summary>
+ /// Gets a count of test cases that would be run using
+ /// the specified filter.
+ /// </summary>
+ /// <param name="filter"></param>
+ /// <returns></returns>
+ public abstract int CountTestCases(ITestFilter filter);
+ #endregion
+
+ #endregion
+
+ #region Abstract Run Methods
+ /// <summary>
+ /// Runs the test, sending notifications to a listener.
+ /// </summary>
+ /// <param name="listener">An event listener to receive notifications</param>
+ /// <returns>A TestResult</returns>
+ public abstract TestResult Run(EventListener listener);
+
+ /// <summary>
+ /// Runs the test under a particular filter, sending
+ /// notifications to a listener.
+ /// </summary>
+ /// <param name="listener">An event listener to receive notifications</param>
+ /// <param name="filter">A filter used in running the test</param>
+ /// <returns></returns>
+ public abstract TestResult Run(EventListener listener, ITestFilter filter);
+ #endregion
+
+ #region IComparable Members
+ /// <summary>
+ /// Compares this test to another test for sorting purposes
+ /// </summary>
+ /// <param name="obj">The other test</param>
+ /// <returns>Value of -1, 0 or +1 depending on whether the current test is less than, equal to or greater than the other test</returns>
+ public int CompareTo(object obj)
+ {
+ Test other = obj as Test;
+
+ if ( other == null )
+ return -1;
+
+ return this.TestName.FullName.CompareTo( other.TestName.FullName );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestAssemblyInfo.cs b/mcs/nunit24/NUnitCore/interfaces/TestAssemblyInfo.cs
new file mode 100644
index 00000000000..fbd7234af3c
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestAssemblyInfo.cs
@@ -0,0 +1,61 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Reflection;
+using System.IO;
+using System.Text;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestAssemblyInfo holds information about a loaded test assembly
+ /// </summary>
+ [Serializable]
+ public class TestAssemblyInfo
+ {
+ private string assemblyName;
+ private Version runtimeVersion;
+ private IList testFrameworks;
+
+ /// <summary>
+ /// Constructs a TestAssemblyInfo
+ /// </summary>
+ /// <param name="assemblyName">The name of the assembly</param>
+ /// <param name="runtimeVersion">The version of the runtime for which the assembly was built</param>
+ /// <param name="testFrameworks">A list of test framework useds by the assembly</param>
+ public TestAssemblyInfo( string assemblyName, Version runtimeVersion, IList testFrameworks )
+ {
+ this.assemblyName = assemblyName;
+ this.runtimeVersion = runtimeVersion;
+ this.testFrameworks = testFrameworks;
+ }
+
+ /// <summary>
+ /// Gets the name of the assembly
+ /// </summary>
+ public string Name
+ {
+ get { return assemblyName; }
+ }
+
+ /// <summary>
+ /// Gets the runtime version for which the assembly was built
+ /// </summary>
+ public Version RuntimeVersion
+ {
+ get { return runtimeVersion; }
+ }
+
+ /// <summary>
+ /// Gets a list of testframeworks referenced by the assembly
+ /// </summary>
+ public IList TestFrameworks
+ {
+ get { return testFrameworks; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestCaseResult.cs b/mcs/nunit24/NUnitCore/interfaces/TestCaseResult.cs
new file mode 100644
index 00000000000..1aa183f3084
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestCaseResult.cs
@@ -0,0 +1,41 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Text;
+
+ /// <summary>
+ /// TestCaseResult represents the result of a test case execution
+ /// </summary>
+ [Serializable]
+ public class TestCaseResult : TestResult
+ {
+ /// <summary>
+ /// Construct a result for a test case
+ /// </summary>
+ /// <param name="testCase">The test case for which this is a result</param>
+ public TestCaseResult(TestInfo testCase)
+ : base(testCase, testCase.TestName.FullName) { }
+
+ /// <summary>
+ /// Construct a result from a string - used for tests
+ /// </summary>
+ /// <param name="testCaseString"></param>
+ public TestCaseResult(string testCaseString)
+ : base(null, testCaseString) { }
+
+ /// <summary>
+ /// Accept a ResultVisitor
+ /// </summary>
+ /// <param name="visitor">The visitor to accept</param>
+ public override void Accept(ResultVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestFilter.cs b/mcs/nunit24/NUnitCore/interfaces/TestFilter.cs
new file mode 100644
index 00000000000..0500ec471fd
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestFilter.cs
@@ -0,0 +1,102 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// Interface to be implemented by filters applied to tests.
+ /// The filter applies when running the test, after it has been
+ /// loaded, since this is the only time an ITest exists.
+ /// </summary>
+ [Serializable]
+ public abstract class TestFilter : ITestFilter
+ {
+ /// <summary>
+ /// Unique Empty filter.
+ /// </summary>
+ public static TestFilter Empty = new EmptyFilter();
+
+ /// <summary>
+ /// Indicates whether this is the EmptyFilter
+ /// </summary>
+ public bool IsEmpty
+ {
+ get { return this is TestFilter.EmptyFilter; }
+ }
+
+ /// <summary>
+ /// Determine if a particular test passes the filter criteria. The default
+ /// implementation checks the test itself, its parents and any descendants.
+ ///
+ /// Derived classes may override this method or any of the Match methods
+ /// to change the behavior of the filter.
+ /// </summary>
+ /// <param name="test">The test to which the filter is applied</param>
+ /// <returns>True if the test passes the filter, otherwise false</returns>
+ public virtual bool Pass( ITest test )
+ {
+ return Match(test) || MatchParent(test) || MatchDescendant(test);
+ }
+
+ /// <summary>
+ /// Determine whether the test itself matches the filter criteria, without
+ /// examining either parents or descendants.
+ /// </summary>
+ /// <param name="test">The test to which the filter is applied</param>
+ /// <returns>True if the filter matches the any parent of the test</returns>
+ public abstract bool Match(ITest test);
+
+ /// <summary>
+ /// Determine whether any ancestor of the test mateches the filter criteria
+ /// </summary>
+ /// <param name="test">The test to which the filter is applied</param>
+ /// <returns>True if the filter matches the an ancestor of the test</returns>
+ protected virtual bool MatchParent(ITest test)
+ {
+ return (test.RunState != RunState.Explicit && test.Parent != null &&
+ ( Match(test.Parent) || MatchParent(test.Parent)) );
+ }
+
+ /// <summary>
+ /// Determine whether any descendant of the test matches the filter criteria.
+ /// </summary>
+ /// <param name="test">The test to be matched</param>
+ /// <returns>True if at least one descendant matches the filter criteria</returns>
+ protected virtual bool MatchDescendant(ITest test)
+ {
+ if (!test.IsSuite || test.Tests == null)
+ return false;
+
+ foreach (ITest child in test.Tests)
+ {
+ if (Match(child) || MatchDescendant(child))
+ return true;
+ }
+
+ return false;
+ }
+
+ /// <summary>
+ /// Nested class provides an empty filter - one that always
+ /// returns true when called, unless the test is marked explicit.
+ /// </summary>
+ [Serializable]
+ private class EmptyFilter : TestFilter
+ {
+ public override bool Match( ITest test )
+ {
+ return test.RunState != RunState.Explicit;
+ }
+
+ public override bool Pass( ITest test )
+ {
+ return test.RunState != RunState.Explicit;
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestID.cs b/mcs/nunit24/NUnitCore/interfaces/TestID.cs
new file mode 100644
index 00000000000..d7c9d5e11ce
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestID.cs
@@ -0,0 +1,144 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestID encapsulates a unique identifier for tests. As
+ /// currently implemented, this is an integer and is unique
+ /// within the AppDomain. TestID is one component of a
+ /// TestName. We use this object, rather than a raw int,
+ /// for two reasons: (1) to hide the implementation so
+ /// it may be changed later if necessary and (2) so that the
+ /// id may be null in a "weak" TestName.
+ /// </summary>
+ [Serializable]
+ public class TestID : ICloneable
+ {
+ #region Fields
+ /// <summary>
+ /// The int key that distinguishes this test from all others created
+ /// by the same runner.
+ /// </summary>
+ private int id;
+
+ /// <summary>
+ /// Static value to seed ids. It's started at 1000 so any
+ /// uninitialized ids will stand out.
+ /// </summary>
+ private static int nextID = 1000;
+
+ #endregion
+
+ #region Construction
+ /// <summary>
+ /// Construct a new TestID
+ /// </summary>
+ public TestID()
+ {
+ this.id = unchecked( nextID++ );
+ }
+
+ /// <summary>
+ /// Construct a TestID with a given value.
+ /// Used in parsing test names and in order
+ /// to construct an artificial test node for
+ /// aggregating multiple test runners.
+ /// </summary>
+ /// <param name="id"></param>
+ public TestID( int id )
+ {
+ this.id = id;
+ }
+ #endregion
+
+ #region Static Methods
+ /// <summary>
+ /// Parse a TestID from it's string representation
+ /// </summary>
+ /// <param name="s"></param>
+ /// <returns></returns>
+ public static TestID Parse( string s )
+ {
+ int id = Int32.Parse( s );
+ return new TestID( id );
+ }
+ #endregion
+
+ #region Object Overrides
+ /// <summary>
+ /// Override of Equals method to allow comparison of TestIDs
+ /// </summary>
+ /// <param name="obj"></param>
+ /// <returns></returns>
+ public override bool Equals(object obj)
+ {
+ TestID other = obj as TestID;
+ if ( other != null )
+ return this.id == other.id;
+
+ return base.Equals (obj);
+ }
+
+ /// <summary>
+ /// Override of GetHashCode for TestIDs
+ /// </summary>
+ /// <returns></returns>
+ public override int GetHashCode()
+ {
+ return id.GetHashCode();
+ }
+
+ /// <summary>
+ /// Override ToString() to display the int id
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ return id.ToString();
+ }
+ #endregion
+
+ #region Operator Overrides
+ /// <summary>
+ /// Operator == override
+ /// </summary>
+ /// <param name="id1"></param>
+ /// <param name="id2"></param>
+ /// <returns></returns>
+ public static bool operator ==( TestID id1, TestID id2 )
+ {
+ if ( Object.Equals( id1, null ) )
+ return Object.Equals( id2, null );
+
+ return id1.Equals( id2 );
+ }
+
+ /// <summary>
+ /// Operator != override
+ /// </summary>
+ /// <param name="id1"></param>
+ /// <param name="id2"></param>
+ /// <returns></returns>
+ public static bool operator !=( TestID id1, TestID id2 )
+ {
+ return id1 == id2 ? false : true;
+ }
+ #endregion
+
+ #region ICloneable Implementation
+ /// <summary>
+ /// Clone this TestID
+ /// </summary>
+ /// <returns>An identical TestID</returns>
+ public object Clone()
+ {
+ return this.MemberwiseClone();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestInfo.cs b/mcs/nunit24/NUnitCore/interfaces/TestInfo.cs
new file mode 100644
index 00000000000..b5a480cfc08
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestInfo.cs
@@ -0,0 +1,249 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestInfo holds common info about a test. It represents only
+ /// a single test or a suite and contains no references to other
+ /// tests. Since it is informational only, it can easily be passed
+ /// around using .Net remoting.
+ ///
+ /// TestInfo is used directly in all EventListener events and in
+ /// TestResults. It contains an ID, which can be used by a
+ /// runner to locate the actual test.
+ ///
+ /// TestInfo also serves as the base class for TestNode, which
+ /// adds hierarchical information and is used in client code to
+ /// maintain a visible image of the structure of the tests.
+ /// </summary>
+ [Serializable]
+ public class TestInfo : ITest
+ {
+ #region Instance Variables
+ /// <summary>
+ /// TestName that identifies this test
+ /// </summary>
+ private TestName testName;
+
+ private string testType;
+
+ private RunState runState;
+
+ /// <summary>
+ /// Reason for not running the test
+ /// </summary>
+ private string ignoreReason;
+
+ /// <summary>
+ /// Number of test cases in this test or suite
+ /// </summary>
+ private int testCaseCount;
+
+ /// <summary>
+ /// True if this is a suite
+ /// </summary>
+ private bool isSuite;
+
+ /// <summary>
+ /// The test description
+ /// </summary>
+ private string description;
+
+ /// <summary>
+ /// A list of all the categories assigned to a test
+ /// </summary>
+ private ArrayList categories = new ArrayList();
+
+ /// <summary>
+ /// A dictionary of properties, used to add information
+ /// to tests without requiring the class to change.
+ /// </summary>
+ private ListDictionary properties = new ListDictionary();
+
+ #endregion
+
+ #region Constructors
+ /// <summary>
+ /// Construct from an ITest
+ /// </summary>
+ /// <param name="test">Test from which a TestNode is to be constructed</param>
+ public TestInfo( ITest test )
+ {
+ this.testName = (TestName)test.TestName.Clone();
+ this.testType = test.TestType;
+
+ this.runState = test.RunState;
+ this.ignoreReason = test.IgnoreReason;
+ this.description = test.Description;
+ this.isSuite = test.IsSuite;
+
+ if (test.Categories != null)
+ this.categories.AddRange(test.Categories);
+ if (test.Properties != null)
+ {
+ this.properties = new ListDictionary();
+ foreach( DictionaryEntry entry in test.Properties )
+ this.properties.Add( entry.Key, entry.Value );
+ }
+
+ this.testCaseCount = test.TestCount;
+ }
+
+ /// <summary>
+ /// Construct as a parent to multiple tests.
+ /// </summary>
+ /// <param name="testName">The name to use for the new test</param>
+ /// <param name="tests">An array of child tests</param>
+ public TestInfo( TestName testName, ITest[] tests )
+ {
+ this.testName = testName;
+ this.testType = "Test Project";
+
+ this.runState = RunState.Runnable;
+ this.ignoreReason = null;
+ this.description = null;
+ this.isSuite = true;
+
+ foreach( ITest test in tests )
+ {
+ this.testCaseCount += test.TestCount;
+ }
+ }
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Gets the completely specified name of the test
+ /// encapsulated in a TestName object.
+ /// </summary>
+ public TestName TestName
+ {
+ get { return testName; }
+ }
+
+ /// <summary>
+ /// Gets a string representing the kind of test this
+ /// object represents for display purposes.
+ /// </summary>
+ public string TestType
+ {
+ get { return testType; }
+ }
+
+ /// <summary>
+ /// The test description
+ /// </summary>
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+
+ /// <summary>
+ /// Gets the RunState for this test
+ /// </summary>
+ public RunState RunState
+ {
+ get { return runState; }
+ set { runState = value; }
+ }
+
+ /// <summary>
+ /// The reason for ignoring a test
+ /// </summary>
+ public string IgnoreReason
+ {
+ get { return ignoreReason; }
+ set { ignoreReason = value; }
+ }
+
+ /// <summary>
+ /// Count of test cases in this test.
+ /// </summary>
+ public int TestCount
+ {
+ get { return testCaseCount; }
+ }
+
+ /// <summary>
+ /// Gets the parent test of this test
+ /// </summary>
+ public virtual ITest Parent
+ {
+ get { return null; }
+ }
+
+ /// <summary>
+ /// Gets a list of the categories applied to this test
+ /// </summary>
+ public IList Categories
+ {
+ get { return categories; }
+ }
+
+ /// <summary>
+ /// Gets a list of any child tests
+ /// </summary>
+ public virtual IList Tests
+ {
+ get { return null; }
+ }
+
+ /// <summary>
+ /// True if this is a suite, false if a test case
+ /// </summary>
+ public bool IsSuite
+ {
+ get { return isSuite; }
+ }
+
+ /// <summary>
+ /// Gets the Properties dictionary for this test
+ /// </summary>
+ public IDictionary Properties
+ {
+ get
+ {
+ if ( properties == null )
+ properties = new ListDictionary();
+
+ return properties;
+ }
+ }
+ #endregion
+
+ #region Methods
+ /// <summary>
+ /// Counts the test cases that would be run if this
+ /// test were executed using the provided filter.
+ /// </summary>
+ /// <param name="filter">The filter to apply</param>
+ /// <returns>A count of test cases</returns>
+ public virtual int CountTestCases(ITestFilter filter)
+ {
+ if (filter.IsEmpty)
+ return TestCount;
+
+ if (!isSuite)
+ return filter.Pass(this) ? 1 : 0;
+
+ int count = 0;
+ if (filter.Pass(this))
+ {
+ foreach (ITest test in Tests)
+ {
+ count += test.CountTestCases(filter);
+ }
+ }
+ return count;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestName.cs b/mcs/nunit24/NUnitCore/interfaces/TestName.cs
new file mode 100644
index 00000000000..ef51ae94124
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestName.cs
@@ -0,0 +1,204 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestName encapsulates all info needed to identify and
+ /// locate a test that has been loaded by a runner. It consists
+ /// of a three components: the simple name of the test, an int
+ /// id that is unique to a given tree of tests and an int
+ /// runner id that identifies the particular runner that
+ /// holds the test instance.
+ /// </summary>
+ [Serializable]
+ public class TestName : ICloneable
+ {
+ #region Fields
+ /// <summary>
+ /// ID that uniquely identifies the test
+ /// </summary>
+ private TestID testID;
+
+ private int runnerID;
+
+ /// <summary>
+ /// The simple name of the test, without qualification
+ /// </summary>
+ private string name;
+
+ /// <summary>
+ /// The fully qualified name of the test
+ /// </summary>
+ private string fullName;
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Gets or sets the TestID that uniquely identifies this test
+ /// </summary>
+ public TestID TestID
+ {
+ get { return testID; }
+ set { testID = value; }
+ }
+
+ /// <summary>
+ /// Gets the ID for the runner that created the test from
+ /// the TestID, or returns -1 if the TestID is null.
+ /// </summary>
+ public int RunnerID
+ {
+ get { return runnerID; }
+ set { runnerID = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the simple name of the test
+ /// </summary>
+ public string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the full (qualified) name of the test
+ /// </summary>
+ public string FullName
+ {
+ get { return fullName; }
+ set { fullName = value; }
+ }
+
+ /// <summary>
+ /// Get the string representation of this test name, incorporating all
+ /// the components of the name.
+ /// </summary>
+ public string UniqueName
+ {
+ get
+ {
+ if ( this.testID == null )
+ return string.Format( "[{0}]{1}", this.runnerID, this.fullName );
+ else
+ return string.Format( "[{0}-{1}]{2}", this.RunnerID, this.testID, this.fullName );
+ }
+ }
+ #endregion
+
+ #region Static Methods
+ /// <summary>
+ /// Parse a string representation of a TestName,
+ /// returning a TestName.
+ /// </summary>
+ /// <param name="s">The string to parse</param>
+ /// <returns>A TestName</returns>
+ public static TestName Parse( string s )
+ {
+ if ( s == null ) throw new ArgumentNullException( "s", "Cannot parse a null string" );
+
+ TestName testName = new TestName();
+ testName.FullName = testName.Name = s;
+
+ if ( s.StartsWith( "[" ) )
+ {
+ int rbrack = s.IndexOf( "]" );
+ if ( rbrack < 0 || rbrack == s.Length - 1 )
+ throw new FormatException( "Invalid TestName format: " + s );
+
+ testName.FullName = testName.Name = s.Substring( rbrack + 1 );
+
+ int dash = s.IndexOf( "-" );
+ if ( dash < 0 || dash > rbrack )
+ testName.RunnerID = Int32.Parse( s.Substring( 1, rbrack - 1 ) );
+ else
+ {
+ testName.RunnerID = Int32.Parse( s.Substring( 1, dash - 1 ) );
+ testName.TestID = TestID.Parse( s.Substring( dash + 1, rbrack - dash - 1 ) );
+ }
+ }
+
+ return testName;
+ }
+ #endregion
+
+ #region Object Overrides
+ /// <summary>
+ /// Compares two TestNames for equality
+ /// </summary>
+ /// <param name="obj">the other TestID</param>
+ /// <returns>True if the two TestIDs are equal</returns>
+ public override bool Equals(object obj)
+ {
+ TestName other = obj as TestName;
+ if ( other == null )
+ return base.Equals (obj);
+
+ return this.TestID == other.testID
+ && this.runnerID == other.runnerID
+ && this.fullName == other.fullName;
+ }
+
+ /// <summary>
+ /// Calculates a hashcode for this TestID
+ /// </summary>
+ /// <returns>The hash code.</returns>
+ public override int GetHashCode()
+ {
+ return unchecked( this.testID.GetHashCode() + this.fullName.GetHashCode() );
+ }
+
+ /// <summary>
+ /// Override ToString() to display the UniqueName
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ return this.UniqueName;
+ }
+ #endregion
+
+ #region Operator Overrides
+ /// <summary>
+ /// Override the == operator
+ /// </summary>
+ /// <param name="name1"></param>
+ /// <param name="name2"></param>
+ /// <returns></returns>
+ public static bool operator ==( TestName name1, TestName name2 )
+ {
+ if ( Object.Equals( name1, null ) )
+ return Object.Equals( name2, null );
+
+ return name1.Equals( name2 );
+ }
+
+ /// <summary>
+ /// Override the != operator
+ /// </summary>
+ /// <param name="name1"></param>
+ /// <param name="name2"></param>
+ /// <returns></returns>
+ public static bool operator !=( TestName name1, TestName name2 )
+ {
+ return name1 == name2 ? false : true;
+ }
+ #endregion
+
+ #region ICloneable Implementation
+ /// <summary>
+ /// Returns a duplicate of this TestName
+ /// </summary>
+ /// <returns></returns>
+ public object Clone()
+ {
+ return this.MemberwiseClone();
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestNode.cs b/mcs/nunit24/NUnitCore/interfaces/TestNode.cs
new file mode 100644
index 00000000000..6b9ed44c461
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestNode.cs
@@ -0,0 +1,88 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Collections;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestNode represents a single test or suite in the test hierarchy.
+ /// TestNode holds common info needed about a test and represents a
+ /// single node - either a test or a suite - in the hierarchy of tests.
+ ///
+ /// TestNode extends TestInfo, which holds all the information with
+ /// the exception of the list of child classes. When constructed from
+ /// a Test, TestNodes are always fully populated with child TestNodes.
+ ///
+ /// Like TestInfo, TestNode is purely a data class, and is not able
+ /// to execute tests.
+ ///
+ /// </summary>
+ [Serializable]
+ public class TestNode : TestInfo
+ {
+ #region Instance Variables
+ private ITest parent;
+
+ /// <summary>
+ /// For a test suite, the child tests or suites
+ /// Null if this is not a test suite
+ /// </summary>
+ private ArrayList tests;
+ #endregion
+
+ #region Constructors
+ /// <summary>
+ /// Construct from an ITest
+ /// </summary>
+ /// <param name="test">Test from which a TestNode is to be constructed</param>
+ public TestNode ( ITest test ) : base( test )
+ {
+ if ( test.IsSuite )
+ {
+ this.tests = new ArrayList();
+
+ foreach( ITest child in test.Tests )
+ {
+ TestNode node = new TestNode( child );
+ this.Tests.Add( node );
+ node.parent = this;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Construct a TestNode given a TestName and an
+ /// array of child tests.
+ /// </summary>
+ /// <param name="testName">The TestName of the new test</param>
+ /// <param name="tests">An array of tests to be added as children of the new test</param>
+ public TestNode ( TestName testName, ITest[] tests ) : base( testName, tests )
+ {
+ this.tests = new ArrayList();
+ this.tests.AddRange( tests );
+ }
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Gets the parent test of the current test
+ /// </summary>
+ public override ITest Parent
+ {
+ get { return parent; }
+ }
+
+ /// <summary>
+ /// Array of child tests, null if this is a test case.
+ /// </summary>
+ public override IList Tests
+ {
+ get { return tests; }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestOutput.cs b/mcs/nunit24/NUnitCore/interfaces/TestOutput.cs
new file mode 100644
index 00000000000..78e72af7d99
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestOutput.cs
@@ -0,0 +1,92 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+namespace NUnit.Core
+{
+ using System;
+
+ /// <summary>
+ /// The TestOutput class holds a unit of output from
+ /// a test to either stdOut or stdErr
+ /// </summary>
+ [Serializable]
+ public class TestOutput
+ {
+ string text;
+ TestOutputType type;
+
+ /// <summary>
+ /// Construct with text and an ouput destination type
+ /// </summary>
+ /// <param name="text">Text to be output</param>
+ /// <param name="type">Destination of output</param>
+ public TestOutput(string text, TestOutputType type)
+ {
+ this.text = text;
+ this.type = type;
+ }
+
+ /// <summary>
+ /// Return string representation of the object for debugging
+ /// </summary>
+ /// <returns></returns>
+ public override string ToString()
+ {
+ return type + ": " + text;
+ }
+
+ /// <summary>
+ /// Get the text
+ /// </summary>
+ public string Text
+ {
+ get
+ {
+ return this.text;
+ }
+ }
+
+ /// <summary>
+ /// Get the output type
+ /// </summary>
+ public TestOutputType Type
+ {
+ get
+ {
+ return this.type;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Enum representing the output destination
+ /// It uses combinable flags so that a given
+ /// output control can accept multiple types
+ /// of output. Normally, each individual
+ /// output uses a single flag value.
+ /// </summary>
+ public enum TestOutputType
+ {
+ /// <summary>
+ /// Send output to stdOut
+ /// </summary>
+ Out,
+
+ /// <summary>
+ /// Send output to stdErr
+ /// </summary>
+ Error,
+
+ /// <summary>
+ /// Send output to Trace
+ /// </summary>
+ Trace,
+
+ /// <summary>
+ /// Send output to Log
+ /// </summary>
+ Log
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestPackage.cs b/mcs/nunit24/NUnitCore/interfaces/TestPackage.cs
new file mode 100644
index 00000000000..22b70828641
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestPackage.cs
@@ -0,0 +1,178 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.IO;
+using System.Collections;
+using System.Collections.Specialized;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// TestPackage holds information about a set of tests to
+ /// be loaded by a TestRunner. It may represent a single
+ /// assembly or a set of assemblies. It supports selection
+ /// of a single test fixture for loading.
+ /// </summary>
+ [Serializable]
+ public class TestPackage
+ {
+ private string name;
+ private string fullName;
+
+ private ListDictionary settings = new ListDictionary();
+
+ private string basePath;
+ private string configFile;
+ private string binPath;
+ private bool autoBinPath;
+
+ private ArrayList assemblies;
+ private string testName;
+ private bool isSingleAssembly;
+
+
+ /// <summary>
+ /// Construct a package, specifying the name of the package.
+ /// If the package name is an assembly file type (dll or exe)
+ /// then the resulting package represents a single assembly.
+ /// Otherwise it is a container for multiple assemblies.
+ /// </summary>
+ /// <param name="name">The name of the package</param>
+ public TestPackage( string name )
+ {
+ this.fullName = name;
+ this.name = Path.GetFileName( name );
+ this.assemblies = new ArrayList();
+ if ( IsAssemblyFileType( name ) )
+ {
+ this.isSingleAssembly = true;
+ this.assemblies.Add( name );
+ }
+ }
+
+ /// <summary>
+ /// Construct a package, specifying the name to be used
+ /// and a list of assemblies.
+ /// </summary>
+ /// <param name="name">The package name, used to name the top-level test node</param>
+ /// <param name="assemblies">The list of assemblies comprising the package</param>
+ public TestPackage( string name, IList assemblies )
+ {
+ this.fullName = name;
+ this.name = Path.GetFileName( name );
+ this.assemblies = new ArrayList( assemblies );
+ this.isSingleAssembly = false;
+ }
+
+ /// <summary>
+ /// Gets the name of the package
+ /// </summary>
+ public string Name
+ {
+ get { return name; }
+ }
+
+ /// <summary>
+ /// Gets the full name of the package, which is usually
+ /// the path to the NUnit project used to create the it
+ /// </summary>
+ public string FullName
+ {
+ get { return fullName; }
+ }
+
+ /// <summary>
+ /// The BasePath to be used in loading the assemblies
+ /// </summary>
+ public string BasePath
+ {
+ get { return basePath; }
+ set { basePath = value; }
+ }
+
+ /// <summary>
+ /// The configuration file to be used
+ /// </summary>
+ public string ConfigurationFile
+ {
+ get { return configFile; }
+ set { configFile = value; }
+ }
+
+ /// <summary>
+ /// Addditional directories to be probed when loading assemblies
+ /// </summary>
+ public string PrivateBinPath
+ {
+ get { return binPath; }
+ set { binPath = value; }
+ }
+
+ /// <summary>
+ /// Indicates whether the probing path should be generated
+ /// automatically based on the list of assemblies.
+ /// </summary>
+ public bool AutoBinPath
+ {
+ get { return autoBinPath; }
+ set { autoBinPath = value; }
+ }
+
+ /// <summary>
+ /// Assemblies to be loaded. At least one must be specified.
+ /// </summary>
+ public IList Assemblies
+ {
+ get { return assemblies; }
+ }
+
+ /// <summary>
+ /// Return true if the package represents a single assembly.
+ /// No root node is displayed in that case.
+ /// </summary>
+ public bool IsSingleAssembly
+ {
+ get { return isSingleAssembly; }
+ }
+
+ /// <summary>
+ /// Fully qualified name of test to be loaded. If not
+ /// specified, all the tests in the assemblies are loaded.
+ /// </summary>
+ public string TestName
+ {
+ get { return testName; }
+ set { testName = value; }
+ }
+
+ /// <summary>
+ /// Gets the dictionary of settings for this TestPackage
+ /// </summary>
+ public IDictionary Settings
+ {
+ get { return settings; }
+ }
+
+ /// <summary>
+ /// Return the value of a bool setting or a default.
+ /// </summary>
+ /// <param name="name">The name of the setting</param>
+ /// <param name="defaultSetting">The default value</param>
+ /// <returns></returns>
+ public bool GetSetting( string name, bool defaultSetting )
+ {
+ object setting = settings[name];
+
+ return setting == null ? defaultSetting : (bool)setting;
+ }
+
+ private static bool IsAssemblyFileType( string path )
+ {
+ string extension = Path.GetExtension( path ).ToLower();
+ return extension == ".dll" || extension == ".exe";
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestResult.cs b/mcs/nunit24/NUnitCore/interfaces/TestResult.cs
new file mode 100644
index 00000000000..74bd140db22
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestResult.cs
@@ -0,0 +1,428 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Text;
+
+ /// <summary>
+ /// The TestResult abstract class represents
+ /// the result of a test and is used to
+ /// communicate results across AppDomains.
+ /// </summary>
+ ///
+ [Serializable]
+ public abstract class TestResult
+ {
+ #region Fields
+ /// <summary>
+ /// Indicates whether the test was executed or not
+ /// </summary>
+ private RunState runState;
+
+ /// <summary>
+ /// Indicates the result of the test
+ /// </summary>
+ private ResultState resultState;
+
+ /// <summary>
+ /// Indicates the location of a failure
+ /// </summary>
+ private FailureSite failureSite;
+
+ /// <summary>
+ /// The elapsed time for executing this test
+ /// </summary>
+ private double time = 0.0;
+
+ /// <summary>
+ /// The name of the test
+ /// </summary>
+ private string name;
+
+ /// <summary>
+ /// The test that this result pertains to
+ /// </summary>
+ private TestInfo test;
+
+ /// <summary>
+ /// The stacktrace at the point of failure
+ /// </summary>
+ private string stackTrace;
+
+ /// <summary>
+ /// Description of this test
+ /// </summary>
+ private string description;
+
+ /// <summary>
+ /// Message giving the reason for failure
+ /// </summary>
+ protected string messageString;
+
+ /// <summary>
+ /// Number of asserts executed by this test
+ /// </summary>
+ private int assertCount = 0;
+
+ #endregion
+
+ #region Protected Constructor
+ /// <summary>
+ /// Protected constructor constructs a test result given
+ /// a test and a name.
+ /// </summary>
+ /// <param name="test">The test to be used</param>
+ /// <param name="name">Name for this result</param>
+ protected TestResult(TestInfo test, string name)
+ {
+ this.name = name;
+ this.test = test;
+ this.RunState = RunState.Runnable;
+ if (test != null)
+ {
+ this.description = test.Description;
+ this.runState = test.RunState;
+ this.messageString = test.IgnoreReason;
+ }
+ }
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets the RunState of the result, which indicates
+ /// whether or not it has executed and why.
+ /// </summary>
+ public RunState RunState
+ {
+ get { return runState; }
+ set { runState = value; }
+ }
+
+ /// <summary>
+ /// Gets the ResultState of the test result, which
+ /// indicates the success or failure of the test.
+ /// </summary>
+ public ResultState ResultState
+ {
+ get { return resultState; }
+ }
+
+ /// <summary>
+ /// Gets the stage of the test in which a failure
+ /// or error occured.
+ /// </summary>
+ public FailureSite FailureSite
+ {
+ get { return failureSite; }
+ }
+
+ /// <summary>
+ /// Indicates whether the test executed
+ /// </summary>
+ public bool Executed
+ {
+ get { return runState == RunState.Executed; }
+ }
+
+ /// <summary>
+ /// Gets the name of the test result
+ /// </summary>
+ public virtual string Name
+ {
+ get { return name; }
+ }
+
+ /// <summary>
+ /// Gets the test associated with this result
+ /// </summary>
+ public ITest Test
+ {
+ get { return test; }
+ }
+
+ /// <summary>
+ /// Indicates whether the test ran successfully
+ /// </summary>
+ public virtual bool IsSuccess
+ {
+ // TODO: Redefine this more precisely
+ get { return !IsFailure; }
+ //get { return resultState == ResultState.Success; }
+ }
+
+ /// <summary>
+ /// Indicates whether the test failed
+ /// </summary>
+ // TODO: Distinguish errors from failures
+ public virtual bool IsFailure
+ {
+ get { return resultState == ResultState.Failure || resultState == ResultState.Error; }
+ }
+
+ /// <summary>
+ /// Gets a description associated with the test
+ /// </summary>
+ public virtual string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+
+ /// <summary>
+ /// Gets the elapsed time for running the test
+ /// </summary>
+ public double Time
+ {
+ get { return time; }
+ set { time = value; }
+ }
+
+ /// <summary>
+ /// Gets the message associated with a test
+ /// failure or with not running the test
+ /// </summary>
+ public string Message
+ {
+ get { return messageString; }
+ }
+
+ /// <summary>
+ /// Gets any stacktrace associated with an
+ /// error or failure.
+ /// </summary>
+ public virtual string StackTrace
+ {
+ get
+ {
+ return stackTrace;
+ }
+ set
+ {
+ stackTrace = value;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the count of asserts executed
+ /// when running the test.
+ /// </summary>
+ public int AssertCount
+ {
+ get { return assertCount; }
+ set { assertCount = value; }
+ }
+
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Mark the test as succeeding
+ /// </summary>
+ public void Success()
+ {
+ this.runState = RunState.Executed;
+ this.resultState = ResultState.Success;
+ }
+
+ /// <summary>
+ /// Mark the test as ignored.
+ /// </summary>
+ /// <param name="reason">The reason the test was not run</param>
+ public void Ignore(string reason)
+ {
+ Ignore( reason, null );
+ }
+
+ /// <summary>
+ /// Mark the test as ignored.
+ /// </summary>
+ /// <param name="ex">The ignore exception that was thrown</param>
+ public void Ignore( Exception ex )
+ {
+ Ignore( ex.Message, BuildStackTrace( ex ) );
+ }
+
+ /// <summary>
+ /// Mark the test as ignored.
+ /// </summary>
+ /// <param name="reason">The reason the test was not run</param>
+ /// <param name="stackTrace">Stack trace giving the location of the command</param>
+ public void Ignore(string reason, string stackTrace)
+ {
+ NotRun( RunState.Ignored, reason, stackTrace );
+ }
+
+ /// <summary>
+ /// Mark the test as skipped.
+ /// </summary>
+ /// <param name="reason">The reason the test was not run</param>
+ public void Skip(string reason)
+ {
+ Skip( reason, null );
+ }
+
+ /// <summary>
+ /// Mark the test as ignored.
+ /// </summary>
+ /// <param name="ex">The ignore exception that was thrown</param>
+ public void Skip( Exception ex )
+ {
+ Skip( ex.Message, BuildStackTrace( ex ) );
+ }
+
+ /// <summary>
+ /// Mark the test as skipped.
+ /// </summary>
+ /// <param name="reason">The reason the test was not run</param>
+ /// <param name="stackTrace">Stack trace giving the location of the command</param>
+ public void Skip(string reason, string stackTrace)
+ {
+ NotRun( RunState.Skipped, reason, stackTrace );
+ }
+
+ /// <summary>
+ /// Mark the test as Not Run - either skipped or ignored
+ /// </summary>
+ /// <param name="runState">The RunState to use in the result</param>
+ /// <param name="reason">The reason the test was not run</param>
+ /// <param name="stackTrace">Stack trace giving the location of the command</param>
+ public void NotRun(RunState runState, string reason, string stackTrace)
+ {
+ this.runState = runState;
+ this.messageString = reason;
+ this.stackTrace = stackTrace;
+ }
+
+
+ /// <summary>
+ /// Mark the test as a failure due to an
+ /// assertion having failed.
+ /// </summary>
+ /// <param name="message">Message to display</param>
+ /// <param name="stackTrace">Stack trace giving the location of the failure</param>
+ public void Failure(string message, string stackTrace)
+ {
+ Failure(message, stackTrace, FailureSite.Test);
+ }
+
+ /// <summary>
+ /// Mark the test as a failure due to an
+ /// assertion having failed.
+ /// </summary>
+ /// <param name="message">Message to display</param>
+ /// <param name="stackTrace">Stack trace giving the location of the failure</param>
+ /// <param name="failureSite">The site of the failure</param>
+ public void Failure(string message, string stackTrace, FailureSite failureSite )
+ {
+ this.runState = RunState.Executed;
+ this.resultState = ResultState.Failure;
+ this.failureSite = failureSite;
+ this.messageString = message;
+ this.stackTrace = stackTrace;
+ }
+
+ /// <summary>
+ /// Marks the result as an error due to an exception thrown
+ /// by the test.
+ /// </summary>
+ /// <param name="exception">The exception that was caught</param>
+ public void Error(Exception exception)
+ {
+ Error(exception, FailureSite.Test);
+ }
+
+ /// <summary>
+ /// Marks the result as an error due to an exception thrown
+ /// from the indicated FailureSite.
+ /// </summary>
+ /// <param name="exception">The exception that was caught</param>
+ /// <param name="failureSite">The site from which it was thrown</param>
+ public void Error( Exception exception, FailureSite failureSite )
+ {
+ this.runState = RunState.Executed;
+ this.resultState = ResultState.Error;
+ this.failureSite = failureSite;
+
+ string message = BuildMessage(exception);
+ string stackTrace = BuildStackTrace(exception);
+
+ if (failureSite == FailureSite.TearDown)
+ {
+ message = "TearDown : " + message;
+ stackTrace = "--TearDown" + Environment.NewLine + stackTrace;
+
+ if (this.messageString != null)
+ message = this.messageString + Environment.NewLine + message;
+ if (this.stackTrace != null)
+ stackTrace = this.stackTrace + Environment.NewLine + stackTrace;
+ }
+
+ this.messageString = message;
+ this.stackTrace = stackTrace;
+ }
+ #endregion
+
+ #region Exception Helpers
+
+ private string BuildMessage(Exception exception)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.AppendFormat( "{0} : {1}", exception.GetType().ToString(), exception.Message );
+
+ Exception inner = exception.InnerException;
+ while( inner != null )
+ {
+ sb.Append( Environment.NewLine );
+ sb.AppendFormat( " ----> {0} : {1}", inner.GetType().ToString(), inner.Message );
+ inner = inner.InnerException;
+ }
+
+ return sb.ToString();
+ }
+
+ private string BuildStackTrace(Exception exception)
+ {
+ StringBuilder sb = new StringBuilder( GetStackTrace( exception ) );
+
+ Exception inner = exception.InnerException;
+ while( inner != null )
+ {
+ sb.Append( Environment.NewLine );
+ sb.Append( "--" );
+ sb.Append( inner.GetType().Name );
+ sb.Append( Environment.NewLine );
+ sb.Append( GetStackTrace( inner ) );
+
+ inner = inner.InnerException;
+ }
+
+ return sb.ToString();
+ }
+
+ private string GetStackTrace(Exception exception)
+ {
+ try
+ {
+ return exception.StackTrace;
+ }
+ catch( Exception )
+ {
+ return "No stack trace available";
+ }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Abstract method that accepts a ResultVisitor
+ /// </summary>
+ /// <param name="visitor">The visitor</param>
+ public abstract void Accept(ResultVisitor visitor);
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestRunner.cs b/mcs/nunit24/NUnitCore/interfaces/TestRunner.cs
new file mode 100644
index 00000000000..90b0b8ebc74
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestRunner.cs
@@ -0,0 +1,165 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.IO;
+
+namespace NUnit.Core
+{
+ /// <summary>
+ /// The TestRunner Interface allows client code, such as the NUnit console and
+ /// gui runners, to load and run tests. This is the lowest level interface generally
+ /// supported for running tests and is implemented by the RemoteTestRunner class in
+ /// the NUnit core as well as by other classes running on the client side.
+ ///
+ /// The Load method is used to load a suite of tests from one or more
+ /// assemblies, returning a tree of TestNodes to the caller.
+ ///
+ /// The CountTestCases family of methods returns the number of test cases in the
+ /// loaded suite, either in its entirety or by using a filter to count a subset of tests.
+ ///
+ /// The Run family of methods performs a test run synchronously, returning a TestResult
+ /// or TestResult[] to the caller. If provided, an EventListener interface will be
+ /// notified of significant events in the running of the tests. A filter may be used
+ /// to run a subset of the tests.
+ ///
+ /// BeginRun and EndRun provide a simplified form of the asynchronous invocation
+ /// pattern used in many places within the .NET framework. Because the current
+ /// implementation allows only one run to be in process at a time, an IAsyncResult
+ /// is not used at this time.
+ ///
+ /// Methods to cancel a run and to wait for a run to complete are also provided. The
+ /// result of the last run may be obtained by querying the TestResult property.
+ ///
+ /// </summary>
+ public interface TestRunner
+ {
+ #region Properties
+ /// <summary>
+ /// TestRunners are identified by an ID. So long as there
+ /// is only one test runner or a single chain of test runners,
+ /// the default id of 0 may be used. However, any client that
+ /// creates multiple runners must ensure that each one has a
+ /// unique ID in order to locate and run specific tests.
+ /// </summary>
+ int ID
+ {
+ get;
+ }
+
+ /// <summary>
+ /// IsTestRunning indicates whether a test is in progress. To retrieve the
+ /// results from an asynchronous test run, wait till IsTestRunning is false.
+ /// </summary>
+ bool Running
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Returns information about loaded assemblies
+ /// </summary>
+ IList AssemblyInfo
+ {
+ get;
+ }
+
+ /// <summary>
+ /// The loaded test, converted to a tree of TestNodes so they can be
+ /// serialized and marshalled to a remote client.
+ /// </summary>
+ ITest Test
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Result of the last test run.
+ /// </summary>
+ TestResult TestResult
+ {
+ get;
+ }
+ #endregion
+
+ #region Load and Unload Methods
+ /// <summary>
+ /// Load the assemblies in a test package
+ /// </summary>
+ /// <param name="package">The test package to be loaded</param>
+ /// <returns>True if the tests were loaded successfully, otherwise false</returns>
+ bool Load( TestPackage package );
+
+ /// <summary>
+ /// Unload all tests previously loaded
+ /// </summary>
+ void Unload();
+ #endregion
+
+ #region CountTestCases Methods
+ /// <summary>
+ /// Count Test Cases using a filter
+ /// </summary>
+ /// <param name="filter">The filter to apply</param>
+ /// <returns>The number of test cases found</returns>
+ int CountTestCases(ITestFilter filter );
+ #endregion
+
+ #region Run Methods
+ /// <summary>
+ /// Run all loaded tests and return a test result. The test is run synchronously,
+ /// and the listener interface is notified as it progresses.
+ /// </summary>
+ /// <param name="listener">Interface to receive EventListener notifications.</param>
+ TestResult Run(NUnit.Core.EventListener listener);
+
+ /// <summary>
+ /// Run selected tests and return a test result. The test is run synchronously,
+ /// and the listener interface is notified as it progresses.
+ /// </summary>
+ /// <param name="listener">Interface to receive EventListener notifications.</param>
+ /// <param name="filter">The filter to apply when running the tests</param>
+ TestResult Run(NUnit.Core.EventListener listener, ITestFilter filter);
+
+ /// <summary>
+ /// Start a run of all loaded tests. The tests are run aynchronously and the
+ /// listener interface is notified as it progresses.
+ /// </summary>
+ /// <param name="listener">Interface to receive EventListener notifications.</param>
+ void BeginRun(NUnit.Core.EventListener listener);
+
+ /// <summary>
+ /// Start a run of selected tests. The tests are run aynchronously and the
+ /// listener interface is notified as it progresses.
+ /// </summary>
+ /// <param name="listener">Interface to receive EventListener notifications.</param>
+ /// <param name="filter">The filter to apply when running the tests</param>
+ void BeginRun(NUnit.Core.EventListener listener, ITestFilter filter);
+
+ /// <summary>
+ /// Wait for an asynchronous run to complete and return the result.
+ /// </summary>
+ /// <returns>A TestResult for the entire run</returns>
+ TestResult EndRun();
+
+ /// <summary>
+ /// Cancel the test run that is in progress. For a synchronous run,
+ /// a client wanting to call this must create a separate run thread.
+ /// </summary>
+ void CancelRun();
+
+ /// <summary>
+ /// Wait for the test run in progress to complete. For a synchronous run,
+ /// a client wanting to call this must create a separate run thread. In
+ /// particular, a gui client calling this method is likely to hang, since
+ /// events will not be able to invoke methods on the gui thread.
+ /// </summary>
+ void Wait();
+ #endregion
+ }
+}
+
diff --git a/mcs/nunit24/NUnitCore/interfaces/TestSuiteResult.cs b/mcs/nunit24/NUnitCore/interfaces/TestSuiteResult.cs
new file mode 100644
index 00000000000..af2c69a8f67
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/TestSuiteResult.cs
@@ -0,0 +1,72 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Core
+{
+ using System;
+ using System.Collections;
+
+ /// <summary>
+ /// TestSuiteResult represents the result of running a
+ /// TestSuite. It adds a set of child results to the
+ /// base TestResult class.
+ /// </summary>
+ ///
+ [Serializable]
+ public class TestSuiteResult : TestResult
+ {
+ private ArrayList results = new ArrayList();
+
+ /// <summary>
+ /// Construct a TestSuiteResult from a test and a name
+ /// </summary>
+ /// <param name="test"></param>
+ /// <param name="name"></param>
+ public TestSuiteResult(TestInfo test, string name)
+ : base(test, name) { }
+
+ /// <summary>
+ /// Construct a TestSuite result from a string
+ ///
+ /// This overload is used for testing
+ /// </summary>
+ /// <param name="testSuiteString"></param>
+ public TestSuiteResult(string testSuiteString)
+ : base(null, testSuiteString) { }
+
+ /// <summary>
+ /// Add a child result to a TestSuiteResult
+ /// </summary>
+ /// <param name="result">The child result to be added</param>
+ public void AddResult(TestResult result)
+ {
+ results.Add(result);
+
+ if( this.ResultState == ResultState.Success &&
+ result.ResultState != ResultState.Success )
+ {
+ this.Failure( "Child test failed", null, FailureSite.Child );
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of the child results of this TestSUiteResult
+ /// </summary>
+ public IList Results
+ {
+ get { return results; }
+ }
+
+ /// <summary>
+ /// Accepts a ResultVisitor
+ /// </summary>
+ /// <param name="visitor">The visitor</param>
+ public override void Accept(ResultVisitor visitor)
+ {
+ visitor.Visit(this);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.build b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.build
new file mode 100644
index 00000000000..c8568221faa
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.build
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<project name="NUnitCoreInterfaces" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.core.interfaces.dll"
+ debug="${build.debug}"
+ define="${build.defines}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="EventListener.cs"/>
+ <include name="IService.cs"/>
+ <include name="ITest.cs"/>
+ <include name="ITestFilter.cs"/>
+ <include name="ResultState.cs"/>
+ <include name="ResultVisitor.cs"/>
+ <include name="RunState.cs"/>
+ <include name="RuntimeFramework.cs"/>
+ <include name="Test.cs"/>
+ <include name="TestAssemblyInfo.cs"/>
+ <include name="TestCaseResult.cs"/>
+ <include name="TestFilter.cs"/>
+ <include name="TestID.cs"/>
+ <include name="TestInfo.cs"/>
+ <include name="TestName.cs"/>
+ <include name="TestNode.cs"/>
+ <include name="TestOutput.cs"/>
+ <include name="TestPackage.cs"/>
+ <include name="TestResult.cs"/>
+ <include name="TestRunner.cs"/>
+ <include name="TestSuiteResult.cs"/>
+ <include name="Extensibility/Addin.cs"/>
+ <include name="Extensibility/AddinStatus.cs"/>
+ <include name="Extensibility/ExtensionType.cs"/>
+ <include name="Extensibility/IAddin.cs"/>
+ <include name="Extensibility/IAddinRegistry.cs"/>
+ <include name="Extensibility/IExtensionHost.cs"/>
+ <include name="Extensibility/IExtensionPoint.cs"/>
+ <include name="Extensibility/IFrameworkRegistry.cs"/>
+ <include name="Extensibility/ISuiteBuilder.cs"/>
+ <include name="Extensibility/ITestCaseBuilder.cs"/>
+ <include name="Extensibility/ITestDecorator.cs"/>
+ <include name="Extensibility/NUnitAddinAttribute.cs"/>
+ <include name="Extensibility/TestFramework.cs"/>
+ <include name="Filters/AndFilter.cs"/>
+ <include name="Filters/CategoryFilter.cs"/>
+ <include name="Filters/NameFilter.cs"/>
+ <include name="Filters/NotFilter.cs"/>
+ <include name="Filters/OrFilter.cs"/>
+ <include name="Filters/SimpleNameFilter.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitCore/interfaces">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.csproj b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.csproj
new file mode 100644
index 00000000000..f8eec21c2f2
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.csproj
@@ -0,0 +1,301 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.core.interfaces"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Core"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = "bin\Debug\nunit.core.interfaces.xml"
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = "bin\Release\nunit.core.interfaces.xml"
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "EventListener.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IService.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITest.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ITestFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ResultState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ResultVisitor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RunState.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RuntimeFramework.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Test.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestCaseResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestID.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestName.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestNode.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestOutput.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestPackage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestSuiteResult.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\Addin.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\AddinStatus.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\ExtensionType.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\IAddin.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\IAddinRegistry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\IExtensionHost.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\IExtensionPoint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\IFrameworkRegistry.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\ISuiteBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\ITestCaseBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\ITestDecorator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\NUnitAddinAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Extensibility\TestFramework.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Filters\AndFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Filters\CategoryFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Filters\NameFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Filters\NotFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Filters\OrFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Filters\SimpleNameFilter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.sources b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.sources
new file mode 100644
index 00000000000..ae3e2fc37ce
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll.sources
@@ -0,0 +1,43 @@
+../../CommonAssemblyInfo.cs
+AssemblyInfo.cs
+EventListener.cs
+Extensibility/Addin.cs
+Extensibility/AddinStatus.cs
+Extensibility/ExtensionType.cs
+Extensibility/IAddin.cs
+Extensibility/IAddinManager.cs
+Extensibility/IAddinRegistry.cs
+Extensibility/IExtensionHost.cs
+Extensibility/IExtensionPoint.cs
+Extensibility/IFrameworkRegistry.cs
+Extensibility/ISuiteBuilder.cs
+Extensibility/ITestCaseBuilder.cs
+Extensibility/ITestDecorator.cs
+Extensibility/NUnitAddinAttribute.cs
+Extensibility/TestFramework.cs
+Filters/AndFilter.cs
+Filters/CategoryFilter.cs
+Filters/NameFilter.cs
+Filters/NotFilter.cs
+Filters/OrFilter.cs
+Filters/SimpleNameFilter.cs
+IService.cs
+ITest.cs
+ITestFilter.cs
+ResultState.cs
+ResultVisitor.cs
+RunState.cs
+RuntimeFramework.cs
+Test.cs
+TestAssemblyInfo.cs
+TestCaseResult.cs
+TestFilter.cs
+TestID.cs
+TestInfo.cs
+TestName.cs
+TestNode.cs
+TestOutput.cs
+TestPackage.cs
+TestResult.cs
+TestRunner.cs
+TestSuiteResult.cs
diff --git a/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll_VS2005.csproj b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll_VS2005.csproj
new file mode 100644
index 00000000000..4206b81eb73
--- /dev/null
+++ b/mcs/nunit24/NUnitCore/interfaces/nunit.core.interfaces.dll_VS2005.csproj
@@ -0,0 +1,120 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{DCC88998-255A-4247-B658-71DD932E9873}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NUnit.Core</RootNamespace>
+ <AssemblyName>nunit.core.interfaces</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Release\nunit.core.interfaces.xml</DocumentationFile>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <DocumentationFile>bin\Debug2005\nunit.core.interfaces.xml</DocumentationFile>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="EventListener.cs" />
+ <Compile Include="Extensibility\Addin.cs" />
+ <Compile Include="Extensibility\AddinStatus.cs" />
+ <Compile Include="Extensibility\ExtensionType.cs" />
+ <Compile Include="Extensibility\IAddin.cs" />
+ <Compile Include="Extensibility\IAddinRegistry.cs" />
+ <Compile Include="Extensibility\IExtensionHost.cs" />
+ <Compile Include="Extensibility\IExtensionPoint.cs" />
+ <Compile Include="Extensibility\IFrameworkRegistry.cs" />
+ <Compile Include="Extensibility\NUnitAddinAttribute.cs" />
+ <Compile Include="Extensibility\ISuiteBuilder.cs" />
+ <Compile Include="Extensibility\TestFramework.cs" />
+ <Compile Include="Filters\AndFilter.cs" />
+ <Compile Include="Filters\CategoryFilter.cs" />
+ <Compile Include="Filters\NameFilter.cs" />
+ <Compile Include="Filters\NotFilter.cs" />
+ <Compile Include="Filters\OrFilter.cs" />
+ <Compile Include="Filters\SimpleNameFilter.cs" />
+ <Compile Include="IService.cs" />
+ <Compile Include="ITest.cs" />
+ <Compile Include="Extensibility\ITestCaseBuilder.cs" />
+ <Compile Include="Extensibility\ITestDecorator.cs" />
+ <Compile Include="ITestFilter.cs" />
+ <Compile Include="ResultState.cs" />
+ <Compile Include="ResultVisitor.cs" />
+ <Compile Include="RunState.cs" />
+ <Compile Include="RuntimeFramework.cs" />
+ <Compile Include="Test.cs" />
+ <Compile Include="TestAssemblyInfo.cs" />
+ <Compile Include="TestCaseResult.cs" />
+ <Compile Include="TestFilter.cs" />
+ <Compile Include="TestID.cs" />
+ <Compile Include="TestInfo.cs" />
+ <Compile Include="TestName.cs" />
+ <Compile Include="TestNode.cs" />
+ <Compile Include="TestOutput.cs" />
+ <Compile Include="TestPackage.cs" />
+ <Compile Include="TestResult.cs" />
+ <Compile Include="TestRunner.cs" />
+ <Compile Include="TestSuiteResult.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs b/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs
new file mode 100644
index 00000000000..fa86732b3d3
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitExtensions/core/Makefile b/mcs/nunit24/NUnitExtensions/core/Makefile
new file mode 100644
index 00000000000..c7991a62d96
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/Makefile
@@ -0,0 +1,32 @@
+thisdir = nunit24/NUnitExtensions/core
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit.core.extensions.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LIB_MCS_FLAGS = \
+ -debug \
+ /r:nunit.core.dll /r:nunit.core.interfaces.dll \
+ /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly
+NO_TEST = yo
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+EXTRA_DISTFILES = \
+ nunit.core.extensions.dll.csproj \
+ nunit.core.extensions.dll_VS2005.csproj
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/NUnitExtensions/core/RepeatedTestCase.cs b/mcs/nunit24/NUnitExtensions/core/RepeatedTestCase.cs
new file mode 100644
index 00000000000..4858c751c22
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RepeatedTestCase.cs
@@ -0,0 +1,39 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+
+namespace NUnit.Core.Extensions
+{
+ /// <summary>
+ /// RepeatedTestCase aggregates another test case and runs it
+ /// a specified number of times.
+ /// </summary>
+ public class RepeatedTestCase : AbstractTestCaseDecoration
+ {
+ // The number of times to run the test
+ int count;
+
+ public RepeatedTestCase( TestCase testCase, int count )
+ : base( testCase )
+ {
+ this.count = count;
+ }
+
+ public override void Run(TestCaseResult result)
+ {
+ // So testCase can get the fixture
+ testCase.Parent = this.Parent;
+
+ for( int i = 0; i < count; i++ )
+ {
+ testCase.Run( result );
+ if ( result.IsFailure )
+ return;
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RepeatedTestDecorator.cs b/mcs/nunit24/NUnitExtensions/core/RepeatedTestDecorator.cs
new file mode 100644
index 00000000000..963e41176cc
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RepeatedTestDecorator.cs
@@ -0,0 +1,63 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+using System;
+using System.Reflection;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core.Extensions
+{
+ /// <summary>
+ /// Summary description for RepeatedTestDecorator.
+ /// </summary>
+ [NUnitAddin(Description="Runs a test case multiple times")]
+ public class RepeatedTestDecorator : ITestDecorator, IAddin
+ {
+ private static readonly string RepeatAttributeType = "NUnit.Framework.Extensions.RepeatAttribute";
+
+ #region IAddin Members
+ public bool Install(IExtensionHost host)
+ {
+ IExtensionPoint decorators = host.GetExtensionPoint( "TestDecorators" );
+ if ( decorators == null )
+ return false;
+
+ decorators.Install( this );
+ return true;
+ }
+ #endregion
+
+ #region ITestDecorator Members
+ public Test Decorate(Test test, MemberInfo member)
+ {
+ if ( member == null )
+ return test;
+
+ TestCase testCase = test as TestCase;
+ if ( testCase == null )
+ return test;
+
+ Attribute repeatAttr = Reflect.GetAttribute( member, RepeatAttributeType, true );
+ if ( repeatAttr == null )
+ return test;
+
+ object propVal = Reflect.GetPropertyValue( repeatAttr, "Count",
+ BindingFlags.Public | BindingFlags.Instance );
+
+ if ( propVal == null )
+ return test;
+
+ int count = (int)propVal;
+
+ return new RepeatedTestCase( testCase, count );
+ }
+
+// public Test Decorate( Test test, Type fixtureType )
+// {
+// return test;
+// }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestAddIn.cs b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestAddIn.cs
new file mode 100644
index 00000000000..0fefc56325b
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestAddIn.cs
@@ -0,0 +1,54 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+using System.Reflection;
+using NUnit.Core;
+using NUnit.Core.Extensibility;
+
+namespace NUnit.Core.Extensions.RowTest
+{
+ [NUnitAddin(Name = "Row Test Extension")]
+ public class RowTestAddIn : IAddin, ITestCaseBuilder
+ {
+ private RowTestFactory _testFactory;
+
+ public RowTestAddIn()
+ {
+ _testFactory = new RowTestFactory();
+ }
+
+ public bool Install(IExtensionHost host)
+ {
+ if (host == null)
+ throw new ArgumentNullException("host");
+
+ IExtensionPoint testCaseBuilders = host.GetExtensionPoint("TestCaseBuilders");
+ if (testCaseBuilders == null)
+ return false;
+
+ testCaseBuilders.Install(this);
+ return true;
+ }
+
+ public bool CanBuildFrom(MethodInfo method)
+ {
+ return RowTestFramework.IsRowTest(method);
+ }
+
+ public Test BuildFrom(MethodInfo method)
+ {
+ if (method == null)
+ throw new ArgumentNullException("method");
+
+ RowTestSuite suite = _testFactory.CreateRowTestSuite(method);
+ Attribute[] rows = RowTestFramework.GetRowAttributes(method);
+
+ foreach (Attribute row in rows)
+ suite.Add(_testFactory.CreateRowTestCase(row, method));
+
+ return suite;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestCase.cs b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestCase.cs
new file mode 100644
index 00000000000..a2a8601eb7d
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestCase.cs
@@ -0,0 +1,37 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+using System.Reflection;
+using System.Text;
+using NUnit.Core;
+
+namespace NUnit.Core.Extensions.RowTest
+{
+ public class RowTestCase : NUnitTestMethod
+ {
+ private object[] _arguments;
+
+ public RowTestCase(MethodInfo method, string testName, object[] arguments)
+ : base(method)
+ {
+ RowTestNameBuilder testNameBuilder = new RowTestNameBuilder(method, testName, arguments);
+ this.TestName.Name = testNameBuilder.TestName;
+ this.TestName.FullName = testNameBuilder.FullTestName;
+
+ _arguments = arguments;
+ }
+
+ public object[] Arguments
+ {
+ get { return _arguments; }
+ }
+
+ public override void RunTestMethod(TestCaseResult testResult)
+ {
+ object[] arguments = _arguments != null ? _arguments : new object[] { null };
+ Reflect.InvokeMethod(this.Method, this.Fixture, arguments);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFactory.cs b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFactory.cs
new file mode 100644
index 00000000000..39ce5f4ebd6
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFactory.cs
@@ -0,0 +1,79 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+using System.Reflection;
+using NUnit.Core;
+
+namespace NUnit.Core.Extensions.RowTest
+{
+ public class RowTestFactory
+ {
+ public RowTestFactory()
+ {
+ }
+
+ public RowTestSuite CreateRowTestSuite(MethodInfo method)
+ {
+ if (method == null)
+ throw new ArgumentNullException("method");
+
+ RowTestSuite testSuite = new RowTestSuite(method);
+ NUnitFramework.ApplyCommonAttributes(method, testSuite);
+
+ return testSuite;
+ }
+
+ public RowTestCase CreateRowTestCase(Attribute row, MethodInfo method)
+ {
+ if (row == null)
+ throw new ArgumentNullException("row");
+
+ if (method == null)
+ throw new ArgumentNullException("method");
+
+ object[] rowArguments = RowTestFramework.GetRowArguments(row);
+ rowArguments = FilterSpecialValues(rowArguments);
+
+ string testName = RowTestFramework.GetTestName(row);
+ Type expectedExceptionType = RowTestFramework.GetExpectedExceptionType(row);
+
+ RowTestCase testCase = new RowTestCase(method, testName, rowArguments);
+ if (expectedExceptionType != null)
+ {
+ testCase.ExceptionExpected = true;
+ testCase.ExpectedExceptionType = expectedExceptionType;
+ testCase.ExpectedMessage = RowTestFramework.GetExpectedExceptionMessage(row);
+ }
+
+ return testCase;
+ }
+
+ private object[] FilterSpecialValues(object[] arguments)
+ {
+ if (arguments == null)
+ return null;
+
+ for (int i = 0; i < arguments.Length; i++)
+ {
+ if (RowTestFramework.IsSpecialValue(arguments[i]))
+ arguments[i] = MapSpecialValue(arguments[i]);
+ }
+
+ return arguments;
+ }
+
+ private object MapSpecialValue(object specialValue)
+ {
+ switch (specialValue.ToString())
+ {
+ case "Null":
+ return null;
+
+ default:
+ return specialValue;
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFramework.cs b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFramework.cs
new file mode 100644
index 00000000000..581a53aec45
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestFramework.cs
@@ -0,0 +1,65 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+using System.Reflection;
+using NUnit.Core;
+
+namespace NUnit.Core.Extensions.RowTest
+{
+ public sealed class RowTestFramework
+ {
+ public const string RowTestAttribute = "NUnit.Framework.Extensions.RowTestAttribute";
+ public const string RowAttribute = "NUnit.Framework.Extensions.RowAttribute";
+ public const string SpecialValueEnum = "NUnit.Framework.Extensions.SpecialValue";
+
+ private RowTestFramework()
+ {
+ }
+
+ public static bool IsRowTest(MethodInfo method)
+ {
+ if (method == null)
+ return false;
+
+ return Reflect.HasAttribute(method, RowTestAttribute, false);;
+ }
+
+ public static Attribute[] GetRowAttributes(MethodInfo method)
+ {
+ if (method == null)
+ throw new ArgumentNullException("method");
+
+ return Reflect.GetAttributes(method, RowAttribute, false);
+ }
+
+ public static object[] GetRowArguments(Attribute attribute)
+ {
+ return Reflect.GetPropertyValue(attribute, "Arguments") as object[];
+ }
+
+ public static bool IsSpecialValue(object argument)
+ {
+ if (argument == null)
+ return false;
+
+ return argument.GetType().FullName == SpecialValueEnum;
+ }
+
+ public static Type GetExpectedExceptionType(Attribute attribute)
+ {
+ return Reflect.GetPropertyValue(attribute, "ExpectedException") as Type;
+ }
+
+ public static string GetExpectedExceptionMessage(Attribute attribute)
+ {
+ return Reflect.GetPropertyValue(attribute, "ExceptionMessage") as string;
+ }
+
+ public static string GetTestName(Attribute attribute)
+ {
+ return Reflect.GetPropertyValue(attribute, "TestName") as string;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestNameBuilder.cs b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestNameBuilder.cs
new file mode 100644
index 00000000000..676cc19220d
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestNameBuilder.cs
@@ -0,0 +1,92 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+using System.Reflection;
+using System.Text;
+
+namespace NUnit.Core.Extensions.RowTest
+{
+ public class RowTestNameBuilder
+ {
+ private MethodInfo _method;
+ private string _baseTestName;
+ private object[] _arguments;
+ private string _argumentList;
+
+ public RowTestNameBuilder(MethodInfo method, string baseTestName, object[] arguments)
+ {
+ _method = method;
+ _baseTestName = baseTestName;
+ _arguments = arguments;
+ }
+
+ public MethodInfo Method
+ {
+ get { return _method; }
+ }
+
+ public string BaseTestName
+ {
+ get { return _baseTestName; }
+ }
+
+ public object[] Arguments
+ {
+ get { return _arguments; }
+ }
+
+ public string TestName
+ {
+ get
+ {
+ string baseTestName = _baseTestName;
+
+ if (baseTestName == null || baseTestName.Length == 0)
+ baseTestName = _method.Name;
+
+ return baseTestName + GetArgumentList();
+ }
+ }
+
+ public string FullTestName
+ {
+ get { return _method.DeclaringType.FullName + "." + TestName; }
+ }
+
+ private string GetArgumentList()
+ {
+ if (_argumentList == null)
+ _argumentList = "(" + CreateArgumentList() + ")";
+
+ return _argumentList;
+ }
+
+ private string CreateArgumentList()
+ {
+ if (_arguments == null)
+ return "null";
+
+ StringBuilder argumentListBuilder = new StringBuilder();
+
+ for (int i = 0; i < _arguments.Length; i++)
+ {
+ if (i > 0)
+ argumentListBuilder.Append(", ");
+
+ argumentListBuilder.Append (GetArgumentString (_arguments[i]));
+ }
+
+ return argumentListBuilder.ToString();
+ }
+
+ private string GetArgumentString (object argument)
+ {
+ if (argument == null)
+ return "null";
+
+ return argument.ToString();
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestSuite.cs b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestSuite.cs
new file mode 100644
index 00000000000..da7451521c4
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/RowTest/RowTestSuite.cs
@@ -0,0 +1,50 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+using System.Reflection;
+using NUnit.Core;
+
+namespace NUnit.Core.Extensions.RowTest
+{
+ public class RowTestSuite : TestSuite
+ {
+ private static string GetParentName(MethodInfo method)
+ {
+ if (method == null)
+ throw new ArgumentNullException("method");
+
+ return method.DeclaringType.ToString();
+ }
+
+ private static string GetTestName(MethodInfo method)
+ {
+ if (method == null)
+ throw new ArgumentNullException("method");
+
+ return method.Name;
+ }
+
+ public RowTestSuite(MethodInfo method)
+ : base (GetParentName(method), GetTestName(method))
+ {
+ }
+
+ public override TestResult Run(EventListener listener, ITestFilter filter)
+ {
+ if (this.Parent != null)
+ this.Fixture = this.Parent.Fixture;
+
+ return base.Run(listener, filter);
+ }
+
+ protected override void DoOneTimeSetUp(TestResult suiteResult)
+ {
+ }
+
+ protected override void DoOneTimeTearDown(TestResult suiteResult)
+ {
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.build b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.build
new file mode 100644
index 00000000000..7ec0aa6d7e5
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.build
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<project name="NUnitCoreExtensions" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.core.extensions.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="RepeatedTestCase.cs"/>
+ <include name="RepeatedTestDecorator.cs"/>
+ <include name="RowTest/*.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.core.interfaces.dll"/>
+ <include name="nunit.core.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitExtensions/core">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.csproj b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.csproj
new file mode 100644
index 00000000000..a0fb70f3e5a
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.csproj
@@ -0,0 +1,151 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{98B10E98-003C-45A0-9587-119142E39986}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.core.extensions"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Core.Extensions"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "..\..\..\..\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.core.dll"
+ Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.interfaces.dll"
+ Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RepeatedTestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RepeatedTestDecorator.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestAddIn.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestFactory.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestFramework.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestNameBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestSuite.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.sources b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.sources
new file mode 100644
index 00000000000..0e47ede30e0
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll.sources
@@ -0,0 +1,10 @@
+../../CommonAssemblyInfo.cs
+AssemblyInfo.cs
+RepeatedTestCase.cs
+RepeatedTestDecorator.cs
+RowTest/RowTestAddIn.cs
+RowTest/RowTestCase.cs
+RowTest/RowTestFactory.cs
+RowTest/RowTestFramework.cs
+RowTest/RowTestNameBuilder.cs
+RowTest/RowTestSuite.cs
diff --git a/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll_VS2005.csproj b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll_VS2005.csproj
new file mode 100644
index 00000000000..0c53c59fade
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/core/nunit.core.extensions.dll_VS2005.csproj
@@ -0,0 +1,85 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{98B10E98-003C-45A0-9587-119142E39986}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.core.extensions</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Core.Extensions</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="RepeatedTestCase.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="RepeatedTestDecorator.cs" />
+ <Compile Include="RowTest\RowTestAddIn.cs" />
+ <Compile Include="RowTest\RowTestCase.cs" />
+ <Compile Include="RowTest\RowTestFactory.cs" />
+ <Compile Include="RowTest\RowTestFramework.cs" />
+ <Compile Include="RowTest\RowTestNameBuilder.cs" />
+ <Compile Include="RowTest\RowTestSuite.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\NUnitCore\core\nunit.core.dll_VS2005.csproj">
+ <Project>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</Project>
+ <Name>nunit.core.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
+ <Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
+ <Name>nunit.core.interfaces.dll_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitExtensions/docs/RowTest/License.txt b/mcs/nunit24/NUnitExtensions/docs/RowTest/License.txt
new file mode 100644
index 00000000000..44d10b59484
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/docs/RowTest/License.txt
@@ -0,0 +1,22 @@
+Copyright (c) 2007 Andreas Schlapsi
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
diff --git a/mcs/nunit24/NUnitExtensions/docs/RowTest/Release Notes.txt b/mcs/nunit24/NUnitExtensions/docs/RowTest/Release Notes.txt
new file mode 100644
index 00000000000..0e4459d4823
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/docs/RowTest/Release Notes.txt
@@ -0,0 +1,48 @@
+Version 1.2.2 - (2008-03-27)
+----------------------------
+
+* null cannot be used as argument on .NET Framework 1.1. A new enum value SpecialValue.Null can be
+ used instead. If the RowTest addin finds this value as argument the value will be translated to
+ null.
+* Fixed Bug: Common NUnit attributes like Category, Description etc. don't work for RowTest
+ methods.
+
+
+Version 1.2.1 - (2008-02-17)
+----------------------------
+
+* Fixed Bug: SetUp and TearDown are not called on RowTestSuite.
+* Created new Test project for functional tests and reorganized samples.
+
+
+Version 1.2.0 - (2008-01-29)
+----------------------------
+
+* Added build for .NET Framework 1.1.
+* Assemblies are now strongly named.
+* Added ExceptionMessage property to the [Row] attribute. It can be used to specify the
+ message of an expected exception.
+* Added TestName property to the [Row] attribute. It is used to provide a custom name
+ of the test. If TestName is null or empty the method name will be used.
+* Fixed Bug: TestFixtureSetUp and TestFixtureTearDown are not called on the RowTest
+ TestSuite.
+* Fixed Bug: When a TestFixture contains both RowTests and normal unit tests the row tests
+ are not alphabetically ordered.
+
+
+Version 1.1.0 - (2007-10-27)
+----------------------------
+
+* Added ExpectedException property to the [Row] attribute. It can be used to specify
+ which type of exception to expect when the given data is passed to the test.
+* The [Row] attribute accepts now null values.
+* Removed dependency from assembly NUnitExtension.RowTest.AddIn to NUnitExtension.RowTest.
+
+
+Version 1.0.0 - (2007-08-17)
+----------------------------
+
+Initial release.
+
+* Data-driven tests can be marked with the [RowTest] attribute.
+* Data for a RowTest can be specified by using the [Row] attribute.
diff --git a/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs b/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs
new file mode 100644
index 00000000000..a9553f691cd
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitExtensions/framework/Makefile b/mcs/nunit24/NUnitExtensions/framework/Makefile
new file mode 100644
index 00000000000..8dd43abde7f
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/Makefile
@@ -0,0 +1,29 @@
+thisdir = nunit24/NUnitExtensions/framework
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit.framework.extensions.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LIB_MCS_FLAGS = -debug /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly
+NO_TEST = yo
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+EXTRA_DISTFILES = \
+ nunit.framework.extensions.dll.csproj \
+ nunit.framework.extensions.dll_VS2005.csproj
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/NUnitExtensions/framework/RepeatAttribute.cs b/mcs/nunit24/NUnitExtensions/framework/RepeatAttribute.cs
new file mode 100644
index 00000000000..1af79b60817
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/RepeatAttribute.cs
@@ -0,0 +1,37 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework.Extensions
+{
+ /// <summary>
+ /// RepeatAttribute may be applied to test case in order
+ /// to run it multiple times.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class RepeatAttribute : Attribute
+ {
+ private int count;
+
+ /// <summary>
+ /// Construct a RepeatAttribute
+ /// </summary>
+ /// <param name="count">The number of times to run the test</param>
+ public RepeatAttribute(int count)
+ {
+ this.count = count;
+ }
+
+ /// <summary>
+ /// Gets the number of times to run the test.
+ /// </summary>
+ public int Count
+ {
+ get { return count; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/RowAttribute.cs b/mcs/nunit24/NUnitExtensions/framework/RowAttribute.cs
new file mode 100644
index 00000000000..6d656221a70
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/RowAttribute.cs
@@ -0,0 +1,67 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+
+namespace NUnitExtension.RowTest
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public sealed class RowAttribute : Attribute
+ {
+ private string _testName;
+ private object[] _arguments;
+ private string _description;
+ private Type _expectedExceptionType;
+ private string _exceptionMessage;
+
+ public RowAttribute(object argument1)
+ {
+ _arguments = new object[] { argument1 };
+ }
+
+ public RowAttribute(object argument1, object argument2)
+ {
+ _arguments = new object[] { argument1, argument2 };
+ }
+
+ public RowAttribute(object argument1, object argument2, object argument3)
+ {
+ _arguments = new object[] { argument1, argument2, argument3 };
+ }
+
+ public RowAttribute(params object[] arguments)
+ {
+ _arguments = arguments;
+ }
+
+ public string TestName
+ {
+ get { return _testName; }
+ set { _testName = value; }
+ }
+
+ public object[] Arguments
+ {
+ get { return _arguments; }
+ }
+
+ public string Description
+ {
+ get { return _description; }
+ set { _description = value; }
+ }
+
+ public Type ExpectedException
+ {
+ get { return _expectedExceptionType; }
+ set { _expectedExceptionType = value; }
+ }
+
+ public string ExceptionMessage
+ {
+ get { return _exceptionMessage; }
+ set { _exceptionMessage = value; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/RowTest/RowAttribute.cs b/mcs/nunit24/NUnitExtensions/framework/RowTest/RowAttribute.cs
new file mode 100644
index 00000000000..4d75f3fff31
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/RowTest/RowAttribute.cs
@@ -0,0 +1,67 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+
+namespace NUnit.Framework.Extensions
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
+ public sealed class RowAttribute : Attribute
+ {
+ private string _testName;
+ private object[] _arguments;
+ private string _description;
+ private Type _expectedExceptionType;
+ private string _exceptionMessage;
+
+ public RowAttribute(object argument1)
+ {
+ _arguments = new object[] { argument1 };
+ }
+
+ public RowAttribute(object argument1, object argument2)
+ {
+ _arguments = new object[] { argument1, argument2 };
+ }
+
+ public RowAttribute(object argument1, object argument2, object argument3)
+ {
+ _arguments = new object[] { argument1, argument2, argument3 };
+ }
+
+ public RowAttribute(params object[] arguments)
+ {
+ _arguments = arguments;
+ }
+
+ public string TestName
+ {
+ get { return _testName; }
+ set { _testName = value; }
+ }
+
+ public object[] Arguments
+ {
+ get { return _arguments; }
+ }
+
+ public string Description
+ {
+ get { return _description; }
+ set { _description = value; }
+ }
+
+ public Type ExpectedException
+ {
+ get { return _expectedExceptionType; }
+ set { _expectedExceptionType = value; }
+ }
+
+ public string ExceptionMessage
+ {
+ get { return _exceptionMessage; }
+ set { _exceptionMessage = value; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/RowTest/RowTestAttribute.cs b/mcs/nunit24/NUnitExtensions/framework/RowTest/RowTestAttribute.cs
new file mode 100644
index 00000000000..7370054a8cd
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/RowTest/RowTestAttribute.cs
@@ -0,0 +1,13 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+
+namespace NUnit.Framework.Extensions
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
+ public sealed class RowTestAttribute : Attribute
+ {
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/RowTest/SpecialValue.cs b/mcs/nunit24/NUnitExtensions/framework/RowTest/SpecialValue.cs
new file mode 100644
index 00000000000..da0aebeb425
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/RowTest/SpecialValue.cs
@@ -0,0 +1,13 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+
+namespace NUnit.Framework.Extensions
+{
+ public enum SpecialValue
+ {
+ Null = 1
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/RowTestAttribute.cs b/mcs/nunit24/NUnitExtensions/framework/RowTestAttribute.cs
new file mode 100644
index 00000000000..35ca2ecbef7
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/RowTestAttribute.cs
@@ -0,0 +1,13 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+
+namespace NUnitExtension.RowTest
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
+ public sealed class RowTestAttribute : Attribute
+ {
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/SpecialValue.cs b/mcs/nunit24/NUnitExtensions/framework/SpecialValue.cs
new file mode 100644
index 00000000000..81c84ef9dbe
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/SpecialValue.cs
@@ -0,0 +1,13 @@
+// *********************************************************************
+// Copyright 2007, Andreas Schlapsi
+// This is free software licensed under the MIT license.
+// *********************************************************************
+using System;
+
+namespace NUnitExtension.RowTest
+{
+ public enum SpecialValue
+ {
+ Null = 1
+ }
+}
diff --git a/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.build b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.build
new file mode 100644
index 00000000000..148a5b6027d
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.build
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<project name="NUnitFrameworkExtensions" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.framework.extensions.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="RepeatAttribute.cs"/>
+ <include name="RowTest/RowAttribute.cs"/>
+ <include name="RowTest/RowTestAttribute.cs"/>
+ <include name="RowTest/SpecialValue.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.framework.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitExtensions/framework">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.csproj b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.csproj
new file mode 100644
index 00000000000..2f4a7679836
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.csproj
@@ -0,0 +1,126 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{486C498D-B9F8-477F-ACA7-CED9245BBFCF}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.framework.extensions"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Framework.Extensions"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.framework.dll"
+ Project = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RepeatAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\RowTestAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "RowTest\SpecialValue.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.sources b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.sources
new file mode 100644
index 00000000000..e4ebef34dcf
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll.sources
@@ -0,0 +1,9 @@
+../../CommonAssemblyInfo.cs
+AssemblyInfo.cs
+RepeatAttribute.cs
+RowAttribute.cs
+RowTest/RowAttribute.cs
+RowTest/RowTestAttribute.cs
+RowTest/SpecialValue.cs
+RowTestAttribute.cs
+SpecialValue.cs
diff --git a/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll_VS2005.csproj b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll_VS2005.csproj
new file mode 100644
index 00000000000..1afbe437ecd
--- /dev/null
+++ b/mcs/nunit24/NUnitExtensions/framework/nunit.framework.extensions.dll_VS2005.csproj
@@ -0,0 +1,105 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{486C498D-B9F8-477F-ACA7-CED9245BBFCF}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.framework.extensions</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Framework.Extensions</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <OutputPath>bin\Debug\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="RepeatAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="RowTest\RowAttribute.cs" />
+ <Compile Include="RowTest\RowTestAttribute.cs" />
+ <Compile Include="RowTest\SpecialValue.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/AssemblyRunner.cs b/mcs/nunit24/NUnitFixtures/fixtures/AssemblyRunner.cs
new file mode 100644
index 00000000000..1bced0deaab
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/AssemblyRunner.cs
@@ -0,0 +1,30 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+namespace NUnit.Fixtures
+{
+ /// <summary>
+ /// Summary description for AssemblyRunner.
+ /// </summary>
+ public class AssemblyRunner : TestLoadFixture
+ {
+ public string Assembly;
+
+ // Override doCell to handle the 'Code' column. We compile
+ // the code and optionally load and run the tests.
+ public override void doCell(fit.Parse cell, int columnNumber)
+ {
+ base.doCell (cell, columnNumber);
+
+ FieldInfo field = columnBindings[columnNumber].field;
+ if ( field != null && field.Name == "Assembly" )
+ LoadAndRunTestAssembly( cell, Assembly );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/PlatformInfo.cs b/mcs/nunit24/NUnitFixtures/fixtures/PlatformInfo.cs
new file mode 100644
index 00000000000..365be130a78
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/PlatformInfo.cs
@@ -0,0 +1,36 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Fixtures
+{
+ /// <summary>
+ /// PlatformFixture simply displays info about the platform
+ /// we are running on.
+ /// </summary>
+ public class PlatformInfo : fit.Fixture
+ {
+ public override void doTable(fit.Parse table)
+ {
+ table.parts.more =
+ tr( td( "platform", td( Environment.OSVersion.ToString(), null ) ),
+ tr( td( "clrVersion", td( Environment.Version.ToString(), null ) ),
+ null ) );
+
+ }
+
+ private fit.Parse tr( fit.Parse parts, fit.Parse more)
+ {
+ return new fit.Parse ("tr", null, parts, more);
+ }
+
+ private fit.Parse td(string body, fit.Parse more)
+ {
+ return new fit.Parse ("td", info(body), null, more);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/SnippetRunner.cs b/mcs/nunit24/NUnitFixtures/fixtures/SnippetRunner.cs
new file mode 100644
index 00000000000..22ea204857e
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/SnippetRunner.cs
@@ -0,0 +1,87 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Text;
+using System.Reflection;
+using System.Collections;
+using System.CodeDom.Compiler;
+using NUnit.Core;
+using NUnit.Util;
+
+namespace NUnit.Fixtures
+{
+ /// <summary>
+ /// Abstract base class for fixtures that compile a snippet of code.
+ /// The fixture is basically a column fixture with one input column
+ /// dedicated to containing the code that is to be compiled. This
+ /// will normally be the first column
+ /// </summary>
+ public class SnippetRunner : TestLoadFixture
+ {
+ public string Code;
+
+ private static readonly string testAssembly = "test.dll";
+
+ // Override doCell to handle the 'Code' column. We compile
+ // the code and optionally load and run the tests.
+ public override void doCell(fit.Parse cell, int columnNumber)
+ {
+ base.doCell (cell, columnNumber);
+
+ FieldInfo field = columnBindings[columnNumber].field;
+ if ( field != null && field.Name == "Code" && CompileCodeSnippet( cell, Code ) )
+ LoadAndRunTestAssembly( cell, testAssembly );
+ }
+
+ private bool CompileCodeSnippet( fit.Parse cell, string code )
+ {
+ TestCompiler compiler = new TestCompiler(
+ new string[] { "system.dll", "nunit.framework.dll" },
+ testAssembly );
+
+ CompilerResults results = compiler.CompileCode( code );
+ if ( results.NativeCompilerReturnValue == 0 )
+ return true;
+
+ cell.addToBody( "<font size=-1 color=\"#c08080\"><i>Compiler errors</i></font>" );
+
+ wrong( cell );
+ cell.addToBody( "<hr>" );
+
+ foreach( string line in results.Output )
+ cell.addToBody( line + "<br>" );
+
+ return true;
+ }
+
+ public TestTree Tree()
+ {
+ if ( testRunner.Test == null )
+ return new TestTree( "NULL" );
+
+ if ( testRunner.Test.Tests.Count == 0 )
+ return new TestTree( "EMPTY" );
+
+ StringBuilder sb = new StringBuilder();
+ AppendTests( sb, "", testRunner.Test.Tests );
+
+ return new TestTree( sb.ToString() );
+ }
+
+ private void AppendTests( StringBuilder sb, string prefix, IList tests )
+ {
+ foreach( TestNode test in tests )
+ {
+ sb.Append( prefix );
+ sb.Append( test.TestName.Name );
+ sb.Append( Environment.NewLine );
+ if ( test.Tests != null )
+ AppendTests( sb, prefix + ">", test.Tests );
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/TestCompiler.cs b/mcs/nunit24/NUnitFixtures/fixtures/TestCompiler.cs
new file mode 100644
index 00000000000..644120fb283
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/TestCompiler.cs
@@ -0,0 +1,50 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.CodeDom.Compiler;
+
+namespace NUnit.Fixtures
+{
+ /// <summary>
+ /// Summary description for CSharpCompiler.
+ /// </summary>
+ public class TestCompiler
+ {
+ ICodeCompiler compiler;
+ CompilerParameters options;
+
+ public TestCompiler() : this( null, null ) { }
+
+ public TestCompiler( string[] assemblyNames ) : this( assemblyNames, null ) { }
+
+ public TestCompiler( string[] assemblyNames, string outputName )
+ {
+ Microsoft.CSharp.CSharpCodeProvider provider = new Microsoft.CSharp.CSharpCodeProvider();
+ this.compiler = provider.CreateCompiler();
+ this.options = new CompilerParameters();
+
+ if ( assemblyNames != null && assemblyNames.Length > 0 )
+ options.ReferencedAssemblies.AddRange( assemblyNames );
+ if ( outputName != null )
+ options.OutputAssembly = outputName;
+
+ options.IncludeDebugInformation = false;
+ options.TempFiles = new TempFileCollection( ".", false );
+ options.GenerateInMemory = false;
+ }
+
+ public CompilerParameters Options
+ {
+ get { return options; }
+ }
+
+ public CompilerResults CompileCode( string code )
+ {
+ return compiler.CompileAssemblyFromSource( options, code );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/TestLoadFixture.cs b/mcs/nunit24/NUnitFixtures/fixtures/TestLoadFixture.cs
new file mode 100644
index 00000000000..22fa5afed89
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/TestLoadFixture.cs
@@ -0,0 +1,76 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+using NUnit.Core;
+using NUnit.Util;
+
+namespace NUnit.Fixtures
+{
+ /// <summary>
+ /// Abstract base class for fixtures that load and run a test assembly.
+ /// </summary>
+ public abstract class TestLoadFixture : fit.ColumnFixture
+ {
+ protected TestRunner testRunner;
+ protected TestResult testResult;
+ protected ResultSummarizer testSummary;
+
+ protected void LoadAndRunTestAssembly( fit.Parse cell, string testAssembly )
+ {
+ testRunner = new TestDomain();
+
+ if ( !testRunner.Load( new TestPackage(testAssembly) ) )
+ {
+ this.wrong(cell);
+ cell.addToBody( string.Format(
+ "<font size=-1 color=\"#c08080\"> <i>Failed to load {0}</i></font>", testAssembly ) );
+
+ return;
+ }
+
+ testResult = testRunner.Run(NullListener.NULL);
+ testSummary = new ResultSummarizer( testResult );
+
+ this.right( cell );
+ }
+
+ public override void wrong(fit.Parse cell)
+ {
+ string body = cell.body;
+ base.wrong (cell);
+ cell.body = body;
+ }
+
+ public int Skipped()
+ {
+ return testRunner.Test.TestCount - testSummary.ResultCount - testSummary.IgnoreCount;
+ }
+
+ public int Tests()
+ {
+ return testRunner.Test.TestCount;
+ }
+
+ public int Run()
+ {
+ return testSummary.ResultCount;
+ }
+
+ public int Failures()
+ {
+ return testSummary.FailureCount;
+ }
+
+ public int Ignored()
+ {
+ return testSummary.IgnoreCount;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/TestTree.cs b/mcs/nunit24/NUnitFixtures/fixtures/TestTree.cs
new file mode 100644
index 00000000000..dda3f0b57ce
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/TestTree.cs
@@ -0,0 +1,52 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Fixtures
+{
+ /// <summary>
+ /// TestTree provides a simple, character-based representation of
+ /// a loaded tree of tests and is used for comparing actual and
+ /// expected tree values.
+ /// </summary>
+ public class TestTree
+ {
+ string display;
+ string signature;
+
+ public static TestTree Parse( string display )
+ {
+ return new TestTree( display );
+ }
+
+ public TestTree( string display )
+ {
+ this.display = display;
+ this.signature = display.Trim().Replace( Environment.NewLine, "+" ).Replace( " ", "+" );
+ }
+
+ public override string ToString()
+ {
+ return this.display;
+ }
+
+ public override bool Equals(object obj)
+ {
+ bool ok = obj is TestTree && ((TestTree)obj).signature == this.signature;
+// System.Diagnostics.Debug.Assert( ok );
+ return ok;
+ }
+
+ public override int GetHashCode()
+ {
+ return signature.GetHashCode ();
+ }
+
+
+
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.build b/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.build
new file mode 100644
index 00000000000..56227f76e37
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.build
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<project name="NUnitFixtures" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.fixtures.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources >
+ <include name="AssemblyRunner.cs" asis="true"/>
+ <include name="PlatformInfo.cs" asis="true"/>
+ <include name="SnippetRunner.cs" asis="true"/>
+ <include name="TestLoadFixture.cs" asis="true"/>
+ <include name="TestCompiler.cs" asis="true"/>
+ <include name="TestTree.cs" asis="true"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="618" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.core.interfaces.dll"/>
+ <include name="nunit.core.dll"/>
+ <include name="nunit.util.dll"/>
+ <include name="${fit.dir}/fit.dll"/>
+ </references>
+ </csc>
+
+ <copy todir="${current.build.dir}">
+ <fileset basedir="${fit.dir}">
+ <include name="fit.dll"/>
+ <include name="runFile.exe"/>
+ <include name="runFile.exe.config"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitFixtures/fixtures">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.csproj b/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.csproj
new file mode 100644
index 00000000000..727589ffd4c
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures.csproj
@@ -0,0 +1,146 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.fixtures"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Fixtures"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "fit"
+ AssemblyName = "fit"
+ HintPath = "..\..\..\tools\fit\fit.dll"
+ />
+ <Reference
+ Name = "nunit.core.dll"
+ Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.interfaces.dll"
+ Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.util.dll"
+ Project = "{61CE9CE5-943E-44D4-A381-814DC1406767}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PlatformInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SnippetRunner.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestCompiler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestLoadFixture.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestTree.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures_VS2005.csproj b/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures_VS2005.csproj
new file mode 100644
index 00000000000..f10b4419fa3
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/fixtures/nunit.fixtures_VS2005.csproj
@@ -0,0 +1,144 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <DebugType>
+ </DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ <NoWarn>618</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{67D6949E-F4D2-4821-B02B-4AAFC3F18B52}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.fixtures</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Fixtures</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\Debug\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="fit">
+ <Name>fit</Name>
+ <HintPath>..\..\..\tools\fit\fit.dll</HintPath>
+ </Reference>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <ProjectReference Include="..\..\ClientUtilities\util\nunit.util.dll_VS2005.csproj">
+ <Name>nunit.util.dll_VS2005</Name>
+ <Project>{61CE9CE5-943E-44D4-A381-814DC1406767}</Project>
+ <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\core\nunit.core.dll_VS2005.csproj">
+ <Name>nunit.core.dll_VS2005</Name>
+ <Project>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</Project>
+ <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
+ <Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
+ <Name>nunit.core.interfaces.dll_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyRunner.cs" />
+ <Compile Include="PlatformInfo.cs" />
+ <Compile Include="SnippetRunner.cs" />
+ <Compile Include="TestCompiler.cs" />
+ <Compile Include="TestLoadFixture.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestTree.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFixtures/tests/AssemblyInfo.cs b/mcs/nunit24/NUnitFixtures/tests/AssemblyInfo.cs
new file mode 100644
index 00000000000..177a4f0e70a
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/tests/AssemblyInfo.cs
@@ -0,0 +1,58 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly: AssemblyTitle("")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+//
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+
+[assembly: AssemblyVersion("1.0.*")]
+
+//
+// In order to sign your assembly you must specify a key to use. Refer to the
+// Microsoft .NET Framework documentation for more information on assembly signing.
+//
+// Use the attributes below to control which key is used for signing.
+//
+// Notes:
+// (*) If no key is specified, the assembly is not signed.
+// (*) KeyName refers to a key that has been installed in the Crypto Service
+// Provider (CSP) on your machine. KeyFile refers to a file which contains
+// a key.
+// (*) If the KeyFile and the KeyName values are both specified, the
+// following processing occurs:
+// (1) If the KeyName can be found in the CSP, that key is used.
+// (2) If the KeyName does not exist and the KeyFile does exist, the key
+// in the KeyFile is installed into the CSP and used.
+// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
+// When specifying the KeyFile, the location of the KeyFile should be
+// relative to the project output directory which is
+// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
+// located in the project directory, you would specify the AssemblyKeyFile
+// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
+// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
+// documentation for more information on this.
+//
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitFixtures/tests/CompilationTests.cs b/mcs/nunit24/NUnitFixtures/tests/CompilationTests.cs
new file mode 100644
index 00000000000..44ddb5a92bf
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/tests/CompilationTests.cs
@@ -0,0 +1,97 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.CodeDom.Compiler;
+using NUnit.Framework;
+using NUnit.Core;
+using NUnit.Util;
+
+namespace NUnit.Fixtures.Tests
+{
+ /// <summary>
+ /// Summary description for CompilationTests.
+ /// </summary>
+ [TestFixture,Platform(Exclude="Mono",Reason="Holds output file open")]
+ public class CompilationTests
+ {
+ private TestCompiler compiler;
+ private static string[] references = new string[] { "System.dll", "nunit.framework.dll" };
+ private static string outputName = "test.dll";
+ private static string goodCode =
+@"using System;
+using NUnit.Framework;
+
+namespace My.Namespace
+{
+ [TestFixture] public class SomeClass
+ {
+ [Test] public void ThisMethod() { }
+ [Test] public void ThatMethod() { }
+ }
+}";
+
+ [SetUp]
+ public void CreateCompiler()
+ {
+ this.compiler = new TestCompiler( references, outputName );
+ }
+
+ [TearDown]
+ public void RemoveOutputFile()
+ {
+ if ( File.Exists( outputName ) )
+ File.Delete( outputName );
+ }
+
+ [Test]
+ public void CheckDefaultSettings()
+ {
+ CollectionAssert.AreEqual( references, compiler.Options.ReferencedAssemblies );
+ Assert.AreEqual( outputName, compiler.Options.OutputAssembly );
+
+ Assert.IsFalse( compiler.Options.IncludeDebugInformation, "IncludeDebugInformation" );
+ Assert.IsFalse( compiler.Options.GenerateInMemory, "GenerateInMemory" );
+ Assert.IsFalse( compiler.Options.GenerateExecutable, "GenerateExecutable" );
+ }
+
+ [Test]
+ public void CompileToFile()
+ {
+ CompilerResults results = compiler.CompileCode( goodCode );
+ Assert.AreEqual( 0, results.NativeCompilerReturnValue );
+ Assert.IsNotNull( results.CompiledAssembly );
+ Assert.IsTrue( File.Exists( outputName ) );
+ }
+
+ [Test]
+ public void CompilingBadCodeGivesAnError()
+ {
+ string badCode = goodCode.Replace( "void", "vide" );
+ Assert.AreNotEqual( 0, compiler.CompileCode( badCode ).NativeCompilerReturnValue );
+ }
+
+ [Test]
+ public void LoadTestsFromCompiledAssembly()
+ {
+ CompilerResults results = compiler.CompileCode( goodCode );
+ Assert.AreEqual( 0, results.NativeCompilerReturnValue );
+
+ TestRunner runner = new SimpleTestRunner();
+
+ try
+ {
+ Assert.IsTrue( runner.Load( new TestPackage( outputName ) ) );
+ Assert.AreEqual( 2, runner.Test.TestCount );
+ }
+ finally
+ {
+ runner.Unload();
+ }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/tests/TestTreeTests.cs b/mcs/nunit24/NUnitFixtures/tests/TestTreeTests.cs
new file mode 100644
index 00000000000..b7832ab0f20
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/tests/TestTreeTests.cs
@@ -0,0 +1,53 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using NUnit.Framework;
+
+namespace NUnit.Fixtures.Tests
+{
+ /// <summary>
+ /// Summary description for TestTreeTests.
+ /// </summary>
+ [TestFixture]
+ public class TestTreeTests
+ {
+ static TestTree tree1 = new TestTree(
+ "SomeClass" + Environment.NewLine +
+ ">Test1" + Environment.NewLine +
+ ">Test2" + Environment.NewLine +
+ ">Test3" + Environment.NewLine +
+ "AnotherClass" + Environment.NewLine +
+ ">Test4" + Environment.NewLine +
+ ">Test5" );
+
+ static TestTree tree2 = new TestTree(
+ "SomeClass >Test1 >Test2 >Test3" + Environment.NewLine +
+ "AnotherClass >Test4 >Test5" );
+
+ static TestTree tree3 = new TestTree(
+ "SomeClass >Test1 >Test2 >Test3 AnotherClass >Test4 >Test5" );
+
+ static TestTree tree4 = new TestTree(
+ "SomeClass >Test1 >TestX >Test3 AnotherClass >Test4 >Test5" );
+
+ [Test]
+ public void MatchingTreesAreEqual()
+ {
+ Assert.AreEqual( tree1, tree1 );
+ Assert.AreEqual( tree1, tree2 );
+ Assert.AreEqual( tree1, tree3 );
+ }
+
+ [Test]
+ public void NonMatchingTreesAreNotEqual()
+ {
+ Assert.AreNotEqual( tree1, tree4 );
+ Assert.AreNotEqual( tree2, tree4 );
+ Assert.AreNotEqual( tree3, tree4 );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.build b/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.build
new file mode 100644
index 00000000000..0be2fd25909
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.build
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<project name="NUnitFixtureTests" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.fixtures.tests.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="CompilationTests.cs"/>
+ <include name="TestTreeTests.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.framework.dll"/>
+ <include name="nunit.core.interfaces.dll"/>
+ <include name="nunit.core.dll"/>
+ <include name="nunit.util.dll"/>
+ <include name="nunit.fixtures.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitFixtures/tests">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.csproj b/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.csproj
new file mode 100644
index 00000000000..97cc3569431
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests.csproj
@@ -0,0 +1,136 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{55F2D231-743C-48DD-B79A-00E5A7236CBE}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.fixtures.tests"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Fixtures.Tests"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "nunit.framework.dll"
+ Project = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.fixtures"
+ Project = "{A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.interfaces.dll"
+ Project = "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.util.dll"
+ Project = "{61CE9CE5-943E-44D4-A381-814DC1406767}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.core.tests"
+ Project = "{DD758D21-E5D5-4D40-9450-5F65A32F359C}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ <Reference
+ Name = "nunit.core.dll"
+ Project = "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CompilationTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestTreeTests.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests_VS2005.csproj b/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests_VS2005.csproj
new file mode 100644
index 00000000000..54b006e09cc
--- /dev/null
+++ b/mcs/nunit24/NUnitFixtures/tests/nunit.fixtures.tests_VS2005.csproj
@@ -0,0 +1,147 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{55F2D231-743C-48DD-B79A-00E5A7236CBE}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.fixtures.tests</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Fixtures.Tests</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>true</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>false</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>full</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\Release\</OutputPath>
+ <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+ <BaseAddress>285212672</BaseAddress>
+ <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+ <ConfigurationOverrideFile>
+ </ConfigurationOverrideFile>
+ <DefineConstants>TRACE</DefineConstants>
+ <DocumentationFile>
+ </DocumentationFile>
+ <DebugSymbols>false</DebugSymbols>
+ <FileAlignment>4096</FileAlignment>
+ <NoStdLib>false</NoStdLib>
+ <NoWarn>
+ </NoWarn>
+ <Optimize>true</Optimize>
+ <RegisterForComInterop>false</RegisterForComInterop>
+ <RemoveIntegerChecks>false</RemoveIntegerChecks>
+ <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+ <WarningLevel>4</WarningLevel>
+ <DebugType>none</DebugType>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <DebugType>
+ </DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <DebugType>full</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisRuleAssemblies>\rules</CodeAnalysisRuleAssemblies>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <ProjectReference Include="..\..\ClientUtilities\util\nunit.util.dll_VS2005.csproj">
+ <Project>{61CE9CE5-943E-44D4-A381-814DC1406767}</Project>
+ <Name>nunit.util.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\core\nunit.core.dll_VS2005.csproj">
+ <Project>{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}</Project>
+ <Name>nunit.core.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj">
+ <Project>{DCC88998-255A-4247-B658-71DD932E9873}</Project>
+ <Name>nunit.core.interfaces.dll_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitCore\tests\nunit.core.tests_VS2005.csproj">
+ <Project>{DD758D21-E5D5-4D40-9450-5F65A32F359C}</Project>
+ <Name>nunit.core.tests_VS2005</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\NUnitFramework\framework\nunit.framework.dll_VS2005.csproj">
+ <Name>nunit.framework.dll</Name>
+ <Project>{83DD7E12-A705-4DBA-9D71-09C8973D9382}</Project>
+ <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
+ </ProjectReference>
+ <ProjectReference Include="..\fixtures\nunit.fixtures_VS2005.csproj">
+ <Project>{67D6949E-F4D2-4821-B02B-4AAFC3F18B52}</Project>
+ <Name>nunit.fixtures_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="CompilationTests.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestTreeTests.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFramework/framework/AbstractAsserter.cs b/mcs/nunit24/NUnitFramework/framework/AbstractAsserter.cs
new file mode 100644
index 00000000000..c3784ebaef2
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/AbstractAsserter.cs
@@ -0,0 +1,88 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// NOTE: The use of asserters for extending NUnit has
+ /// now been replaced by the use of constraints. This
+ /// class is marked obsolete.
+ ///
+ /// AbstractAsserter is the base class for all asserters.
+ /// Asserters encapsulate a condition test and generation
+ /// of an AssertionException with a tailored message. They
+ /// are used by the Assert class as helper objects.
+ ///
+ /// User-defined asserters may be passed to the
+ /// Assert.DoAssert method in order to implement
+ /// extended asserts.
+ /// </summary>
+ [Obsolete("Use Constraints rather than Asserters for new work")]
+ public abstract class AbstractAsserter : IAsserter
+ {
+ /// <summary>
+ /// The user-defined message for this asserter.
+ /// </summary>
+ protected readonly string userMessage;
+
+ /// <summary>
+ /// Arguments to use in formatting the user-defined message.
+ /// </summary>
+ protected readonly object[] args;
+
+ /// <summary>
+ /// Our failure message object, initialized as needed
+ /// </summary>
+ private AssertionFailureMessage failureMessage;
+
+ /// <summary>
+ /// Constructs an AbstractAsserter
+ /// </summary>
+ /// <param name="message">The message issued upon failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public AbstractAsserter( string message, params object[] args )
+ {
+ this.userMessage = message;
+ this.args = args;
+ }
+
+ /// <summary>
+ /// AssertionFailureMessage object used internally
+ /// </summary>
+ protected AssertionFailureMessage FailureMessage
+ {
+ get
+ {
+ if ( failureMessage == null )
+ failureMessage = new AssertionFailureMessage( userMessage, args );
+ return failureMessage;
+ }
+ }
+
+ #region IAsserter Interface
+ /// <summary>
+ /// Test method to be implemented by derived types.
+ /// Default always succeeds.
+ /// </summary>
+ /// <returns>True if the test succeeds</returns>
+ public abstract bool Test();
+
+ /// <summary>
+ /// Message related to a failure. If no failure has
+ /// occured, the result is unspecified.
+ /// </summary>
+ public virtual string Message
+ {
+ get
+ {
+ return FailureMessage.ToString();
+ }
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs b/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs
new file mode 100644
index 00000000000..fa86732b3d3
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/AssemblyInfo.cs
@@ -0,0 +1,14 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitFramework/framework/Assert.cs b/mcs/nunit24/NUnitFramework/framework/Assert.cs
new file mode 100644
index 00000000000..f27e6e1eb53
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Assert.cs
@@ -0,0 +1,2960 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using NUnit.Framework.Constraints;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// The Assert class contains a collection of static methods that
+ /// implement the most common assertions used in NUnit.
+ /// </summary>
+ public class Assert
+ {
+ #region Assert Counting
+
+ private static int counter = 0;
+
+ /// <summary>
+ /// Gets the number of assertions executed so far and
+ /// resets the counter to zero.
+ /// </summary>
+ public static int Counter
+ {
+ get
+ {
+ int cnt = counter;
+ counter = 0;
+ return cnt;
+ }
+ }
+
+ private static void IncrementAssertCount()
+ {
+ ++counter;
+ }
+
+ #endregion
+
+ #region Constructor
+
+ /// <summary>
+ /// We don't actually want any instances of this object, but some people
+ /// like to inherit from it to add other static methods. Hence, the
+ /// protected constructor disallows any instances of this object.
+ /// </summary>
+ protected Assert() {}
+
+ #endregion
+
+ #region Equals and ReferenceEquals
+
+ /// <summary>
+ /// The Equals method throws an AssertionException. This is done
+ /// to make sure there is no mistake by calling this function.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static new bool Equals(object a, object b)
+ {
+ throw new AssertionException("Assert.Equals should not be used for Assertions");
+ }
+
+ /// <summary>
+ /// override the default ReferenceEquals to throw an AssertionException. This
+ /// implementation makes sure there is no mistake in calling this function
+ /// as part of Assert.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ public static new void ReferenceEquals(object a, object b)
+ {
+ throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
+ }
+
+ #endregion
+
+ #region IsTrue
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void IsTrue(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.True, message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ static public void IsTrue(bool condition, string message)
+ {
+ Assert.IsTrue(condition, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void IsTrue(bool condition)
+ {
+ Assert.IsTrue(condition, null, null);
+ }
+
+ #endregion
+
+ #region IsFalse
+
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is true</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void IsFalse(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.False, message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is true</param>
+ static public void IsFalse(bool condition, string message)
+ {
+ Assert.IsFalse( condition, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void IsFalse(bool condition)
+ {
+ Assert.IsFalse(condition, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsNotNull
+
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to be displayed when the object is null</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void IsNotNull(Object anObject, string message, params object[] args)
+ {
+ Assert.That(anObject, Is.Not.Null, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to be displayed when the object is null</param>
+ static public void IsNotNull(Object anObject, string message)
+ {
+ Assert.IsNotNull(anObject, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ static public void IsNotNull(Object anObject)
+ {
+ Assert.IsNotNull(anObject, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsNull
+
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to be displayed when the object is not null</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void IsNull(Object anObject, string message, params object[] args)
+ {
+ Assert.That( anObject, Is.Null, message, args );
+ }
+
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to be displayed when the object is not null</param>
+ static public void IsNull(Object anObject, string message)
+ {
+ Assert.IsNull(anObject, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not null <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ static public void IsNull(Object anObject)
+ {
+ Assert.IsNull(anObject, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsNaN
+
+ /// <summary>
+ /// Verifies that the double is passed is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+ /// <param name="message">The message to be displayed when the object is not null</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void IsNaN(double aDouble, string message, params object[] args)
+ {
+ Assert.That(aDouble, Is.NaN, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the double is passed is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The object that is to be tested</param>
+ /// <param name="message">The message to be displayed when the object is not null</param>
+ static public void IsNaN(double aDouble, string message)
+ {
+ Assert.IsNaN(aDouble, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the double is passed is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The object that is to be tested</param>
+ static public void IsNaN(double aDouble)
+ {
+ Assert.IsNaN(aDouble, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsEmpty
+
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsEmpty( string aString, string message, params object[] args )
+ {
+ Assert.That(aString, new EmptyStringConstraint(), message, args);
+ }
+
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Emtpy
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ public static void IsEmpty( string aString, string message )
+ {
+ IsEmpty( aString, message, null );
+ }
+
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Emtpy
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ public static void IsEmpty( string aString )
+ {
+ IsEmpty( aString, string.Empty, null );
+ }
+
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsEmpty( ICollection collection, string message, params object[] args )
+ {
+ Assert.That(collection, new EmptyCollectionConstraint(), message, args);
+ }
+
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ public static void IsEmpty( ICollection collection, string message )
+ {
+ IsEmpty( collection, message, null );
+ }
+
+ /// <summary>
+ /// Assert that an array,list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ public static void IsEmpty( ICollection collection )
+ {
+ IsEmpty( collection, string.Empty, null );
+ }
+ #endregion
+
+ #region IsNotEmpty
+ /// <summary>
+ /// Assert that a string is not empty - that is not equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsNotEmpty( string aString, string message, params object[] args )
+ {
+ Assert.That(aString, Is.Not.Empty, message, args);
+ }
+
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Emtpy
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ public static void IsNotEmpty( string aString, string message )
+ {
+ IsNotEmpty( aString, message, null );
+ }
+
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Emtpy
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ public static void IsNotEmpty( string aString )
+ {
+ IsNotEmpty( aString, string.Empty, null );
+ }
+
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsNotEmpty( ICollection collection, string message, params object[] args )
+ {
+ Assert.That(collection, Is.Not.Empty, message, args);
+ }
+
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ public static void IsNotEmpty( ICollection collection, string message )
+ {
+ IsNotEmpty( collection, message, null );
+ }
+
+ /// <summary>
+ /// Assert that an array,list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ public static void IsNotEmpty( ICollection collection )
+ {
+ IsNotEmpty( collection, string.Empty, null );
+ }
+ #endregion
+
+ #region IsAssignableFrom
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ static public void IsAssignableFrom( System.Type expected, object actual )
+ {
+ IsAssignableFrom(expected, actual, "");
+ }
+
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The messge to display in case of failure</param>
+ static public void IsAssignableFrom( System.Type expected, object actual, string message )
+ {
+ IsAssignableFrom(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ static public void IsAssignableFrom( System.Type expected, object actual, string message, params object[] args )
+ {
+ Assert.That(actual, Is.AssignableFrom(expected), message, args);
+ }
+ #endregion
+
+ #region IsNotAssignableFrom
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ static public void IsNotAssignableFrom( System.Type expected, object actual )
+ {
+ IsNotAssignableFrom(expected, actual, "");
+ }
+
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The messge to display in case of failure</param>
+ static public void IsNotAssignableFrom( System.Type expected, object actual, string message )
+ {
+ IsNotAssignableFrom(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ static public void IsNotAssignableFrom( System.Type expected, object actual, string message, params object[] args )
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(expected), message, args);
+ }
+ #endregion
+
+ #region IsInstanceOfType
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ public static void IsInstanceOfType( System.Type expected, object actual )
+ {
+ IsInstanceOfType( expected, actual, string.Empty, null );
+ }
+
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">A message to display in case of failure</param>
+ public static void IsInstanceOfType( System.Type expected, object actual, string message )
+ {
+ IsInstanceOfType( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">A message to display in case of failure</param>
+ /// <param name="args">An array of objects to be used in formatting the message</param>
+ public static void IsInstanceOfType( System.Type expected, object actual, string message, params object[] args )
+ {
+ Assert.That(actual, Is.InstanceOfType(expected), message, args);
+ }
+ #endregion
+
+ #region IsNotInstanceOfType
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ public static void IsNotInstanceOfType( System.Type expected, object actual )
+ {
+ IsNotInstanceOfType( expected, actual, string.Empty, null );
+ }
+
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">A message to display in case of failure</param>
+ public static void IsNotInstanceOfType( System.Type expected, object actual, string message )
+ {
+ IsNotInstanceOfType( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">A message to display in case of failure</param>
+ /// <param name="args">An array of objects to be used in formatting the message</param>
+ public static void IsNotInstanceOfType( System.Type expected, object actual, string message, params object[] args )
+ {
+ Assert.That(actual, Is.Not.InstanceOfType(expected), message, args);
+ }
+ #endregion
+
+ #region AreEqual
+
+ #region Ints
+
+ /// <summary>
+ /// Verifies that two ints are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(int expected,
+ int actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two ints are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void AreEqual(int expected, int actual, string message)
+ {
+ Assert.AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two ints are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ static public void AreEqual(int expected, int actual)
+ {
+ Assert.AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Longs
+
+ /// <summary>
+ /// Verifies that two longs are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(long expected,
+ long actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two longs are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void AreEqual(long expected, long actual, string message)
+ {
+ Assert.AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two longs are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ static public void AreEqual(long expected, long actual)
+ {
+ Assert.AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region UInts
+
+ /// <summary>
+ /// Verifies that two uints are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void AreEqual(uint expected,
+ uint actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two uints are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void AreEqual(uint expected, uint actual, string message)
+ {
+ Assert.AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two uints are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ [CLSCompliant(false)]
+ static public void AreEqual(uint expected, uint actual)
+ {
+ Assert.AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Ulongs
+
+ /// <summary>
+ /// Verifies that two ulongs are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void AreEqual(ulong expected,
+ ulong actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two ulongs are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void AreEqual(ulong expected, ulong actual, string message)
+ {
+ Assert.AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two ulongs are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ [CLSCompliant(false)]
+ static public void AreEqual(ulong expected, ulong actual)
+ {
+ Assert.AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Decimals
+
+ /// <summary>
+ /// Verifies that two decimals are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(decimal expected,
+ decimal actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two decimal are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void AreEqual(decimal expected, decimal actual, string message)
+ {
+ Assert.AreEqual( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that two decimals are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ static public void AreEqual(decimal expected, decimal actual )
+ {
+ Assert.AreEqual( expected, actual, string.Empty, null );
+ }
+
+ #endregion
+
+ #region Doubles
+
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(double expected,
+ double actual, double delta, string message, params object[] args)
+ {
+ Constraint constraint = new EqualConstraint( expected );
+ if ( double.IsNaN(expected) || double.IsInfinity(expected) )
+ Assert.That(actual, Is.EqualTo( expected ), message, args);
+ else
+ Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void AreEqual(double expected,
+ double actual, double delta, string message)
+ {
+ Assert.AreEqual( expected, actual, delta, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ static public void AreEqual(double expected, double actual, double delta)
+ {
+ Assert.AreEqual(expected, actual, delta, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Floats
+
+ /// <summary>
+ /// Verifies that two floats are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message displayed upon failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(float expected,
+ float actual, float delta, string message, params object[] args)
+ {
+ if (float.IsNaN(expected) || float.IsInfinity(expected))
+ Assert.That(actual, Is.EqualTo( expected), message, args );
+ else
+ Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two floats are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message displayed upon failure</param>
+ static public void AreEqual(float expected, float actual, float delta, string message)
+ {
+ Assert.AreEqual(expected, actual, delta, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two floats are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ static public void AreEqual(float expected, float actual, float delta)
+ {
+ Assert.AreEqual(expected, actual, delta, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Objects
+
+ /// <summary>
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. All
+ /// non-numeric types are compared by using the <c>Equals</c> method.
+ /// Arrays are compared by comparing each element using the same rules.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(Object expected, Object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. All
+ /// non-numeric types are compared by using the <c>Equals</c> method.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ static public void AreEqual(Object expected, Object actual, string message)
+ {
+ Assert.AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. All
+ /// non-numeric types are compared by using the <c>Equals</c> method.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ static public void AreEqual(Object expected, Object actual)
+ {
+ Assert.AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region AreNotEqual
+
+ #region Objects
+ /// <summary>
+ /// Asserts that two objects are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual( Object expected, Object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two objects are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotEqual(Object expected, Object actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two objects are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotEqual(Object expected, Object actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Ints
+ /// <summary>
+ /// Asserts that two ints are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual(int expected, int actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two ints are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotEqual(int expected, int actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two ints are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotEqual(int expected, int actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region Longs
+ /// <summary>
+ /// Asserts that two longss are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual(long expected, long actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two longs are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotEqual(long expected, long actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two longs are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotEqual(long expected, long actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region UInts
+ /// <summary>
+ /// Asserts that two uints are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void AreNotEqual(uint expected, uint actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two uints are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ [CLSCompliant(false)]
+ static public void AreNotEqual(uint expected, uint actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two uints are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ [CLSCompliant(false)]
+ static public void AreNotEqual(uint expected, uint actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region Ulongs
+ /// <summary>
+ /// Asserts that two ulongs are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two ulongs are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ [CLSCompliant(false)]
+ static public void AreNotEqual(ulong expected, ulong actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two ulong are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ [CLSCompliant(false)]
+ static public void AreNotEqual(ulong expected, ulong actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region Decimals
+ /// <summary>
+ /// Asserts that two decimals are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual( decimal expected, decimal actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two decimals are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotEqual(decimal expected, decimal actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two decimals are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotEqual(decimal expected, decimal actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region Floats
+ /// <summary>
+ /// Asserts that two floats are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual( float expected, float actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two floats are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotEqual(float expected, float actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two floats are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotEqual(float expected, float actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region Doubles
+ /// <summary>
+ /// Asserts that two doubles are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual( double expected, double actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two doubles are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotEqual(double expected, double actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two doubles are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotEqual(double expected, double actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #endregion
+
+ #region AreSame
+
+ /// <summary>
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are not the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreSame(Object expected, Object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.SameAs(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the object is null</param>
+ static public void AreSame(Object expected, Object actual, string message)
+ {
+ Assert.AreSame(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreSame(Object expected, Object actual)
+ {
+ Assert.AreSame(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region AreNotSame
+
+ /// <summary>
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the two objects are the same object.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotSame(Object expected, Object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.SameAs(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to be displayed when the objects are the same</param>
+ static public void AreNotSame(Object expected, Object actual, string message)
+ {
+ Assert.AreNotSame(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ static public void AreNotSame(Object expected, Object actual)
+ {
+ Assert.AreNotSame(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Greater
+
+ #region Ints
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Greater(int arg1,
+ int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Greater(int arg1, int arg2, string message)
+ {
+ Assert.Greater( arg1, arg2, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void Greater(int arg1, int arg2 )
+ {
+ Assert.Greater( arg1, arg2, string.Empty, null );
+ }
+
+ #endregion
+
+ #region UInts
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void Greater(uint arg1,
+ uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void Greater(uint arg1, uint arg2, string message)
+ {
+ Assert.Greater( arg1, arg2, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+ static public void Greater(uint arg1, uint arg2 )
+ {
+ Assert.Greater( arg1, arg2, string.Empty, null );
+ }
+
+ #endregion
+
+ #region Longs
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Greater(long arg1,
+ long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Greater(long arg1, long arg2, string message)
+ {
+ Assert.Greater( arg1, arg2, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void Greater(long arg1, long arg2 )
+ {
+ Assert.Greater( arg1, arg2, string.Empty, null );
+ }
+
+ #endregion
+
+ #region ULongs
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void Greater(ulong arg1,
+ ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void Greater(ulong arg1, ulong arg2, string message)
+ {
+ Assert.Greater( arg1, arg2, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+ static public void Greater(ulong arg1, ulong arg2 )
+ {
+ Assert.Greater( arg1, arg2, string.Empty, null );
+ }
+
+ #endregion
+
+ #region Decimals
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Greater(decimal arg1,
+ decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Greater(decimal arg1, decimal arg2, string message)
+ {
+ Assert.Greater( arg1, arg2, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void Greater(decimal arg1, decimal arg2 )
+ {
+ Assert.Greater( arg1, arg2, string.Empty, null );
+ }
+
+ #endregion
+
+ #region Doubles
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Greater(double arg1,
+ double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Greater(double arg1,
+ double arg2, string message)
+ {
+ Assert.Greater( arg1, arg2, message, null );
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void Greater(double arg1, double arg2)
+ {
+ Assert.Greater(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Floats
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Greater(float arg1,
+ float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Greater(float arg1, float arg2, string message)
+ {
+ Assert.Greater(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void Greater(float arg1, float arg2)
+ {
+ Assert.Greater(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IComparables
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Greater(IComparable arg1,
+ IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Greater(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.Greater(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void Greater(IComparable arg1, IComparable arg2)
+ {
+ Assert.Greater(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region Less
+
+ #region Ints
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Less(int arg1, int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Less(int arg1, int arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void Less(int arg1, int arg2)
+ {
+ Assert.Less( arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region UInts
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void Less(uint arg1, uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void Less(uint arg1, uint arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+ static public void Less(uint arg1, uint arg2)
+ {
+ Assert.Less( arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Longs
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Less(long arg1, long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Less(long arg1, long arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void Less(long arg1, long arg2)
+ {
+ Assert.Less( arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region ULongs
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void Less(ulong arg1, ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void Less(ulong arg1, ulong arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+ static public void Less(ulong arg1, ulong arg2)
+ {
+ Assert.Less( arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Decimals
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Less(decimal arg1, decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Less(decimal arg1, decimal arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void Less(decimal arg1, decimal arg2)
+ {
+ Assert.Less(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Doubles
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Less(double arg1, double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Less(double arg1, double arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void Less(double arg1, double arg2)
+ {
+ Assert.Less(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Floats
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Less(float arg1, float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Less(float arg1, float arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void Less(float arg1, float arg2)
+ {
+ Assert.Less(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IComparables
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Less(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.Less(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void Less(IComparable arg1, IComparable arg2)
+ {
+ Assert.Less(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region Collection Containment
+
+ /// <summary>
+ /// Asserts that an object is contained in a list.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The list to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Arguments used in formatting the message</param>
+ static public void Contains( object expected, ICollection actual, string message, params object[] args )
+ {
+ Assert.That(actual, new CollectionContainsConstraint(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that an object is contained in a list.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The list to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ static public void Contains( object expected, ICollection actual, string message )
+ {
+ Contains( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that an object is contained in a list.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The list to be examined</param>
+ static public void Contains( object expected, ICollection actual )
+ {
+ Contains( expected, actual, string.Empty, null );
+ }
+
+ #endregion
+
+ #region Fail
+
+ /// <summary>
+ /// Throws an <see cref="AssertionException"/> with the message and arguments
+ /// that are passed in. This is used by the other Assert functions.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Fail(string message, params object[] args )
+ {
+ if (message == null) message = string.Empty;
+ else if ( args != null && args.Length > 0 )
+ message = string.Format( message, args );
+
+ throw new AssertionException(message);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="AssertionException"/> with the message that is
+ /// passed in. This is used by the other Assert functions.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ static public void Fail(string message)
+ {
+ Assert.Fail(message, null);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="AssertionException"/>.
+ /// This is used by the other Assert functions.
+ /// </summary>
+ static public void Fail()
+ {
+ Assert.Fail(string.Empty, null);
+ }
+
+ #endregion
+
+ #region Ignore
+
+ /// <summary>
+ /// Throws an <see cref="IgnoreException"/> with the message and arguments
+ /// that are passed in. This causes the test to be reported as ignored.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Ignore( string message, params object[] args )
+ {
+ if (message == null) message = string.Empty;
+ else if ( args != null && args.Length > 0 )
+ message = string.Format( message, args );
+
+ throw new IgnoreException(message);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="IgnoreException"/> with the message that is
+ /// passed in. This causes the test to be reported as ignored.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ static public void Ignore( string message )
+ {
+ Assert.Ignore( message, null );
+ }
+
+ /// <summary>
+ /// Throws an <see cref="IgnoreException"/>.
+ /// This causes the test to be reported as ignored.
+ /// </summary>
+ static public void Ignore()
+ {
+ Assert.Ignore( string.Empty, null );
+ }
+
+ #endregion
+
+ #region DoAssert
+
+ /// <summary>
+ /// NOTE: The use of asserters for extending NUnit has
+ /// now been replaced by the use of constraints. This
+ /// method is marked obsolete.
+ ///
+ /// Test the condition asserted by an asserter and throw
+ /// an assertion exception using provided message on failure.
+ /// </summary>
+ /// <param name="asserter">An object that implements IAsserter</param>
+ [Obsolete("Use Constraints rather than Asserters for new work")]
+ static public void DoAssert( IAsserter asserter )
+ {
+ Assert.IncrementAssertCount();
+ if ( !asserter.Test() )
+ throw new AssertionException( asserter.Message );
+ }
+
+ #endregion
+
+ #region That
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="constraint">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ static public void That( object actual, Constraint constraint )
+ {
+ Assert.That( actual, constraint, null, null );
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeedingt if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="constraint">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void That( object actual, Constraint constraint, string message )
+ {
+ Assert.That( actual, constraint, message, null );
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeedingt if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="constraint">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That( object actual, Constraint constraint, string message, params object[] args )
+ {
+ Assert.IncrementAssertCount();
+ if ( !constraint.Matches( actual ) )
+ {
+ MessageWriter writer = new TextMessageWriter( message, args );
+ constraint.WriteMessageTo( writer );
+ throw new AssertionException( writer.ToString() );
+ }
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.True, message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ static public void That(bool condition, string message)
+ {
+ Assert.That(condition, Is.True, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void That(bool condition)
+ {
+ Assert.That(condition, Is.True, null, null);
+ }
+ #endregion
+
+ #region GreaterOrEqual
+
+ #region Ints
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void GreaterOrEqual(int arg1,
+ int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void GreaterOrEqual(int arg1, int arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void GreaterOrEqual(int arg1, int arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region UInts
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void GreaterOrEqual(uint arg1,
+ uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void GreaterOrEqual(uint arg1, uint arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater or equal to than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+ static public void GreaterOrEqual(uint arg1, uint arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Longs
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void GreaterOrEqual(long arg1,
+ long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void GreaterOrEqual(long arg1, long arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater or equal to than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void GreaterOrEqual(long arg1, long arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region ULongs
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void GreaterOrEqual(ulong arg1,
+ ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void GreaterOrEqual(ulong arg1, ulong arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater or equal to than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+ static public void GreaterOrEqual(ulong arg1, ulong arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Decimals
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void GreaterOrEqual(decimal arg1,
+ decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void GreaterOrEqual(decimal arg1, decimal arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void GreaterOrEqual(decimal arg1, decimal arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Doubles
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void GreaterOrEqual(double arg1,
+ double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void GreaterOrEqual(double arg1,
+ double arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void GreaterOrEqual(double arg1, double arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Floats
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void GreaterOrEqual(float arg1,
+ float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void GreaterOrEqual(float arg1, float arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal to the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void GreaterOrEqual(float arg1, float arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IComparables
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void GreaterOrEqual(IComparable arg1,
+ IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ static public void GreaterOrEqual(IComparable arg1, IComparable arg2)
+ {
+ Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region LessOrEqual
+
+ #region Ints
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void LessOrEqual(int arg1, int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void LessOrEqual(int arg1, int arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void LessOrEqual(int arg1, int arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region UInts
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void LessOrEqual(uint arg1, uint arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+ static public void LessOrEqual(uint arg1, uint arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Longs
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void LessOrEqual(long arg1, long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void LessOrEqual(long arg1, long arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void LessOrEqual(long arg1, long arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region ULongs
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ [CLSCompliant(false)]
+ static public void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ [CLSCompliant(false)]
+ static public void LessOrEqual(ulong arg1, ulong arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+ static public void LessOrEqual(ulong arg1, ulong arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Decimals
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void LessOrEqual(decimal arg1, decimal arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void LessOrEqual(decimal arg1, decimal arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Doubles
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void LessOrEqual(double arg1, double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void LessOrEqual(double arg1, double arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void LessOrEqual(double arg1, double arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Floats
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void LessOrEqual(float arg1, float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void LessOrEqual(float arg1, float arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void LessOrEqual(float arg1, float arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IComparables
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void LessOrEqual(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.LessOrEqual(arg1, arg2, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ static public void LessOrEqual(IComparable arg1, IComparable arg2)
+ {
+ Assert.LessOrEqual(arg1, arg2, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Assertion.cs b/mcs/nunit24/NUnitFramework/framework/Assertion.cs
new file mode 100644
index 00000000000..a561fddfd13
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Assertion.cs
@@ -0,0 +1,169 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// The Assertion class is obsolete and has been
+ /// replaced by the Assert class.
+ /// </summary>
+ [Obsolete("Use Assert class instead")]
+ public class Assertion
+ {
+ /// <summary>
+ /// Asserts that a condition is true. If it isn't it throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="message">The message to display is the condition
+ /// is false</param>
+ /// <param name="condition">The evaluated condition</param>
+ static public void Assert(string message, bool condition)
+ {
+ NUnit.Framework.Assert.IsTrue(condition, message);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If it isn't it throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void Assert(bool condition)
+ {
+ Assertion.Assert(string.Empty, condition);
+ }
+
+ /// <summary>
+ /// /// Asserts that two doubles are equal concerning a delta. If the
+ /// expected value is infinity then the delta value is ignored.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ static public void AssertEquals(double expected, double actual, double delta)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual, delta);
+ }
+ /// <summary>
+ /// /// Asserts that two singles are equal concerning a delta. If the
+ /// expected value is infinity then the delta value is ignored.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ static public void AssertEquals(float expected, float actual, float delta)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual, delta);
+ }
+
+ /// <summary>Asserts that two objects are equal. If they are not
+ /// an <see cref="AssertionException"/> is thrown.</summary>
+ static public void AssertEquals(Object expected, Object actual)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual);
+ }
+
+ /// <summary>Asserts that two ints are equal. If they are not
+ /// an <see cref="AssertionException"/> is thrown.</summary>
+ static public void AssertEquals(int expected, int actual)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual);
+ }
+
+ /// <summary>Asserts that two ints are equal. If they are not
+ /// an <see cref="AssertionException"/> is thrown.</summary>
+ static public void AssertEquals(string message, int expected, int actual)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, message);
+ }
+
+ /// <summary>Asserts that two doubles are equal concerning a delta.
+ /// If the expected value is infinity then the delta value is ignored.
+ /// </summary>
+ static public void AssertEquals(string message, double expected,
+ double actual, double delta)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, delta, message);
+ }
+
+ /// <summary>Asserts that two floats are equal concerning a delta.
+ /// If the expected value is infinity then the delta value is ignored.
+ /// </summary>
+ static public void AssertEquals(string message, float expected,
+ float actual, float delta)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, delta, message);
+ }
+
+ /// <summary>
+ /// Asserts that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. Numeric
+ /// types are compared via string comparision on their contents to
+ /// avoid problems comparing values between different types. All
+ /// non-numeric types are compared by using the <c>Equals</c> method.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ static public void AssertEquals(string message, Object expected, Object actual)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, message);
+ }
+
+ /// <summary>Asserts that an object isn't null.</summary>
+ static public void AssertNotNull(Object anObject)
+ {
+ NUnit.Framework.Assert.IsNotNull(anObject, string.Empty);
+ }
+
+ /// <summary>Asserts that an object isn't null.</summary>
+ static public void AssertNotNull(string message, Object anObject)
+ {
+ NUnit.Framework.Assert.IsNotNull(anObject, message);
+ }
+
+ /// <summary>Asserts that an object is null.</summary>
+ static public void AssertNull(Object anObject)
+ {
+ NUnit.Framework.Assert.IsNull(anObject, string.Empty);
+ }
+
+ /// <summary>Asserts that an object is null.</summary>
+ static public void AssertNull(string message, Object anObject)
+ {
+ NUnit.Framework.Assert.IsNull(anObject, message);
+ }
+
+ /// <summary>Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ static public void AssertSame(Object expected, Object actual)
+ {
+ NUnit.Framework.Assert.AreSame(expected, actual, string.Empty);
+ }
+
+ /// <summary>Asserts that two objects refer to the same object.
+ /// If they are not an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ static public void AssertSame(string message, Object expected, Object actual)
+ {
+ NUnit.Framework.Assert.AreSame(expected, actual, message);
+ }
+
+ /// <summary>Fails a test with no message.</summary>
+ static public void Fail()
+ {
+ NUnit.Framework.Assert.Fail();
+ }
+
+ /// <summary>Fails a test with the given message.</summary>
+ static public void Fail(string message)
+ {
+ NUnit.Framework.Assert.Fail(message);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/AssertionException.cs b/mcs/nunit24/NUnitFramework/framework/AssertionException.cs
new file mode 100644
index 00000000000..26baa1c92eb
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/AssertionException.cs
@@ -0,0 +1,40 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Thrown when an assertion failed.
+ /// </summary>
+ ///
+ [Serializable]
+ public class AssertionException : System.Exception
+ {
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ public AssertionException (string message) : base(message)
+ {}
+
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ /// <param name="inner">The exception that caused the
+ /// current exception</param>
+ public AssertionException(string message, Exception inner) :
+ base(message, inner)
+ {}
+
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected AssertionException(SerializationInfo info,
+ StreamingContext context) : base(info,context)
+ {}
+
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/AssertionFailureMessage.cs b/mcs/nunit24/NUnitFramework/framework/AssertionFailureMessage.cs
new file mode 100644
index 00000000000..db07dc24582
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/AssertionFailureMessage.cs
@@ -0,0 +1,533 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Text;
+using System.IO;
+using System.Collections;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// AssertionFailureMessage encapsulates a failure message
+ /// issued as a result of an Assert failure.
+ /// </summary>
+ [Obsolete( "Use MessageWriter for new work" )]
+ public class AssertionFailureMessage : StringWriter
+ {
+ #region Static Constants
+
+ /// <summary>
+ /// Number of characters before a highlighted position before
+ /// clipping will occur. Clipped text is replaced with an
+ /// elipsis "..."
+ /// </summary>
+ static public readonly int PreClipLength = 35;
+
+ /// <summary>
+ /// Number of characters after a highlighted position before
+ /// clipping will occur. Clipped text is replaced with an
+ /// elipsis "..."
+ /// </summary>
+ static public readonly int PostClipLength = 35;
+
+ /// <summary>
+ /// Prefix used to start an expected value line.
+ /// Must be same length as actualPrefix.
+ /// </summary>
+ static protected readonly string expectedPrefix = "expected:";
+
+ /// <summary>
+ /// Prefix used to start an actual value line.
+ /// Must be same length as expectedPrefix.
+ /// </summary>
+ static protected readonly string actualPrefix = " but was:";
+
+ static private readonly string expectedAndActualFmt = "\t{0} {1}";
+ static private readonly string diffStringLengthsFmt
+ = "\tString lengths differ. Expected length={0}, but was length={1}.";
+ static private readonly string sameStringLengthsFmt
+ = "\tString lengths are both {0}.";
+ static private readonly string diffArrayLengthsFmt
+ = "Array lengths differ. Expected length={0}, but was length={1}.";
+ static private readonly string sameArrayLengthsFmt
+ = "Array lengths are both {0}.";
+ static private readonly string stringsDifferAtIndexFmt
+ = "\tStrings differ at index {0}.";
+ static private readonly string arraysDifferAtIndexFmt
+ = "Arrays differ at index {0}.";
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Construct an AssertionFailureMessage with a message
+ /// and optional arguments.
+ /// </summary>
+ /// <param name="message"></param>
+ /// <param name="args"></param>
+ public AssertionFailureMessage( string message, params object[] args )
+ {
+ if ( message != null && message != string.Empty )
+ if ( args != null )
+ WriteLine( message, args );
+ else
+ WriteLine( message );
+ }
+
+ /// <summary>
+ /// Construct an empty AssertionFailureMessage
+ /// </summary>
+ public AssertionFailureMessage() : this( null, null ) { }
+
+ #endregion
+
+ /// <summary>
+ /// Add an expected value line to the message containing
+ /// the text provided as an argument.
+ /// </summary>
+ /// <param name="text">Text describing what was expected.</param>
+ public void WriteExpectedLine( string text )
+ {
+ WriteLine( string.Format( expectedAndActualFmt, expectedPrefix, text ) );
+ }
+
+ /// <summary>
+ /// Add an actual value line to the message containing
+ /// the text provided as an argument.
+ /// </summary>
+ /// <param name="text">Text describing the actual value.</param>
+ public void WriteActualLine( string text )
+ {
+ WriteLine( string.Format( expectedAndActualFmt, actualPrefix, text ) );
+ }
+
+ /// <summary>
+ /// Add an expected value line to the message containing
+ /// a string representation of the object provided.
+ /// </summary>
+ /// <param name="expected">An object representing the expected value</param>
+ public void DisplayExpectedValue( object expected )
+ {
+ WriteExpectedLine( FormatObjectForDisplay( expected ) );
+ }
+
+ /// <summary>
+ /// Add an expected value line to the message containing a double
+ /// and the tolerance used in making the comparison.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="tolerance">The tolerance specified in the Assert</param>
+ public void DisplayExpectedValue( double expected, double tolerance )
+ {
+ WriteExpectedLine( FormatObjectForDisplay( expected ) + " +/- " + tolerance.ToString() );
+ }
+
+ /// <summary>
+ /// Add an actual value line to the message containing
+ /// a string representation of the object provided.
+ /// </summary>
+ /// <param name="actual">An object representing what was actually found</param>
+ public void DisplayActualValue( object actual )
+ {
+ WriteActualLine( FormatObjectForDisplay( actual ) );
+ }
+
+ /// <summary>
+ /// Display two lines that communicate the expected value, and the actual value
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value found</param>
+ public void DisplayExpectedAndActual( Object expected, Object actual )
+ {
+ DisplayExpectedValue( expected );
+ DisplayActualValue( actual );
+ }
+
+ /// <summary>
+ /// Display two lines that communicate the expected value, the actual value and
+ /// the tolerance used in comparing two doubles.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value found</param>
+ /// <param name="tolerance">The tolerance specified in the Assert</param>
+ public void DisplayExpectedAndActual( double expected, double actual, double tolerance )
+ {
+ DisplayExpectedValue( expected, tolerance );
+ DisplayActualValue( actual );
+ }
+
+ /// <summary>
+ /// Draws a marker under the expected/actual strings that highlights
+ /// where in the string a mismatch occurred.
+ /// </summary>
+ /// <param name="iPosition">The position of the mismatch</param>
+ public void DisplayPositionMarker( int iPosition )
+ {
+ WriteLine( "\t{0}^", new String( '-', expectedPrefix.Length + iPosition + 3 ) );
+ }
+
+ /// <summary>
+ /// Reports whether the string lengths are the same or different, and
+ /// what the string lengths are.
+ /// </summary>
+ /// <param name="sExpected">The expected string</param>
+ /// <param name="sActual">The actual string value</param>
+ protected void BuildStringLengthReport( string sExpected, string sActual )
+ {
+ if( sExpected.Length != sActual.Length )
+ WriteLine( diffStringLengthsFmt, sExpected.Length, sActual.Length );
+ else
+ WriteLine( sameStringLengthsFmt, sExpected.Length );
+ }
+
+ /// <summary>
+ /// Called to create additional message lines when two objects have been
+ /// found to be unequal. If the inputs are strings, a special message is
+ /// rendered that can help track down where the strings are different,
+ /// based on differences in length, or differences in content.
+ ///
+ /// If the inputs are not strings, the ToString method of the objects
+ /// is used to show what is different about them.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="caseInsensitive">True if a case-insensitive comparison is being performed</param>
+ public void DisplayDifferences( object expected, object actual, bool caseInsensitive )
+ {
+ if( InputsAreStrings( expected, actual ) )
+ {
+ DisplayStringDifferences(
+ (string)expected,
+ (string)actual,
+ caseInsensitive );
+ }
+ else
+ {
+ DisplayExpectedAndActual( expected, actual );
+ }
+ }
+
+ /// <summary>
+ /// Called to create additional message lines when two doubles have been
+ /// found to be unequal, within the specified tolerance.
+ /// </summary>
+ public void DisplayDifferencesWithTolerance( double expected, double actual, double tolerance )
+ {
+ DisplayExpectedAndActual( expected, actual, tolerance );
+ }
+
+ /// <summary>
+ /// Constructs a message that can be displayed when the content of two
+ /// strings are different, but the string lengths are the same. The
+ /// message will clip the strings to a reasonable length, centered
+ /// around the first position where they are mismatched, and draw
+ /// a line marking the position of the difference to make comparison
+ /// quicker.
+ /// </summary>
+ /// <param name="sExpected">The expected string value</param>
+ /// <param name="sActual">The actual string value</param>
+ /// <param name="caseInsensitive">True if a case-insensitive comparison is being performed</param>
+ protected void DisplayStringDifferences( string sExpected, string sActual, bool caseInsensitive )
+ {
+ //
+ // If they mismatch at a specified position, report the
+ // difference.
+ //
+ int iPosition = caseInsensitive
+ ? FindMismatchPosition( sExpected.ToLower(), sActual.ToLower(), 0 )
+ : FindMismatchPosition( sExpected, sActual, 0 );
+ //
+ // If the lengths differ, but they match up to the length,
+ // show the difference just past the length of the shorter
+ // string
+ //
+ if( iPosition == -1 )
+ iPosition = Math.Min( sExpected.Length, sActual.Length );
+
+ BuildStringLengthReport( sExpected, sActual );
+
+ WriteLine( stringsDifferAtIndexFmt, iPosition );
+
+ //
+ // Clips the strings, then turns any hidden whitespace into visible
+ // characters
+ //
+ string sClippedExpected = ConvertWhitespace(ClipAroundPosition( sExpected, iPosition ));
+ string sClippedActual = ConvertWhitespace(ClipAroundPosition( sActual, iPosition ));
+
+ DisplayExpectedAndActual(
+ sClippedExpected,
+ sClippedActual );
+
+ // Add a line showing where they differ. If the string lengths are
+ // different, they start differing just past the length of the
+ // shorter string
+ DisplayPositionMarker( caseInsensitive
+ ? FindMismatchPosition( sClippedExpected.ToLower(), sClippedActual.ToLower(), 0 )
+ : FindMismatchPosition( sClippedExpected, sClippedActual, 0 ) );
+ }
+
+ /// <summary>
+ /// Display a standard message showing the differences found between
+ /// two arrays that were expected to be equal.
+ /// </summary>
+ /// <param name="expected">The expected array value</param>
+ /// <param name="actual">The actual array value</param>
+ /// <param name="index">The index at which a difference was found</param>
+ public void DisplayArrayDifferences( Array expected, Array actual, int index )
+ {
+ if( expected.Length != actual.Length )
+ WriteLine( diffArrayLengthsFmt, expected.Length, actual.Length );
+ else
+ WriteLine( sameArrayLengthsFmt, expected.Length );
+
+ WriteLine( arraysDifferAtIndexFmt, index );
+
+ if ( index < expected.Length && index < actual.Length )
+ {
+ DisplayDifferences( GetValueFromCollection(expected, index ), GetValueFromCollection(actual, index), false );
+ }
+ else if( expected.Length < actual.Length )
+ DisplayListElements( " extra:", actual, index, 3 );
+ else
+ DisplayListElements( " missing:", expected, index, 3 );
+ }
+
+ /// <summary>
+ /// Display a standard message showing the differences found between
+ /// two collections that were expected to be equal.
+ /// </summary>
+ /// <param name="expected">The expected collection value</param>
+ /// <param name="actual">The actual collection value</param>
+ /// <param name="index">The index at which a difference was found</param>
+ // NOTE: This is a temporary method for use until the code from NUnitLite
+ // is integrated into NUnit.
+ public void DisplayCollectionDifferences( ICollection expected, ICollection actual, int index )
+ {
+ if( expected.Count != actual.Count )
+ WriteLine( diffArrayLengthsFmt, expected.Count, actual.Count );
+ else
+ WriteLine( sameArrayLengthsFmt, expected.Count );
+
+ WriteLine( arraysDifferAtIndexFmt, index );
+
+ if ( index < expected.Count && index < actual.Count )
+ {
+ DisplayDifferences( GetValueFromCollection(expected, index ), GetValueFromCollection(actual, index), false );
+ }
+// else if( expected.Count < actual.Count )
+// DisplayListElements( " extra:", actual, index, 3 );
+// else
+// DisplayListElements( " missing:", expected, index, 3 );
+ }
+
+ private static object GetValueFromCollection(ICollection collection, int index)
+ {
+ Array array = collection as Array;
+
+ if (array != null && array.Rank > 1)
+ return array.GetValue(GetArrayIndicesFromCollectionIndex(array, index));
+
+ if (collection is IList)
+ return ((IList)collection)[index];
+
+ foreach (object obj in collection)
+ if (--index < 0)
+ return obj;
+
+ return null;
+ }
+
+ /// <summary>
+ /// Get an array of indices representing the point in a collection or
+ /// array corresponding to a single int index into the collection.
+ /// </summary>
+ /// <param name="collection">The collection to which the indices apply</param>
+ /// <param name="index">Index in the collection</param>
+ /// <returns>Array of indices</returns>
+ private static int[] GetArrayIndicesFromCollectionIndex(ICollection collection, int index)
+ {
+ Array array = collection as Array;
+ int rank = array == null ? 1 : array.Rank;
+ int[] result = new int[rank];
+
+ for (int r = array.Rank; --r > 0; )
+ {
+ int l = array.GetLength(r);
+ result[r] = index % l;
+ index /= l;
+ }
+
+ result[0] = index;
+ return result;
+ }
+
+ /// <summary>
+ /// Displays elements from a list on a line
+ /// </summary>
+ /// <param name="label">Text to prefix the line with</param>
+ /// <param name="list">The list of items to display</param>
+ /// <param name="index">The index in the list of the first element to display</param>
+ /// <param name="max">The maximum number of elements to display</param>
+ public void DisplayListElements( string label, IList list, int index, int max )
+ {
+ Write( "{0}<", label );
+
+ if ( list == null )
+ Write( "null" );
+ else if ( list.Count == 0 )
+ Write( "empty" );
+ else
+ {
+ for( int i = 0; i < max && index < list.Count; i++ )
+ {
+ Write( FormatObjectForDisplay( list[index++] ) );
+
+ if ( index < list.Count )
+ Write( "," );
+ }
+
+ if ( index < list.Count )
+ Write( "..." );
+ }
+
+ WriteLine( ">" );
+ }
+
+ #region Static Methods
+
+ /// <summary>
+ /// Formats an object for display in a message line
+ /// </summary>
+ /// <param name="obj">The object to be displayed</param>
+ /// <returns></returns>
+ static public string FormatObjectForDisplay( object obj )
+ {
+ if ( obj == null )
+ return "<(null)>";
+ else if ( obj is string )
+ return string.Format( "<\"{0}\">", obj );
+ else if ( obj is double )
+ return string.Format( "<{0}>", ((double)obj).ToString( "G17" ) );
+ else if ( obj is float )
+ return string.Format( "<{0}>", ((float)obj).ToString( "G9" ) );
+ else
+ return string.Format( "<{0}>", obj );
+ }
+
+ /// <summary>
+ /// Tests two objects to determine if they are strings.
+ /// </summary>
+ /// <param name="expected"></param>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ static protected bool InputsAreStrings( Object expected, Object actual )
+ {
+ return expected != null && actual != null &&
+ expected is string && actual is string;
+ }
+
+ /// <summary>
+ /// Renders up to M characters before, and up to N characters after
+ /// the specified index position. If leading or trailing text is
+ /// clipped, and elipses "..." is added where the missing text would
+ /// be.
+ ///
+ /// Clips strings to limit previous or post newline characters,
+ /// since these mess up the comparison
+ /// </summary>
+ /// <param name="sString"></param>
+ /// <param name="iPosition"></param>
+ /// <returns></returns>
+ static protected string ClipAroundPosition( string sString, int iPosition )
+ {
+ if( sString == null || sString.Length == 0 )
+ return "";
+
+ bool preClip = iPosition > PreClipLength;
+ bool postClip = iPosition + PostClipLength < sString.Length;
+
+ int start = preClip
+ ? iPosition - PreClipLength : 0;
+ int length = postClip
+ ? iPosition + PostClipLength - start : sString.Length - start;
+
+ if ( start + length > iPosition + PostClipLength )
+ length = iPosition + PostClipLength - start;
+
+ StringBuilder sb = new StringBuilder();
+ if ( preClip ) sb.Append("...");
+ sb.Append( sString.Substring( start, length ) );
+ if ( postClip ) sb.Append("...");
+
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// Shows the position two strings start to differ. Comparison
+ /// starts at the start index.
+ /// </summary>
+ /// <param name="sExpected"></param>
+ /// <param name="sActual"></param>
+ /// <param name="iStart"></param>
+ /// <returns>-1 if no mismatch found, or the index where mismatch found</returns>
+ static private int FindMismatchPosition( string sExpected, string sActual, int iStart )
+ {
+ int iLength = Math.Min( sExpected.Length, sActual.Length );
+ for( int i=iStart; i<iLength; i++ )
+ {
+ //
+ // If they mismatch at a specified position, report the
+ // difference.
+ //
+ if( sExpected[i] != sActual[i] )
+ {
+ return i;
+ }
+ }
+ //
+ // Strings have same content up to the length of the shorter string.
+ // Mismatch occurs because string lengths are different, so show
+ // that they start differing where the shortest string ends
+ //
+ if( sExpected.Length != sActual.Length )
+ {
+ return iLength;
+ }
+
+ //
+ // Same strings
+ //
+ Assert.IsTrue( sExpected.Equals( sActual ) );
+ return -1;
+ }
+
+ /// <summary>
+ /// Turns CR, LF, or TAB into visual indicator to preserve visual marker
+ /// position. This is done by replacing the '\r' into '\\' and 'r'
+ /// characters, and the '\n' into '\\' and 'n' characters, and '\t' into
+ /// '\\' and 't' characters.
+ ///
+ /// Thus the single character becomes two characters for display.
+ /// </summary>
+ /// <param name="sInput"></param>
+ /// <returns></returns>
+ static protected string ConvertWhitespace( string sInput )
+ {
+ if( null != sInput )
+ {
+ sInput = sInput.Replace( "\\", "\\\\" );
+ sInput = sInput.Replace( "\r", "\\r" );
+ sInput = sInput.Replace( "\n", "\\n" );
+ sInput = sInput.Replace( "\t", "\\t" );
+ }
+ return sInput;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/AssertionHelper.cs b/mcs/nunit24/NUnitFramework/framework/AssertionHelper.cs
new file mode 100644
index 00000000000..6846affaaf8
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/AssertionHelper.cs
@@ -0,0 +1,111 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.SyntaxHelpers;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// AssertionHelper is an optional base class for user tests,
+ /// allowing the use of shorter names for constraints and
+ /// asserts and avoiding conflict with the definition of
+ /// <see cref="Is"/>, from which it inherits much of its
+ /// behavior, in certain mock object frameworks.
+ /// </summary>
+ public class AssertionHelper : ConstraintBuilder
+ {
+ #region Expect
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure. Works
+ /// identically to <see cref="NUnit.Framework.Assert.That(object, Constraint)"/>
+ /// </summary>
+ /// <param name="constraint">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ static public void Expect( object actual, Constraint constraint )
+ {
+ Assert.That( actual, constraint, null, null );
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure. Works
+ /// identically to <see cref="NUnit.Framework.Assert.That(object, Constraint, string)"/>
+ /// </summary>
+ /// <param name="constraint">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void Expect( object actual, Constraint constraint, string message )
+ {
+ Assert.That( actual, constraint, message, null );
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure. Works
+ /// identically to <see cref="NUnit.Framework.Assert.That(object, Constraint, string, object[])"/>
+ /// </summary>
+ /// <param name="constraint">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Expect( object actual, Constraint constraint, string message, params object[] args )
+ {
+ Assert.That( actual, constraint, message, args );
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>. Works Identically to
+ /// <see cref="Assert.That(bool, string, object[])"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Expect(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.True, message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>. Works Identically to
+ /// <see cref="Assert.That(bool, string)"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ static public void Expect(bool condition, string message)
+ {
+ Assert.That(condition, Is.True, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>. Works Identically to <see cref="Assert.That(bool)"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void Expect(bool condition)
+ {
+ Assert.That(condition, Is.True, null, null);
+ }
+ #endregion
+
+ #region Map
+ /// <summary>
+ /// Returns a ListMapper based on a collection.
+ /// </summary>
+ /// <param name="original">The original collection</param>
+ /// <returns></returns>
+ public ListMapper Map( ICollection original )
+ {
+ return new ListMapper( original );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/CategoryAttribute.cs b/mcs/nunit24/NUnitFramework/framework/CategoryAttribute.cs
new file mode 100644
index 00000000000..9839d5e86ea
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/CategoryAttribute.cs
@@ -0,0 +1,50 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Attribute used to apply a category to a test
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
+ public class CategoryAttribute : Attribute
+ {
+ /// <summary>
+ /// The name of the category
+ /// </summary>
+ protected string categoryName;
+
+ /// <summary>
+ /// Construct attribute for a given category
+ /// </summary>
+ /// <param name="name">The name of the category</param>
+ public CategoryAttribute(string name)
+ {
+ this.categoryName = name;
+ }
+
+ /// <summary>
+ /// Protected constructor uses the Type name as the name
+ /// of the category.
+ /// </summary>
+ protected CategoryAttribute()
+ {
+ this.categoryName = this.GetType().Name;
+ if ( categoryName.EndsWith( "Attribute" ) )
+ categoryName = categoryName.Substring( 0, categoryName.Length - 9 );
+ }
+
+ /// <summary>
+ /// The name of the category
+ /// </summary>
+ public string Name
+ {
+ get { return categoryName; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/CollectionAssert.cs b/mcs/nunit24/NUnitFramework/framework/CollectionAssert.cs
new file mode 100644
index 00000000000..05d56b7d0c0
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/CollectionAssert.cs
@@ -0,0 +1,595 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// A set of Assert methods operationg on one or more collections
+ /// </summary>
+ public class CollectionAssert
+ {
+ #region Equals and ReferenceEquals
+
+ /// <summary>
+ /// The Equals method throws an AssertionException. This is done
+ /// to make sure there is no mistake by calling this function.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static new bool Equals(object a, object b)
+ {
+ throw new AssertionException("Assert.Equals should not be used for Assertions");
+ }
+
+ /// <summary>
+ /// override the default ReferenceEquals to throw an AssertionException. This
+ /// implementation makes sure there is no mistake in calling this function
+ /// as part of Assert.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ public static new void ReferenceEquals(object a, object b)
+ {
+ throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
+ }
+
+ #endregion
+
+ #region AllItemsAreInstancesOfType
+ /// <summary>
+ /// Asserts that all items contained in collection are of the type specified by expectedType.
+ /// </summary>
+ /// <param name="collection">IEnumerable containing objects to be considered</param>
+ /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>
+ public static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType)
+ {
+ AllItemsAreInstancesOfType(collection, expectedType, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that all items contained in collection are of the type specified by expectedType.
+ /// </summary>
+ /// <param name="collection">IEnumerable containing objects to be considered</param>
+ /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType, string message)
+ {
+ AllItemsAreInstancesOfType(collection, expectedType, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that all items contained in collection are of the type specified by expectedType.
+ /// </summary>
+ /// <param name="collection">IEnumerable containing objects to be considered</param>
+ /// <param name="expectedType">System.Type that all objects in collection must be instances of</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AllItemsAreInstancesOfType (IEnumerable collection, Type expectedType, string message, params object[] args)
+ {
+ Assert.That(collection, new AllItemsConstraint(new InstanceOfTypeConstraint(expectedType)), message, args);
+ }
+ #endregion
+
+ #region AllItemsAreNotNull
+
+ /// <summary>
+ /// Asserts that all items contained in collection are not equal to null.
+ /// </summary>
+ /// <param name="collection">IEnumerable containing objects to be considered</param>
+ public static void AllItemsAreNotNull (IEnumerable collection)
+ {
+ AllItemsAreNotNull(collection, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that all items contained in collection are not equal to null.
+ /// </summary>
+ /// <param name="collection">IEnumerable containing objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AllItemsAreNotNull (IEnumerable collection, string message)
+ {
+ AllItemsAreNotNull(collection, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that all items contained in collection are not equal to null.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AllItemsAreNotNull (IEnumerable collection, string message, params object[] args)
+ {
+ Assert.That(collection, new AllItemsConstraint(new NotConstraint(new EqualConstraint(null))), message, args);
+ }
+ #endregion
+
+ #region AllItemsAreUnique
+
+ /// <summary>
+ /// Ensures that every object contained in collection exists within the collection
+ /// once and only once.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ public static void AllItemsAreUnique (IEnumerable collection)
+ {
+ AllItemsAreUnique(collection, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Ensures that every object contained in collection exists within the collection
+ /// once and only once.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AllItemsAreUnique (IEnumerable collection, string message)
+ {
+ AllItemsAreUnique(collection, message, null);
+ }
+
+ /// <summary>
+ /// Ensures that every object contained in collection exists within the collection
+ /// once and only once.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AllItemsAreUnique (IEnumerable collection, string message, params object[] args)
+ {
+ Assert.That(collection, new UniqueItemsConstraint(), message, args);
+ }
+ #endregion
+
+ #region AreEqual
+
+ /// <summary>
+ /// Asserts that expected and actual are exactly equal. The collections must have the same count,
+ /// and contain the exact same objects in the same order.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ public static void AreEqual (IEnumerable expected, IEnumerable actual)
+ {
+ //AreEqual(expected, actual, null, string.Empty, null);
+ Assert.That(actual, new EqualConstraint(expected));
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are exactly equal. The collections must have the same count,
+ /// and contain the exact same objects in the same order.
+ /// If comparer is not null then it will be used to compare the objects.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>
+ public static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer)
+ {
+ AreEqual(expected, actual, comparer, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are exactly equal. The collections must have the same count,
+ /// and contain the exact same objects in the same order.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AreEqual (IEnumerable expected, IEnumerable actual, string message)
+ {
+ //AreEqual(expected, actual, null, message, null);
+ Assert.That(actual, new EqualConstraint(expected), message);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are exactly equal. The collections must have the same count,
+ /// and contain the exact same objects in the same order.
+ /// If comparer is not null then it will be used to compare the objects.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message)
+ {
+ AreEqual(expected, actual, comparer, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are exactly equal. The collections must have the same count,
+ /// and contain the exact same objects in the same order.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AreEqual (IEnumerable expected, IEnumerable actual, string message, params object[] args)
+ {
+ //AreEqual(expected, actual, null, message, args);
+ Assert.That(actual, new EqualConstraint(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are exactly equal. The collections must have the same count,
+ /// and contain the exact same objects in the same order.
+ /// If comparer is not null then it will be used to compare the objects.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AreEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message, params object[] args)
+ {
+ Assert.That(actual, new EqualConstraint(expected).Comparer(comparer), message, args);
+ }
+ #endregion
+
+ #region AreEquivalent
+
+ /// <summary>
+ /// Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ public static void AreEquivalent (IEnumerable expected, IEnumerable actual)
+ {
+ AreEquivalent(expected, actual, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message)
+ {
+ AreEquivalent(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are equivalent, containing the same objects but the match may be in any order.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AreEquivalent (IEnumerable expected, IEnumerable actual, string message, params object[] args)
+ {
+ Assert.That(actual, new CollectionEquivalentConstraint(expected), message, args);
+ }
+ #endregion
+
+ #region AreNotEqual
+
+ /// <summary>
+ /// Asserts that expected and actual are not exactly equal.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ public static void AreNotEqual (IEnumerable expected, IEnumerable actual)
+ {
+ Assert.That(actual, new NotConstraint(new EqualConstraint(expected)));
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not exactly equal.
+ /// If comparer is not null then it will be used to compare the objects.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>
+ public static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer)
+ {
+ AreNotEqual(expected, actual, comparer, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not exactly equal.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message)
+ {
+ //AreNotEqual(expected, actual, null, message, null);
+ //Assert.AreNotEqual( expected, actual, message );
+ Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not exactly equal.
+ /// If comparer is not null then it will be used to compare the objects.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message)
+ {
+ AreNotEqual(expected, actual, comparer, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not exactly equal.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AreNotEqual (IEnumerable expected, IEnumerable actual, string message, params object[] args)
+ {
+ //AreNotEqual(expected, actual, null, message, args);
+ //Assert.AreNotEqual( expected, actual, message, args );
+ Assert.That(actual, new NotConstraint(new EqualConstraint(expected)), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not exactly equal.
+ /// If comparer is not null then it will be used to compare the objects.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="comparer">The IComparer to use in comparing objects from each IEnumerable</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AreNotEqual (IEnumerable expected, IEnumerable actual, IComparer comparer, string message, params object[] args)
+ {
+ Assert.That(actual, new NotConstraint(new EqualConstraint(expected).Comparer(comparer)), message, args);
+ }
+ #endregion
+
+ #region AreNotEquivalent
+
+ /// <summary>
+ /// Asserts that expected and actual are not equivalent.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ public static void AreNotEquivalent (IEnumerable expected, IEnumerable actual)
+ {
+ AreNotEquivalent(expected, actual, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not equivalent.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void AreNotEquivalent (IEnumerable expected, IEnumerable actual, string message)
+ {
+ AreNotEquivalent(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that expected and actual are not equivalent.
+ /// </summary>
+ /// <param name="expected">The first IEnumerable of objects to be considered</param>
+ /// <param name="actual">The second IEnumerable of objects to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void AreNotEquivalent (IEnumerable expected, IEnumerable actual, string message, params object[] args)
+ {
+ Assert.That(actual, new NotConstraint(new CollectionEquivalentConstraint(expected)), message, args);
+ }
+ #endregion
+
+ #region Contains
+ /// <summary>
+ /// Asserts that collection contains actual as an item.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="actual">Object to be found within collection</param>
+ public static void Contains (IEnumerable collection, Object actual)
+ {
+ Contains(collection, actual, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that collection contains actual as an item.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="actual">Object to be found within collection</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void Contains (IEnumerable collection, Object actual, string message)
+ {
+ Contains(collection, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that collection contains actual as an item.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="actual">Object to be found within collection</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void Contains (IEnumerable collection, Object actual, string message, params object[] args)
+ {
+ Assert.That(collection, new CollectionContainsConstraint(actual), message, args);
+ }
+ #endregion
+
+ #region DoesNotContain
+
+ /// <summary>
+ /// Asserts that collection does not contain actual as an item.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="actual">Object that cannot exist within collection</param>
+ public static void DoesNotContain (IEnumerable collection, Object actual)
+ {
+ DoesNotContain(collection, actual, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that collection does not contain actual as an item.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="actual">Object that cannot exist within collection</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void DoesNotContain (IEnumerable collection, Object actual, string message)
+ {
+ DoesNotContain(collection, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that collection does not contain actual as an item.
+ /// </summary>
+ /// <param name="collection">IEnumerable of objects to be considered</param>
+ /// <param name="actual">Object that cannot exist within collection</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void DoesNotContain (IEnumerable collection, Object actual, string message, params object[] args)
+ {
+ Assert.That(collection, new NotConstraint( new CollectionContainsConstraint( actual ) ), message, args);
+ }
+ #endregion
+
+ #region IsNotSubsetOf
+
+ /// <summary>
+ /// Asserts that superset is not a subject of subset.
+ /// </summary>
+ /// <param name="subset">The IEnumerable superset to be considered</param>
+ /// <param name="superset">The IEnumerable subset to be considered</param>
+ public static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset)
+ {
+ IsNotSubsetOf(subset, superset, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that superset is not a subject of subset.
+ /// </summary>
+ /// <param name="subset">The IEnumerable superset to be considered</param>
+ /// <param name="superset">The IEnumerable subset to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset, string message)
+ {
+ IsNotSubsetOf(subset, superset, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that superset is not a subject of subset.
+ /// </summary>
+ /// <param name="subset">The IEnumerable superset to be considered</param>
+ /// <param name="superset">The IEnumerable subset to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsNotSubsetOf (IEnumerable subset, IEnumerable superset, string message, params object[] args)
+ {
+ Assert.That(subset, new NotConstraint(new CollectionSubsetConstraint(superset)), message, args);
+ }
+ #endregion
+
+ #region IsSubsetOf
+
+ /// <summary>
+ /// Asserts that superset is a subset of subset.
+ /// </summary>
+ /// <param name="subset">The IEnumerable superset to be considered</param>
+ /// <param name="superset">The IEnumerable subset to be considered</param>
+ public static void IsSubsetOf (IEnumerable subset, IEnumerable superset)
+ {
+ IsSubsetOf(subset, superset, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Asserts that superset is a subset of subset.
+ /// </summary>
+ /// <param name="subset">The IEnumerable superset to be considered</param>
+ /// <param name="superset">The IEnumerable subset to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void IsSubsetOf (IEnumerable subset, IEnumerable superset, string message)
+ {
+ IsSubsetOf(subset, superset, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that superset is a subset of subset.
+ /// </summary>
+ /// <param name="subset">The IEnumerable superset to be considered</param>
+ /// <param name="superset">The IEnumerable subset to be considered</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsSubsetOf (IEnumerable subset, IEnumerable superset, string message, params object[] args)
+ {
+ Assert.That(subset, new CollectionSubsetConstraint(superset), message, args);
+ }
+ #endregion
+
+ #region IsEmpty
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing IEnumerable</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsEmpty(IEnumerable collection, string message, params object[] args)
+ {
+ Assert.That(collection, new EmptyConstraint(), message, args);
+ }
+
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing IEnumerable</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ public static void IsEmpty(IEnumerable collection, string message)
+ {
+ IsEmpty(collection, message, null);
+ }
+
+ /// <summary>
+ /// Assert that an array,list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing IEnumerable</param>
+ public static void IsEmpty(IEnumerable collection)
+ {
+ IsEmpty(collection, string.Empty, null);
+ }
+ #endregion
+
+ #region IsNotEmpty
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing IEnumerable</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void IsNotEmpty(IEnumerable collection, string message, params object[] args)
+ {
+ Assert.That(collection, new NotConstraint(new EmptyConstraint()), message, args);
+ }
+
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing IEnumerable</param>
+ /// <param name="message">The message to be displayed on failure</param>
+ public static void IsNotEmpty(IEnumerable collection, string message)
+ {
+ IsNotEmpty(collection, message, null);
+ }
+
+ /// <summary>
+ /// Assert that an array,list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing IEnumerable</param>
+ public static void IsNotEmpty(IEnumerable collection)
+ {
+ IsNotEmpty(collection, string.Empty, null);
+ }
+ #endregion
+ }
+}
+
+
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/BinaryOperations.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/BinaryOperations.cs
new file mode 100644
index 00000000000..65320131e4e
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/BinaryOperations.cs
@@ -0,0 +1,109 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// BinaryOperation is the abstract base of all constraints
+ /// that combine two other constraints in some fashion.
+ /// </summary>
+ public abstract class BinaryOperation : Constraint
+ {
+ /// <summary>
+ /// The first constraint being combined
+ /// </summary>
+ protected Constraint left;
+ /// <summary>
+ /// The second constraint being combined
+ /// </summary>
+ protected Constraint right;
+
+ /// <summary>
+ /// Construct a BinaryOperation from two other constraints
+ /// </summary>
+ /// <param name="left">The first constraint</param>
+ /// <param name="right">The second constraint</param>
+ public BinaryOperation(Constraint left, Constraint right)
+ {
+ this.left = left;
+ this.right = right;
+ }
+ }
+
+ /// <summary>
+ /// AndConstraint succeeds only if both members succeed.
+ /// </summary>
+ public class AndConstraint : BinaryOperation
+ {
+ /// <summary>
+ /// Create an AndConstraint from two other constraints
+ /// </summary>
+ /// <param name="left">The first constraint</param>
+ /// <param name="right">The second constraint</param>
+ public AndConstraint(Constraint left, Constraint right) : base(left, right) { }
+
+ /// <summary>
+ /// Apply both member constraints to an actual value, succeeding
+ /// succeeding only if both of them succeed.
+ /// </summary>
+ /// <param name="actual">The actual value</param>
+ /// <returns>True if the constraints both succeeded</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ return left.Matches(actual) && right.Matches(actual);
+ }
+
+ /// <summary>
+ /// Write a description for this contraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The MessageWriter to receive the description</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ left.WriteDescriptionTo(writer);
+ writer.WriteConnector("and");
+ right.WriteDescriptionTo(writer);
+ }
+ }
+
+ /// <summary>
+ /// OrConstraint succeeds if either member succeeds
+ /// </summary>
+ public class OrConstraint : BinaryOperation
+ {
+ /// <summary>
+ /// Create an OrConstraint from two other constraints
+ /// </summary>
+ /// <param name="left">The first constraint</param>
+ /// <param name="right">The second constraint</param>
+ public OrConstraint(Constraint left, Constraint right) : base(left, right) { }
+
+ /// <summary>
+ /// Apply the member constraints to an actual value, succeeding
+ /// succeeding as soon as one of them succeeds.
+ /// </summary>
+ /// <param name="actual">The actual value</param>
+ /// <returns>True if either constraint succeeded</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ return left.Matches(actual) || right.Matches(actual);
+ }
+
+ /// <summary>
+ /// Write a description for this contraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The MessageWriter to receive the description</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ left.WriteDescriptionTo(writer);
+ writer.WriteConnector("or");
+ right.WriteDescriptionTo(writer);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/CollectionConstraints.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/CollectionConstraints.cs
new file mode 100644
index 00000000000..9b8ca6bbc99
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/CollectionConstraints.cs
@@ -0,0 +1,318 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ #region CollectionConstraint
+ /// <summary>
+ /// CollectionConstraint is the abstract base class for
+ /// constraints that operate on collections.
+ /// </summary>
+ public abstract class CollectionConstraint : Constraint
+ {
+ protected static bool IsEmpty( IEnumerable enumerable )
+ {
+ ICollection collection = enumerable as ICollection;
+ if ( collection != null )
+ return collection.Count == 0;
+ else
+ return !enumerable.GetEnumerator().MoveNext();
+ }
+
+ /// <summary>
+ /// CollectionTally counts (tallies) the number of
+ /// occurences of each object in one or more enuerations.
+ /// </summary>
+ protected internal class CollectionTally
+ {
+ // Internal hash used to count occurences
+ private Hashtable hash = new Hashtable();
+
+ // We use this for any null entries found, since
+ // the key to a hash may not be null.
+ static object NULL = new object();
+
+ private int getTally(object obj)
+ {
+ if ( obj == null ) obj = NULL;
+ object val = hash[obj];
+ return val == null ? 0 : (int)val;
+ }
+
+ private void setTally(object obj, int tally)
+ {
+ if ( obj == null ) obj = NULL;
+ hash[obj] = tally;
+ }
+
+ /// <summary>
+ /// Construct a CollectionTally object from a collection
+ /// </summary>
+ /// <param name="c"></param>
+ public CollectionTally( IEnumerable c )
+ {
+ foreach( object obj in c )
+ setTally( obj, getTally( obj ) + 1 );
+ }
+
+ /// <summary>
+ /// Remove the counts for a collection from the tally,
+ /// so long as their are sufficient items to remove.
+ /// The tallies are not permitted to become negative.
+ /// </summary>
+ /// <param name="c">The collection to remove</param>
+ /// <returns>True if there were enough items to remove, otherwise false</returns>
+ public bool CanRemove( IEnumerable c )
+ {
+ foreach( object obj in c )
+ {
+ int tally = getTally(obj);
+ if( tally > 0 )
+ setTally(obj, tally - 1 );
+ else
+ return false;
+ }
+
+ return true;
+ }
+
+ /// <summary>
+ /// Test whether all the counts are equal to a given value
+ /// </summary>
+ /// <param name="count">The value to be looked for</param>
+ /// <returns>True if all counts are equal to the value, otherwise false</returns>
+ public bool AllCountsEqualTo( int count )
+ {
+ foreach( DictionaryEntry entry in hash )
+ if ( (int)entry.Value != count )
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Get the count of the number of times an object is present in the tally
+ /// </summary>
+ public int this[object obj]
+ {
+ get { return getTally(obj); }
+ }
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ IEnumerable enumerable = actual as IEnumerable;
+ if ( enumerable == null )
+ throw new ArgumentException( "The actual value must be an IEnumerable", "actual" );
+
+ return doMatch( enumerable );
+ }
+
+ /// <summary>
+ /// Protected method to be implemented by derived classes
+ /// </summary>
+ /// <param name="collection"></param>
+ /// <returns></returns>
+ protected abstract bool doMatch(IEnumerable collection);
+ }
+ #endregion
+
+ #region EmptyCollectionConstraint
+ /// <summary>
+ /// EmptyCollectionConstraint tests whether a colletion is empty.
+ /// </summary>
+ public class EmptyCollectionConstraint : CollectionConstraint
+ {
+ /// <summary>
+ /// Check that the collection is empty
+ /// </summary>
+ /// <param name="collection"></param>
+ /// <returns></returns>
+ protected override bool doMatch(IEnumerable collection)
+ {
+ return IsEmpty( collection );
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.Write( "<empty>" );
+ }
+ }
+ #endregion
+
+ #region UniqueItemsConstraint
+ /// <summary>
+ /// UniqueItemsConstraint tests whether all the items in a
+ /// collection are unique.
+ /// </summary>
+ public class UniqueItemsConstraint : CollectionConstraint
+ {
+ /// <summary>
+ /// Check that all items are unique.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ protected override bool doMatch(IEnumerable actual)
+ {
+ return new CollectionTally( actual ).AllCountsEqualTo( 1 );
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.Write("all items unique");
+ }
+ }
+ #endregion
+
+ #region CollectionContainsConstraint
+ /// <summary>
+ /// CollectionContainsConstraint is used to test whether a collection
+ /// contains an expected object as a member.
+ /// </summary>
+ public class CollectionContainsConstraint : CollectionConstraint
+ {
+ private object expected;
+
+ /// <summary>
+ /// Construct a CollectionContainsConstraint
+ /// </summary>
+ /// <param name="expected"></param>
+ public CollectionContainsConstraint(object expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the expected item is contained in the collection
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ protected override bool doMatch(IEnumerable actual)
+ {
+ foreach (object obj in actual)
+ if ( Object.Equals( obj, expected ) )
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Write a descripton of the constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate( "collection containing" );
+ writer.WriteExpectedValue(expected);
+ }
+ }
+ #endregion
+
+ #region CollectionEquivalentConstraint
+ /// <summary>
+ /// CollectionEquivalentCOnstraint is used to determine whether two
+ /// collections are equivalent.
+ /// </summary>
+ public class CollectionEquivalentConstraint : CollectionConstraint
+ {
+ private IEnumerable expected;
+
+ /// <summary>
+ /// Construct a CollectionEquivalentConstraint
+ /// </summary>
+ /// <param name="expected"></param>
+ public CollectionEquivalentConstraint(IEnumerable expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether two collections are equivalent
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ protected override bool doMatch(IEnumerable actual)
+ {
+ // This is just an optimization
+ if( expected is ICollection && actual is ICollection )
+ if( ((ICollection)actual).Count != ((ICollection)expected).Count )
+ return false;
+
+ CollectionTally tally = new CollectionTally( expected );
+ return tally.CanRemove( actual ) && tally.AllCountsEqualTo( 0 );
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("equivalent to");
+ writer.WriteExpectedValue(expected);
+ }
+ }
+ #endregion
+
+ #region CollectionSubsetConstraint
+ /// <summary>
+ /// CollectionSubsetConstraint is used to determine whether
+ /// one collection is a subset of another
+ /// </summary>
+ public class CollectionSubsetConstraint : CollectionConstraint
+ {
+ private IEnumerable expected;
+
+ /// <summary>
+ /// Construct a CollectionSubsetConstraint
+ /// </summary>
+ /// <param name="expected">The collection that the actual value is expected to be a subset of</param>
+ public CollectionSubsetConstraint(IEnumerable expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the actual collection is a subset of
+ /// the expected collection provided.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ protected override bool doMatch(IEnumerable actual)
+ {
+ return new CollectionTally( expected ).CanRemove( actual );
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate( "subset of" );
+ writer.WriteExpectedValue(expected);
+ }
+ }
+ #endregion
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/ComparisonConstraints.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/ComparisonConstraints.cs
new file mode 100644
index 00000000000..90ca62e4cb2
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/ComparisonConstraints.cs
@@ -0,0 +1,127 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// Abstract base class for constraints that compare values to
+ /// determine if one is greater than, equal to or less than
+ /// the other.
+ /// </summary>
+ public abstract class ComparisonConstraint : Constraint
+ {
+ /// <summary>
+ /// The value against which a comparison is to be made
+ /// </summary>
+ protected IComparable expected;
+ /// <summary>
+ /// If true, less than returns success
+ /// </summary>
+ protected bool ltOK = false;
+ /// <summary>
+ /// if true, equal returns success
+ /// </summary>
+ protected bool eqOK = false;
+ /// <summary>
+ /// if true, greater than returns success
+ /// </summary>
+ protected bool gtOK = false;
+ /// <summary>
+ /// The predicate used as a part of the description
+ /// </summary>
+ private string predicate;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:ComparisonConstraint"/> class.
+ /// </summary>
+ /// <param name="value">The value against which to make a comparison.</param>
+ /// <param name="ltOK">if set to <c>true</c> less succeeds.</param>
+ /// <param name="eqOK">if set to <c>true</c> equal succeeds.</param>
+ /// <param name="gtOK">if set to <c>true</c> greater succeeds.</param>
+ /// <param name="predicate">String used in describing the constraint.</param>
+ public ComparisonConstraint(IComparable value, bool ltOK, bool eqOK, bool gtOK, string predicate)
+ {
+ this.expected = value;
+ this.ltOK = ltOK;
+ this.eqOK = eqOK;
+ this.gtOK = gtOK;
+ this.predicate = predicate;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ int icomp = Numerics.Compare( expected, actual );
+ return icomp < 0 && gtOK || icomp == 0 && eqOK || icomp > 0 && ltOK;
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate(predicate);
+ writer.WriteExpectedValue(expected);
+ }
+ }
+
+ /// <summary>
+ /// Tests whether a value is greater than the value supplied to its constructor
+ /// </summary>
+ public class GreaterThanConstraint : ComparisonConstraint
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:GreaterThanConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public GreaterThanConstraint(IComparable expected) : base(expected, false, false, true, "greater than") { }
+ }
+
+ /// <summary>
+ /// Tests whether a value is greater than or equal to the value supplied to its constructor
+ /// </summary>
+ public class GreaterThanOrEqualConstraint : ComparisonConstraint
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:GreaterThanOrEqualConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public GreaterThanOrEqualConstraint(IComparable expected) : base(expected, false, true, true, "greater than or equal to") { }
+ }
+
+ /// <summary>
+ /// Tests whether a value is less than the value supplied to its constructor
+ /// </summary>
+ public class LessThanConstraint : ComparisonConstraint
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:LessThanConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public LessThanConstraint(IComparable expected) : base(expected, true, false, false, "less than") { }
+ }
+
+ /// <summary>
+ /// Tests whether a value is less than or equal to the value supplied to its constructor
+ /// </summary>
+ public class LessThanOrEqualConstraint : ComparisonConstraint
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:LessThanOrEqualConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public LessThanOrEqualConstraint(IComparable expected) : base(expected, true, true, false, "less than or equal to") { }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/Constraint.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/Constraint.cs
new file mode 100644
index 00000000000..8e87a46b2f7
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/Constraint.cs
@@ -0,0 +1,209 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// The Constraint class is the base of all built-in or
+ /// user-defined constraints in NUnit. It provides the operator
+ /// overloads used to combine constraints.
+ /// </summary>
+ public abstract class Constraint
+ {
+ #region UnsetObject Class
+ /// <summary>
+ /// Class used to detect any derived constraints
+ /// that fail to set the actual value in their
+ /// Matches override.
+ /// </summary>
+ private class UnsetObject
+ {
+ public override string ToString()
+ {
+ return "UNSET";
+ }
+ }
+ #endregion
+
+ #region Static and Instance Fields
+ /// <summary>
+ /// Static UnsetObject used to detect derived constraints
+ /// failing to set the actual value.
+ /// </summary>
+ protected static object UNSET = new UnsetObject();
+
+ /// <summary>
+ /// If true, all string comparisons will ignore case
+ /// </summary>
+ protected bool caseInsensitive;
+
+ /// <summary>
+ /// If true, strings in error messages will be clipped
+ /// </summary>
+ protected bool clipStrings = true;
+
+ /// <summary>
+ /// If true, arrays will be treated as collections, allowing
+ /// those of different dimensions to be compared
+ /// </summary>
+ protected bool compareAsCollection;
+
+ /// <summary>
+ /// If non-zero, equality comparisons within the specified
+ /// tolerance will succeed.
+ /// </summary>
+ protected object tolerance;
+
+ /// <summary>
+ /// IComparer object used in comparisons for some constraints.
+ /// </summary>
+ protected IComparer compareWith;
+
+ /// <summary>
+ /// The actual value being tested against a constraint
+ /// </summary>
+ protected object actual = UNSET;
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Flag the constraint to ignore case and return self.
+ /// </summary>
+ public virtual Constraint IgnoreCase
+ {
+ get
+ {
+ caseInsensitive = true;
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Flag the constraint to suppress string clipping
+ /// and return self.
+ /// </summary>
+ public Constraint NoClip
+ {
+ get
+ {
+ clipStrings = false;
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Flag the constraint to compare arrays as collections
+ /// and return self.
+ /// </summary>
+ public Constraint AsCollection
+ {
+ get
+ {
+ compareAsCollection = true;
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Flag the constraint to use a tolerance when determining equality.
+ /// Currently only used for doubles and floats.
+ /// </summary>
+ /// <param name="tolerance">Tolerance to be used</param>
+ /// <returns>Self.</returns>
+ public Constraint Within(object tolerance)
+ {
+ this.tolerance = tolerance;
+ return this;
+ }
+
+ /// <summary>
+ /// Flag the constraint to use the supplied IComparer object.
+ /// </summary>
+ /// <param name="comparer">The IComparer object to use.</param>
+ /// <returns>Self.</returns>
+ public Constraint Comparer(IComparer comparer)
+ {
+ this.compareWith = comparer;
+ return this;
+ }
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Write the failure message to the MessageWriter provided
+ /// as an argument. The default implementation simply passes
+ /// the constraint and the actual value to the writer, which
+ /// then displays the constraint description and the value.
+ ///
+ /// Constraints that need to provide additional details,
+ /// such as where the error occured can override this.
+ /// </summary>
+ /// <param name="writer">The MessageWriter on which to display the message</param>
+ public virtual void WriteMessageTo(MessageWriter writer)
+ {
+ writer.DisplayDifferences(this);
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public abstract bool Matches(object actual);
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public abstract void WriteDescriptionTo(MessageWriter writer);
+
+ /// <summary>
+ /// Write the actual value for a failing constraint test to a
+ /// MessageWriter. The default implementation simply writes
+ /// the raw value of actual, leaving it to the writer to
+ /// perform any formatting.
+ /// </summary>
+ /// <param name="writer">The writer on which the actual value is displayed</param>
+ public virtual void WriteActualValueTo(MessageWriter writer)
+ {
+ writer.WriteActualValue( actual );
+ }
+ #endregion
+
+ #region Operator Overloads
+ /// <summary>
+ /// This operator creates a constraint that is satisfied only if both
+ /// argument constraints are satisfied.
+ /// </summary>
+ public static Constraint operator &(Constraint left, Constraint right)
+ {
+ return new AndConstraint(left, right);
+ }
+
+ /// <summary>
+ /// This operator creates a constraint that is satisfied if either
+ /// of the argument constraints is satisfied.
+ /// </summary>
+ public static Constraint operator |(Constraint left, Constraint right)
+ {
+ return new OrConstraint(left, right);
+ }
+
+ /// <summary>
+ /// This operator creates a constraint that is satisfied if the
+ /// argument constraint is not satisfied.
+ /// </summary>
+ public static Constraint operator !(Constraint m)
+ {
+ return new NotConstraint(m == null ? new EqualConstraint(null) : m);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/ConstraintBuilder.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/ConstraintBuilder.cs
new file mode 100644
index 00000000000..242afdfdc60
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/ConstraintBuilder.cs
@@ -0,0 +1,436 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// ConstraintBuilder is used to resolve the Not and All properties,
+ /// which serve as prefix operators for constraints. With the addition
+ /// of an operand stack, And and Or could be supported, but we have
+ /// left them out in favor of a simpler, more type-safe implementation.
+ /// Use the &amp; and | operator overloads to combine constraints.
+ /// </summary>
+ public class ConstraintBuilder
+ {
+ private enum Op
+ {
+ Not,
+ All,
+ Some,
+ None,
+ Prop,
+ }
+
+ Stack ops = new Stack();
+
+ Stack opnds = new Stack();
+
+ /// <summary>
+ /// Implicitly convert ConstraintBuilder to an actual Constraint
+ /// at the point where the syntax demands it.
+ /// </summary>
+ /// <param name="builder"></param>
+ /// <returns></returns>
+ public static implicit operator Constraint( ConstraintBuilder builder )
+ {
+ return builder.Resolve();
+ }
+
+ #region Constraints Without Arguments
+ /// <summary>
+ /// Resolves the chain of constraints using
+ /// EqualConstraint(null) as base.
+ /// </summary>
+ public Constraint Null
+ {
+ get { return Resolve(new EqualConstraint(null)); }
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using
+ /// EqualConstraint(true) as base.
+ /// </summary>
+ public Constraint True
+ {
+ get { return Resolve(new EqualConstraint(true)); }
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using
+ /// EqualConstraint(false) as base.
+ /// </summary>
+ public Constraint False
+ {
+ get { return Resolve(new EqualConstraint(false)); }
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using
+ /// Is.NaN as base.
+ /// </summary>
+ public Constraint NaN
+ {
+ get { return Resolve(new EqualConstraint(double.NaN)); }
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using
+ /// Is.Empty as base.
+ /// </summary>
+ public Constraint Empty
+ {
+ get { return Resolve(new EmptyConstraint()); }
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using
+ /// Is.Unique as base.
+ /// </summary>
+ public Constraint Unique
+ {
+ get { return Resolve(new UniqueItemsConstraint()); }
+ }
+ #endregion
+
+ #region Constraints with an expected value
+
+ #region Equality and Identity
+ /// <summary>
+ /// Resolves the chain of constraints using an
+ /// EqualConstraint as base.
+ /// </summary>
+ public Constraint EqualTo(object expected)
+ {
+ return Resolve(new EqualConstraint(expected));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// SameAsConstraint as base.
+ /// </summary>
+ public Constraint SameAs(object expected)
+ {
+ return Resolve(new SameAsConstraint(expected));
+ }
+ #endregion
+
+ #region Comparison Constraints
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// LessThanConstraint as base.
+ /// </summary>
+ public Constraint LessThan(IComparable expected)
+ {
+ return Resolve(new LessThanConstraint(expected));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// GreaterThanConstraint as base.
+ /// </summary>
+ public Constraint GreaterThan(IComparable expected)
+ {
+ return Resolve(new GreaterThanConstraint(expected));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// LessThanOrEqualConstraint as base.
+ /// </summary>
+ public Constraint LessThanOrEqualTo(IComparable expected)
+ {
+ return Resolve(new LessThanOrEqualConstraint(expected));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// LessThanOrEqualConstraint as base.
+ /// </summary>
+ public Constraint AtMost(IComparable expected)
+ {
+ return Resolve(new LessThanOrEqualConstraint(expected));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// GreaterThanOrEqualConstraint as base.
+ /// </summary>
+ public Constraint GreaterThanOrEqualTo(IComparable expected)
+ {
+ return Resolve(new GreaterThanOrEqualConstraint(expected));
+ }
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// GreaterThanOrEqualConstraint as base.
+ /// </summary>
+ public Constraint AtLeast(IComparable expected)
+ {
+ return Resolve(new GreaterThanOrEqualConstraint(expected));
+ }
+ #endregion
+
+ #region Type Constraints
+ /// <summary>
+ /// Resolves the chain of constraints using an
+ /// ExactTypeConstraint as base.
+ /// </summary>
+ public Constraint TypeOf(Type expectedType)
+ {
+ return Resolve(new ExactTypeConstraint(expectedType));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using an
+ /// InstanceOfTypeConstraint as base.
+ /// </summary>
+ public Constraint InstanceOfType(Type expectedType)
+ {
+ return Resolve(new InstanceOfTypeConstraint(expectedType));
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using an
+ /// AssignableFromConstraint as base.
+ /// </summary>
+ public Constraint AssignableFrom(Type expectedType)
+ {
+ return Resolve(new AssignableFromConstraint(expectedType));
+ }
+ #endregion
+
+ #region Containing Constraint
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// ContainsConstraint as base. This constraint
+ /// will, in turn, make use of the appropriate
+ /// second-level constraint, depending on the
+ /// type of the actual argument.
+ /// </summary>
+ public Constraint Contains(object expected)
+ {
+ return Resolve( new ContainsConstraint(expected) );
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// CollectionContainsConstraint as base.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ public Constraint Member( object expected )
+ {
+ return Resolve( new CollectionContainsConstraint( expected ) );
+ }
+ #endregion
+
+ #region String Constraints
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// StartsWithConstraint as base.
+ /// </summary>
+ public Constraint StartsWith(string substring)
+ {
+ return Resolve( new StartsWithConstraint(substring) );
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// StringEndingConstraint as base.
+ /// </summary>
+ public Constraint EndsWith(string substring)
+ {
+ return Resolve( new EndsWithConstraint(substring) );
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// StringMatchingConstraint as base.
+ /// </summary>
+ public Constraint Matches(string pattern)
+ {
+ return Resolve(new RegexConstraint(pattern));
+ }
+ #endregion
+
+ #region Collection Constraints
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// CollectionEquivalentConstraint as base.
+ /// </summary>
+ public Constraint EquivalentTo(ICollection expected)
+ {
+ return Resolve( new CollectionEquivalentConstraint(expected) );
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// CollectionContainingConstraint as base.
+ /// </summary>
+ public Constraint CollectionContaining(object expected)
+ {
+ return Resolve( new CollectionContainsConstraint(expected) );
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// CollectionSubsetConstraint as base.
+ /// </summary>
+ public Constraint SubsetOf(ICollection expected)
+ {
+ return Resolve(new CollectionSubsetConstraint(expected));
+ }
+ #endregion
+
+ #region Property Constraints
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// PropertyConstraint as base
+ /// </summary>
+ public Constraint Property( string name, object expected )
+ {
+ return Resolve( new PropertyConstraint( name, new EqualConstraint( expected ) ) );
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// PropertyCOnstraint on Length as base
+ /// </summary>
+ /// <param name="length"></param>
+ /// <returns></returns>
+ public Constraint Length(int length)
+ {
+ return Property("Length", length);
+ }
+
+ /// <summary>
+ /// Resolves the chain of constraints using a
+ /// PropertyCOnstraint on Length as base
+ /// </summary>
+ /// <param name="count"></param>
+ /// <returns></returns>
+ public Constraint Count(int count)
+ {
+ return Property("Count", count);
+ }
+ #endregion
+
+ #endregion
+
+ #region Prefix Operators
+ /// <summary>
+ /// Modifies the ConstraintBuilder by pushing a Not operator on the stack.
+ /// </summary>
+ public ConstraintBuilder Not
+ {
+ get
+ {
+ ops.Push(Op.Not);
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Modifies the ConstraintBuilder by pushing a Not operator on the stack.
+ /// </summary>
+ public ConstraintBuilder No
+ {
+ get
+ {
+ ops.Push(Op.Not);
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Modifies the ConstraintBuilder by pushing an All operator on the stack.
+ /// </summary>
+ public ConstraintBuilder All
+ {
+ get
+ {
+ ops.Push(Op.All);
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Modifies the ConstraintBuilder by pushing a Some operator on the stack.
+ /// </summary>
+ public ConstraintBuilder Some
+ {
+ get
+ {
+ ops.Push(Op.Some);
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Modifies the constraint builder by pushing All and Not operators on the stack
+ /// </summary>
+ public ConstraintBuilder None
+ {
+ get
+ {
+ ops.Push(Op.None);
+ return this;
+ }
+ }
+
+ /// <summary>
+ /// Modifies the ConstraintBuilder by pushing a Prop operator on the
+ /// ops stack and the name of the property on the opnds stack.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ public ConstraintBuilder Property(string name)
+ {
+ ops.Push( Op.Prop );
+ opnds.Push( name );
+ return this;
+ }
+ #endregion
+
+ #region Helper Methods
+ /// <summary>
+ /// Resolve a constraint that has been recognized by applying
+ /// any pending operators and returning the resulting Constraint.
+ /// </summary>
+ /// <returns>A constraint that incorporates all pending operators</returns>
+ private Constraint Resolve(Constraint constraint)
+ {
+ while (ops.Count > 0)
+ switch ((Op)ops.Pop())
+ {
+ case Op.Not:
+ constraint = new NotConstraint(constraint);
+ break;
+ case Op.All:
+ constraint = new AllItemsConstraint(constraint);
+ break;
+ case Op.Some:
+ constraint = new SomeItemsConstraint(constraint);
+ break;
+ case Op.None:
+ constraint = new NoItemConstraint(constraint);
+ break;
+ case Op.Prop:
+ constraint = new PropertyConstraint( (string)opnds.Pop(), constraint );
+ break;
+ }
+
+ return constraint;
+ }
+
+ private Constraint Resolve()
+ {
+ return Resolve(null);
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/ContainsConstraint.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/ContainsConstraint.cs
new file mode 100644
index 00000000000..02bde29a660
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/ContainsConstraint.cs
@@ -0,0 +1,77 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework.Constraints
+{
+ // TODO Needs tests
+ /// <summary>
+ /// ContainsConstraint tests a whether a string contains a substring
+ /// or a collection contains an object. It postpones the decision of
+ /// which test to use until the type of the actual argument is known.
+ /// This allows testing whether a string is contained in a collection
+ /// or as a substring of another string using the same syntax.
+ /// </summary>
+ public class ContainsConstraint : Constraint
+ {
+ object expected;
+ Constraint realConstraint;
+
+ private Constraint RealConstraint
+ {
+ get
+ {
+ if ( realConstraint == null )
+ {
+ if ( actual is string )
+ this.realConstraint = new SubstringConstraint( (string)expected );
+ else
+ this.realConstraint = new CollectionContainsConstraint( expected );
+ }
+
+ return realConstraint;
+ }
+ set
+ {
+ realConstraint = value;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:ContainsConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected.</param>
+ public ContainsConstraint( object expected )
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ if ( this.caseInsensitive )
+ this.RealConstraint = RealConstraint.IgnoreCase;
+
+ return this.RealConstraint.Matches( actual );
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ this.RealConstraint.WriteDescriptionTo(writer);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/EmptyConstraint.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/EmptyConstraint.cs
new file mode 100644
index 00000000000..0b51ec4a529
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/EmptyConstraint.cs
@@ -0,0 +1,51 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// EmptyConstraint tests a whether a string or collection is empty,
+ /// postponing the decision about which test is applied until the
+ /// type of the actual argument is known.
+ /// </summary>
+ public class EmptyConstraint : Constraint
+ {
+ private Constraint RealConstraint
+ {
+ get
+ {
+ if ( actual is string )
+ return new EmptyStringConstraint();
+ else
+ return new EmptyCollectionConstraint();
+ }
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ return this.RealConstraint.Matches( actual );
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ this.RealConstraint.WriteDescriptionTo( writer );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/EqualConstraint.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/EqualConstraint.cs
new file mode 100644
index 00000000000..84747197d93
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/EqualConstraint.cs
@@ -0,0 +1,393 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// EqualConstraint is able to compare an actual value with the
+ /// expected value provided in its constructor.
+ /// </summary>
+ public class EqualConstraint : Constraint
+ {
+ private static IDictionary constraintHelpers = new Hashtable();
+
+ private readonly object expected;
+
+ private ArrayList failurePoints;
+
+ private static readonly string StringsDiffer_1 =
+ "String lengths are both {0}. Strings differ at index {1}.";
+ private static readonly string StringsDiffer_2 =
+ "Expected string length {0} but was {1}. Strings differ at index {2}.";
+ private static readonly string StreamsDiffer_1 =
+ "Stream lengths are both {0}. Streams differ at offset {1}.";
+ private static readonly string StreamsDiffer_2 =
+ "Expected Stream length {0} but was {1}.";// Streams differ at offset {2}.";
+ private static readonly string CollectionType_1 =
+ "Expected and actual are both {0}";
+ private static readonly string CollectionType_2 =
+ "Expected is {0}, actual is {1}";
+ private static readonly string ValuesDiffer_1 =
+ "Values differ at index {0}";
+ private static readonly string ValuesDiffer_2 =
+ "Values differ at expected index {0}, actual index {1}";
+
+ private static readonly int BUFFER_SIZE = 4096;
+
+ #region Constructor
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EqualConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public EqualConstraint(object expected)
+ {
+ this.expected = expected;
+ }
+ #endregion
+
+ #region Public Methods
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ this.failurePoints = new ArrayList();
+
+ return ObjectsEqual( expected, actual );
+ }
+
+ /// <summary>
+ /// Write a failure message. Overridden to provide custom
+ /// failure messages for EqualConstraint.
+ /// </summary>
+ /// <param name="writer">The MessageWriter to write to</param>
+ public override void WriteMessageTo(MessageWriter writer)
+ {
+ DisplayDifferences(writer, expected, actual, 0);
+ }
+
+
+ /// <summary>
+ /// Write description of this constraint
+ /// </summary>
+ /// <param name="writer">The MessageWriter to write to</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WriteExpectedValue( expected );
+
+ if ( tolerance != null )
+ {
+ writer.WriteConnector("+/-");
+ writer.WriteExpectedValue(tolerance);
+ }
+
+ if ( this.caseInsensitive )
+ writer.WriteModifier("ignoring case");
+ }
+
+ private void DisplayDifferences(MessageWriter writer, object expected, object actual, int depth)
+ {
+ if (expected is string && actual is string)
+ DisplayStringDifferences(writer, (string)expected, (string)actual);
+ else if (expected is ICollection && actual is ICollection)
+ DisplayCollectionDifferences(writer, (ICollection)expected, (ICollection)actual, depth);
+ else if (expected is Stream && actual is Stream)
+ DisplayStreamDifferences(writer, (Stream)expected, (Stream)actual, depth);
+ else if ( tolerance != null )
+ writer.DisplayDifferences( expected, actual, tolerance );
+ else
+ writer.DisplayDifferences(expected, actual);
+ }
+ #endregion
+
+ #region ObjectsEqual
+ private bool ObjectsEqual(object expected, object actual)
+ {
+ if (expected == null && actual == null)
+ return true;
+
+ if (expected == null || actual == null)
+ return false;
+
+ Type expectedType = expected.GetType();
+ Type actualType = actual.GetType();
+
+ if (expectedType.IsArray && actualType.IsArray && !compareAsCollection)
+ return ArraysEqual((Array)expected, (Array)actual);
+
+ if (expected is ICollection && actual is ICollection)
+ return CollectionsEqual((ICollection)expected, (ICollection)actual);
+
+ if (expected is Stream && actual is Stream)
+ return StreamsEqual((Stream)expected, (Stream)actual);
+
+ if (compareWith != null)
+ return compareWith.Compare( expected, actual ) == 0;
+
+ if (expected is DirectoryInfo && actual is DirectoryInfo)
+ return DirectoriesEqual((DirectoryInfo)expected, (DirectoryInfo)actual);
+
+ if (Numerics.IsNumericType(expected) && Numerics.IsNumericType(actual))
+ {
+ return Numerics.AreEqual(expected, actual, ref tolerance);
+ }
+
+ if (expected is string && actual is string)
+ {
+ return StringsEqual( (string) expected, (string)actual );
+ }
+
+ if (expected is DateTime && actual is DateTime && tolerance is TimeSpan)
+ {
+ return ((DateTime)expected - (DateTime)actual).Duration() <= (TimeSpan)tolerance;
+ }
+
+ return expected.Equals(actual);
+ }
+
+ /// <summary>
+ /// Helper method to compare two arrays
+ /// </summary>
+ protected virtual bool ArraysEqual(Array expected, Array actual)
+ {
+ int rank = expected.Rank;
+
+ if (rank != actual.Rank)
+ return false;
+
+ for (int r = 1; r < rank; r++)
+ if (expected.GetLength(r) != actual.GetLength(r))
+ return false;
+
+ return CollectionsEqual((ICollection)expected, (ICollection)actual);
+ }
+
+ private bool CollectionsEqual(ICollection expected, ICollection actual)
+ {
+ IEnumerator expectedEnum = expected.GetEnumerator();
+ IEnumerator actualEnum = actual.GetEnumerator();
+
+ int count;
+ for (count = 0; expectedEnum.MoveNext() && actualEnum.MoveNext(); count++)
+ {
+ if (!ObjectsEqual(expectedEnum.Current, actualEnum.Current))
+ break;
+ }
+
+ if (count == expected.Count && count == actual.Count)
+ return true;
+
+ failurePoints.Insert(0, count);
+ return false;
+ }
+
+ private bool StreamsEqual( Stream expected, Stream actual )
+ {
+ if (expected.Length != actual.Length) return false;
+
+ byte[] bufferExpected = new byte[BUFFER_SIZE];
+ byte[] bufferActual = new byte[BUFFER_SIZE];
+
+ BinaryReader binaryReaderExpected = new BinaryReader(expected);
+ BinaryReader binaryReaderActual = new BinaryReader(actual);
+
+ binaryReaderExpected.BaseStream.Seek(0, SeekOrigin.Begin);
+ binaryReaderActual.BaseStream.Seek(0, SeekOrigin.Begin);
+
+ for(long readByte = 0; readByte < expected.Length; readByte += BUFFER_SIZE )
+ {
+ binaryReaderExpected.Read(bufferExpected, 0, BUFFER_SIZE);
+ binaryReaderActual.Read(bufferActual, 0, BUFFER_SIZE);
+
+ for (int count=0; count < BUFFER_SIZE; ++count)
+ {
+ if (bufferExpected[count] != bufferActual[count])
+ {
+ failurePoints.Insert( 0, readByte + count );
+ //FailureMessage.WriteLine("\tIndex : {0}", readByte + count);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private bool StringsEqual( string expected, string actual )
+ {
+ string s1 = caseInsensitive ? expected.ToLower() : expected;
+ string s2 = caseInsensitive ? actual.ToLower() : actual;
+
+ return s1.Equals( s2 );
+ }
+
+ /// <summary>
+ /// Method to compare two DirectoryInfo objects
+ /// </summary>
+ /// <param name="expected">first directory to compare</param>
+ /// <param name="actual">second directory to compare</param>
+ /// <returns>true if equivalent, false if not</returns>
+ private bool DirectoriesEqual(DirectoryInfo expected, DirectoryInfo actual)
+ {
+ return expected.Attributes == actual.Attributes
+ && expected.CreationTime == actual.CreationTime
+ && expected.FullName == actual.FullName
+ && expected.LastAccessTime == actual.LastAccessTime;
+ }
+ #endregion
+
+ #region DisplayStringDifferences
+ private void DisplayStringDifferences(MessageWriter writer, string expected, string actual)
+ {
+ int mismatch = MsgUtils.FindMismatchPosition(expected, actual, 0, this.caseInsensitive);
+
+ if (expected.Length == actual.Length)
+ writer.WriteMessageLine(StringsDiffer_1, expected.Length, mismatch);
+ else
+ writer.WriteMessageLine(StringsDiffer_2, expected.Length, actual.Length, mismatch);
+
+ writer.DisplayStringDifferences(expected, actual, mismatch, caseInsensitive, clipStrings);
+ }
+ #endregion
+
+ #region DisplayStreamDifferences
+ private void DisplayStreamDifferences(MessageWriter writer, Stream expected, Stream actual, int depth)
+ {
+ if ( expected.Length == actual.Length )
+ {
+ long offset = (long)failurePoints[depth];
+ writer.WriteMessageLine(StreamsDiffer_1, expected.Length, offset);
+ }
+ else
+ writer.WriteMessageLine(StreamsDiffer_2, expected.Length, actual.Length);
+ }
+ #endregion
+
+ #region DisplayCollectionDifferences
+ /// <summary>
+ /// Display the failure information for two collections that did not match.
+ /// </summary>
+ /// <param name="writer">The MessageWriter on which to display</param>
+ /// <param name="expected">The expected collection.</param>
+ /// <param name="actual">The actual collection</param>
+ /// <param name="depth">The depth of this failure in a set of nested collections</param>
+ private void DisplayCollectionDifferences(MessageWriter writer, ICollection expected, ICollection actual, int depth)
+ {
+ int failurePoint = failurePoints.Count > depth ? (int)failurePoints[depth] : -1;
+
+ DisplayCollectionTypesAndSizes(writer, expected, actual, depth);
+
+ if (failurePoint >= 0)
+ {
+ DisplayFailurePoint(writer, expected, actual, failurePoint, depth);
+ if (failurePoint < expected.Count && failurePoint < actual.Count)
+ DisplayDifferences(
+ writer,
+ GetValueFromCollection(expected, failurePoint),
+ GetValueFromCollection(actual, failurePoint),
+ ++depth);
+ else if (expected.Count < actual.Count)
+ {
+ writer.Write( " Extra: " );
+ writer.WriteCollectionElements( actual, failurePoint, 3 );
+ }
+ else
+ {
+ writer.Write( " Missing: " );
+ writer.WriteCollectionElements( expected, failurePoint, 3 );
+ }
+ }
+ }
+
+ /// <summary>
+ /// Displays a single line showing the types and sizes of the expected
+ /// and actual collections or arrays. If both are identical, the value is
+ /// only shown once.
+ /// </summary>
+ /// <param name="writer">The MessageWriter on which to display</param>
+ /// <param name="expected">The expected collection or array</param>
+ /// <param name="actual">The actual collection or array</param>
+ /// <param name="indent">The indentation level for the message line</param>
+ private void DisplayCollectionTypesAndSizes(MessageWriter writer, ICollection expected, ICollection actual, int indent)
+ {
+ string sExpected = MsgUtils.GetTypeRepresentation(expected);
+ if (!(expected is Array))
+ sExpected += string.Format(" with {0} elements", expected.Count);
+
+ string sActual = MsgUtils.GetTypeRepresentation(actual);
+ if (!(actual is Array))
+ sActual += string.Format(" with {0} elements", actual.Count);
+
+ if (sExpected == sActual)
+ writer.WriteMessageLine(indent, CollectionType_1, sExpected);
+ else
+ writer.WriteMessageLine(indent, CollectionType_2, sExpected, sActual);
+ }
+
+ /// <summary>
+ /// Displays a single line showing the point in the expected and actual
+ /// arrays at which the comparison failed. If the arrays have different
+ /// structures or dimensions, both values are shown.
+ /// </summary>
+ /// <param name="writer">The MessageWriter on which to display</param>
+ /// <param name="expected">The expected array</param>
+ /// <param name="actual">The actual array</param>
+ /// <param name="failurePoint">Index of the failure point in the underlying collections</param>
+ /// <param name="indent">The indentation level for the message line</param>
+ private void DisplayFailurePoint(MessageWriter writer, ICollection expected, ICollection actual, int failurePoint, int indent)
+ {
+ Array expectedArray = expected as Array;
+ Array actualArray = actual as Array;
+
+ int expectedRank = expectedArray != null ? expectedArray.Rank : 1;
+ int actualRank = actualArray != null ? actualArray.Rank : 1;
+
+ bool useOneIndex = expectedRank == actualRank;
+
+ if (expectedArray != null && actualArray != null)
+ for (int r = 1; r < expectedRank && useOneIndex; r++)
+ if (expectedArray.GetLength(r) != actualArray.GetLength(r))
+ useOneIndex = false;
+
+ int[] expectedIndices = MsgUtils.GetArrayIndicesFromCollectionIndex(expected, failurePoint);
+ if (useOneIndex)
+ {
+ writer.WriteMessageLine(indent, ValuesDiffer_1, MsgUtils.GetArrayIndicesAsString(expectedIndices));
+ }
+ else
+ {
+ int[] actualIndices = MsgUtils.GetArrayIndicesFromCollectionIndex(actual, failurePoint);
+ writer.WriteMessageLine(indent, ValuesDiffer_2,
+ MsgUtils.GetArrayIndicesAsString(expectedIndices), MsgUtils.GetArrayIndicesAsString(actualIndices));
+ }
+ }
+
+ private static object GetValueFromCollection(ICollection collection, int index)
+ {
+ Array array = collection as Array;
+
+ if (array != null && array.Rank > 1)
+ return array.GetValue(MsgUtils.GetArrayIndicesFromCollectionIndex(array, index));
+
+ if (collection is IList)
+ return ((IList)collection)[index];
+
+ foreach (object obj in collection)
+ if (--index < 0)
+ return obj;
+
+ return null;
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/Numerics.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/Numerics.cs
new file mode 100644
index 00000000000..63fbaed7085
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/Numerics.cs
@@ -0,0 +1,216 @@
+using System;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// The Numerics class contains common operations on numeric values.
+ /// </summary>
+ public class Numerics
+ {
+ #region Numeric Type Recognition
+ /// <summary>
+ /// Checks the type of the object, returning true if
+ /// the object is a numeric type.
+ /// </summary>
+ /// <param name="obj">The object to check</param>
+ /// <returns>true if the object is a numeric type</returns>
+ public static bool IsNumericType(Object obj)
+ {
+ return IsFloatingPointNumeric( obj ) || IsFixedPointNumeric( obj );
+ }
+
+ /// <summary>
+ /// Checks the type of the object, returning true if
+ /// the object is a floating point numeric type.
+ /// </summary>
+ /// <param name="obj">The object to check</param>
+ /// <returns>true if the object is a floating point numeric type</returns>
+ public static bool IsFloatingPointNumeric(Object obj)
+ {
+ if (null != obj)
+ {
+ if (obj is double) return true;
+ if (obj is float) return true;
+
+ if (obj is System.Double) return true;
+ if (obj is System.Single) return true;
+ }
+ return false;
+ }
+ /// <summary>
+ /// Checks the type of the object, returning true if
+ /// the object is a fixed point numeric type.
+ /// </summary>
+ /// <param name="obj">The object to check</param>
+ /// <returns>true if the object is a fixed point numeric type</returns>
+ public static bool IsFixedPointNumeric(Object obj)
+ {
+ if (null != obj)
+ {
+ if (obj is byte) return true;
+ if (obj is sbyte) return true;
+ if (obj is decimal) return true;
+ if (obj is int) return true;
+ if (obj is uint) return true;
+ if (obj is long) return true;
+ if (obj is short) return true;
+ if (obj is ushort) return true;
+
+ if (obj is System.Byte) return true;
+ if (obj is System.SByte) return true;
+ if (obj is System.Decimal) return true;
+ if (obj is System.Int32) return true;
+ if (obj is System.UInt32) return true;
+ if (obj is System.Int64) return true;
+ if (obj is System.UInt64) return true;
+ if (obj is System.Int16) return true;
+ if (obj is System.UInt16) return true;
+ }
+ return false;
+ }
+ #endregion
+
+ #region Numeric Equality
+ /// <summary>
+ /// Test two numeric values for equality, performing the usual numeric
+ /// conversions and using a provided or default tolerance. If the value
+ /// referred to by tolerance is null, this method may set it to a default.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="tolerance">A reference to the numeric tolerance in effect</param>
+ /// <returns>True if the values are equal</returns>
+ public static bool AreEqual( object expected, object actual, ref object tolerance )
+ {
+ if (IsFloatingPointNumeric(expected) || IsFloatingPointNumeric(actual))
+ return AreEqual(Convert.ToDouble(expected), Convert.ToDouble(actual), ref tolerance);
+
+ if ( expected is decimal || actual is decimal )
+ return AreEqual( Convert.ToDecimal(expected), Convert.ToDecimal(actual), Convert.ToDecimal(tolerance) );
+
+ if ( expected is ulong || actual is ulong )
+ return AreEqual( Convert.ToUInt64(expected), Convert.ToUInt64(actual), Convert.ToUInt64(tolerance) );
+
+ if ( expected is long || actual is long )
+ return AreEqual( Convert.ToInt64(expected), Convert.ToInt64(actual), Convert.ToInt64(tolerance) );
+
+ if ( expected is uint || actual is uint )
+ return AreEqual( Convert.ToUInt32(expected), Convert.ToUInt32(actual), Convert.ToUInt32(tolerance) );
+
+ return AreEqual( Convert.ToInt32(expected), Convert.ToInt32(actual), Convert.ToInt32(tolerance) );
+ }
+
+ private static bool AreEqual( double expected, double actual, ref object tolerance )
+ {
+ if (double.IsNaN(expected) && double.IsNaN(actual))
+ return true;
+ // handle infinity specially since subtracting two infinite values gives
+ // NaN and the following test fails. mono also needs NaN to be handled
+ // specially although ms.net could use either method.
+ if (double.IsInfinity(expected) || double.IsNaN(expected) || double.IsNaN(actual))
+ return expected.Equals(actual);
+
+ if (tolerance != null)
+ return Math.Abs(expected - actual) <= Convert.ToDouble(tolerance);
+
+ if (GlobalSettings.DefaultFloatingPointTolerance > 0.0d
+ && !double.IsNaN(expected) && !double.IsInfinity(expected))
+ {
+ tolerance = GlobalSettings.DefaultFloatingPointTolerance;
+ return Math.Abs(expected - actual) <= GlobalSettings.DefaultFloatingPointTolerance;
+ }
+
+ return expected.Equals( actual );
+ }
+
+ private static bool AreEqual( decimal expected, decimal actual, decimal tolerance )
+ {
+ if ( tolerance > 0m )
+ return Math.Abs(expected - actual) <= tolerance;
+
+ return expected.Equals( actual );
+ }
+
+ private static bool AreEqual( ulong expected, ulong actual, ulong tolerance )
+ {
+ if ( tolerance > 0ul )
+ {
+ ulong diff = expected >= actual ? expected - actual : actual - expected;
+ return diff <= tolerance;
+ }
+
+ return expected.Equals( actual );
+ }
+
+ private static bool AreEqual( long expected, long actual, long tolerance )
+ {
+ if ( tolerance > 0L )
+ return Math.Abs(expected - actual) <= tolerance;
+
+ return expected.Equals( actual );
+ }
+
+ private static bool AreEqual( uint expected, uint actual, uint tolerance )
+ {
+ if ( tolerance > 0 )
+ {
+ uint diff = expected >= actual ? expected - actual : actual - expected;
+ return diff <= tolerance;
+ }
+
+ return expected.Equals( actual );
+ }
+
+ private static bool AreEqual( int expected, int actual, int tolerance )
+ {
+ if ( tolerance > 0 )
+ return Math.Abs(expected - actual) <= tolerance;
+
+ return expected.Equals( actual );
+ }
+ #endregion
+
+ #region Numeric Comparisons
+ /// <summary>
+ /// Compare two numeric values, performing the usual numeric conversions.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <returns></returns>
+ public static int Compare( IComparable expected, object actual )
+ {
+ if ( expected == null )
+ throw new ArgumentException( "Cannot compare using a null reference", "expected" );
+
+ if ( actual == null )
+ throw new ArgumentException( "Cannot compare to null reference", "actual" );
+
+ if( IsNumericType( expected ) && IsNumericType( actual ) )
+ {
+ if ( IsFloatingPointNumeric(expected) || IsFloatingPointNumeric(actual) )
+ return Convert.ToDouble(expected).CompareTo(Convert.ToDouble(actual));
+
+ if ( expected is decimal || actual is decimal )
+ return Convert.ToDecimal(expected).CompareTo(Convert.ToDecimal(actual));
+
+ if ( expected is ulong || actual is ulong )
+ return Convert.ToUInt64(expected).CompareTo(Convert.ToUInt64(actual));
+
+ if ( expected is long || actual is long )
+ return Convert.ToInt64(expected).CompareTo(Convert.ToInt64(actual));
+
+ if ( expected is uint || actual is uint )
+ return Convert.ToUInt32(expected).CompareTo(Convert.ToUInt32(actual));
+
+ return Convert.ToInt32(expected).CompareTo(Convert.ToInt32(actual));
+ }
+ else
+ return expected.CompareTo(actual);
+ }
+ #endregion
+
+ private Numerics()
+ {
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/PrefixConstraints.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/PrefixConstraints.cs
new file mode 100644
index 00000000000..184bf2d3e59
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/PrefixConstraints.cs
@@ -0,0 +1,241 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ #region PrefixConstraint
+ /// <summary>
+ /// Abstract base class used for prefixes
+ /// </summary>
+ public abstract class PrefixConstraint : Constraint
+ {
+ /// <summary>
+ /// The base constraint
+ /// </summary>
+ protected Constraint baseConstraint;
+
+ /// <summary>
+ /// Construct given a base constraint
+ /// </summary>
+ /// <param name="baseConstraint"></param>
+ protected PrefixConstraint( Constraint baseConstraint )
+ {
+ this.baseConstraint = baseConstraint;
+ }
+
+ /// <summary>
+ /// Set all modifiers applied to the prefix into
+ /// the base constraint before matching
+ /// </summary>
+ protected void PassModifiersToBase()
+ {
+ if ( this.caseInsensitive )
+ baseConstraint = baseConstraint.IgnoreCase;
+ if (!this.clipStrings)
+ baseConstraint = baseConstraint.NoClip;
+ if ( this.tolerance != null )
+ baseConstraint = baseConstraint.Within( tolerance );
+ if ( this.compareAsCollection )
+ baseConstraint = baseConstraint.AsCollection;
+ if ( this.compareWith != null )
+ baseConstraint = baseConstraint.Comparer( compareWith );
+ }
+ }
+ #endregion
+
+ #region NotConstraint
+ /// <summary>
+ /// NotConstraint negates the effect of some other constraint
+ /// </summary>
+ public class NotConstraint : PrefixConstraint
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:NotConstraint"/> class.
+ /// </summary>
+ /// <param name="baseConstraint">The base constraint to be negated.</param>
+ public NotConstraint(Constraint baseConstraint)
+ : base( baseConstraint ) { }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for if the base constraint fails, false if it succeeds</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ this.PassModifiersToBase();
+ return !baseConstraint.Matches(actual);
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo( MessageWriter writer )
+ {
+ writer.WritePredicate( "not" );
+ baseConstraint.WriteDescriptionTo( writer );
+ }
+
+ /// <summary>
+ /// Write the actual value for a failing constraint test to a MessageWriter.
+ /// </summary>
+ /// <param name="writer">The writer on which the actual value is displayed</param>
+ public override void WriteActualValueTo(MessageWriter writer)
+ {
+ baseConstraint.WriteActualValueTo (writer);
+ }
+ }
+ #endregion
+
+ #region AllItemsConstraint
+ /// <summary>
+ /// AllItemsConstraint applies another constraint to each
+ /// item in a collection, succeeding if they all succeed.
+ /// </summary>
+ public class AllItemsConstraint : PrefixConstraint
+ {
+ /// <summary>
+ /// Construct an AllItemsConstraint on top of an existing constraint
+ /// </summary>
+ /// <param name="itemConstraint"></param>
+ public AllItemsConstraint(Constraint itemConstraint)
+ : base( itemConstraint ) { }
+
+ /// <summary>
+ /// Apply the item constraint to each item in the collection,
+ /// failing if any item fails.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ PassModifiersToBase();
+
+ if ( !(actual is ICollection) )
+ throw new ArgumentException( "The actual value must be a collection", "actual" );
+
+ foreach(object item in (ICollection)actual)
+ if (!baseConstraint.Matches(item))
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("all items");
+ baseConstraint.WriteDescriptionTo(writer);
+ }
+ }
+ #endregion
+
+ #region SomeItemsConstraint
+ /// <summary>
+ /// SomeItemsConstraint applies another constraint to each
+ /// item in a collection, succeeding if any of them succeeds.
+ /// </summary>
+ public class SomeItemsConstraint : PrefixConstraint
+ {
+ /// <summary>
+ /// Construct a SomeItemsConstraint on top of an existing constraint
+ /// </summary>
+ /// <param name="itemConstraint"></param>
+ public SomeItemsConstraint(Constraint itemConstraint)
+ : base( itemConstraint ) { }
+
+ /// <summary>
+ /// Apply the item constraint to each item in the collection,
+ /// failing if any item fails.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ PassModifiersToBase();
+
+ if ( !(actual is ICollection) )
+ throw new ArgumentException( "The actual value must be a collection", "actual" );
+
+ foreach(object item in (ICollection)actual)
+ if (baseConstraint.Matches(item))
+ return true;
+
+ return false;
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("some item");
+ baseConstraint.WriteDescriptionTo(writer);
+ }
+ }
+ #endregion
+
+ #region NoItemConstraint
+ /// <summary>
+ /// SomeItemsConstraint applies another constraint to each
+ /// item in a collection, succeeding if any of them succeeds.
+ /// </summary>
+ public class NoItemConstraint : PrefixConstraint
+ {
+ /// <summary>
+ /// Construct a SomeItemsConstraint on top of an existing constraint
+ /// </summary>
+ /// <param name="itemConstraint"></param>
+ public NoItemConstraint(Constraint itemConstraint)
+ : base( itemConstraint ) { }
+
+ /// <summary>
+ /// Apply the item constraint to each item in the collection,
+ /// failing if any item fails.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ PassModifiersToBase();
+
+ if ( !(actual is ICollection) )
+ throw new ArgumentException( "The actual value must be a collection", "actual" );
+
+ foreach(object item in (ICollection)actual)
+ if (baseConstraint.Matches(item))
+ return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("no item");
+ baseConstraint.WriteDescriptionTo(writer);
+ }
+ }
+ #endregion
+} \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/PropertyConstraint.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/PropertyConstraint.cs
new file mode 100644
index 00000000000..218ea7be419
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/PropertyConstraint.cs
@@ -0,0 +1,83 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// Summary description for PropertyConstraint.
+ /// </summary>
+ public class PropertyConstraint : PrefixConstraint
+ {
+ private string name;
+ private object propValue;
+
+ private bool propertyExists;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:PropertyConstraint"/> class.
+ /// </summary>
+ /// <param name="name">The name.</param>
+ /// <param name="baseConstraint">The constraint to apply to the property.</param>
+ public PropertyConstraint( string name, Constraint baseConstraint )
+ : base( baseConstraint )
+ {
+ this.name = name;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ // TODO: Should be argument exception?
+ if ( actual == null ) return false;
+
+ PropertyInfo property = actual.GetType().GetProperty( name,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
+ this.propertyExists = property != null;
+ if ( !propertyExists ) return false;
+
+ if ( baseConstraint == null ) return true;
+
+ propValue = property.GetValue( actual, null );
+ return baseConstraint.Matches( propValue );
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate( "Property \"" + name + "\"" );
+ if ( baseConstraint != null )
+ baseConstraint.WriteDescriptionTo( writer );
+ }
+
+ /// <summary>
+ /// Write the actual value for a failing constraint test to a
+ /// MessageWriter. The default implementation simply writes
+ /// the raw value of actual, leaving it to the writer to
+ /// perform any formatting.
+ /// </summary>
+ /// <param name="writer">The writer on which the actual value is displayed</param>
+ public override void WriteActualValueTo(MessageWriter writer)
+ {
+ if ( propertyExists )
+ writer.WriteActualValue( propValue );
+ else
+ writer.WriteActualValue( actual.GetType() );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/SameAsConstraint.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/SameAsConstraint.cs
new file mode 100644
index 00000000000..f1aaab7d0f7
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/SameAsConstraint.cs
@@ -0,0 +1,50 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// SameAsConstraint tests whether an object is identical to
+ /// the object passed to its constructor
+ /// </summary>
+ public class SameAsConstraint : Constraint
+ {
+ private object expected;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:SameAsConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected object.</param>
+ public SameAsConstraint(object expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ return Object.ReferenceEquals(expected,actual);
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("same as");
+ writer.WriteExpectedValue(expected);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/StringConstraints.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/StringConstraints.cs
new file mode 100644
index 00000000000..94f6e0d53be
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/StringConstraints.cs
@@ -0,0 +1,234 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Text.RegularExpressions;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// EmptyStringConstraint tests whether a string is empty.
+ /// </summary>
+ public class EmptyStringConstraint : EmptyConstraint
+ {
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ if ( !(actual is string) )
+ return false;
+
+ return (string)actual == string.Empty;
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.Write( "<empty>" );
+ }
+ }
+
+ /// <summary>
+ /// SubstringConstraint can test whether a string contains
+ /// the expected substring.
+ /// </summary>
+ public class SubstringConstraint : Constraint
+ {
+ string expected;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:SubstringConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected.</param>
+ public SubstringConstraint(string expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ if ( !(actual is string) )
+ return false;
+
+ if (this.caseInsensitive)
+ return ((string)actual).ToLower().IndexOf(expected.ToLower()) >= 0;
+ else
+ return ((string)actual).IndexOf(expected) >= 0;
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("String containing");
+ writer.WriteExpectedValue(expected);
+ if ( this.caseInsensitive )
+ writer.WriteModifier( "ignoring case" );
+ }
+ }
+
+ /// <summary>
+ /// StartsWithConstraint can test whether a string starts
+ /// with an expected substring.
+ /// </summary>
+ public class StartsWithConstraint : Constraint
+ {
+ private string expected;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:StartsWithConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ public StartsWithConstraint(string expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is matched by the actual value.
+ /// This is a template method, which calls the IsMatch method
+ /// of the derived class.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ if (!(actual is string))
+ return false;
+
+ if ( this.caseInsensitive )
+ return ((string)actual).ToLower().StartsWith(expected.ToLower());
+ else
+ return ((string)actual).StartsWith(expected);
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("String starting with");
+ writer.WriteExpectedValue( MsgUtils.ClipString(expected, writer.MaxLineLength - 40, 0) );
+ if ( this.caseInsensitive )
+ writer.WriteModifier( "ignoring case" );
+ }
+ }
+
+ /// <summary>
+ /// EndsWithConstraint can test whether a string ends
+ /// with an expected substring.
+ /// </summary>
+ public class EndsWithConstraint : Constraint
+ {
+ private string expected;
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:EndsWithConstraint"/> class.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ public EndsWithConstraint(string expected)
+ {
+ this.expected = expected;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is matched by the actual value.
+ /// This is a template method, which calls the IsMatch method
+ /// of the derived class.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ if (!(actual is string))
+ return false;
+
+ if ( this.caseInsensitive )
+ return ((string)actual).ToLower().EndsWith(expected.ToLower());
+ else
+ return ((string)actual).EndsWith(expected);
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("String ending with");
+ writer.WriteExpectedValue(expected);
+ if ( this.caseInsensitive )
+ writer.WriteModifier( "ignoring case" );
+ }
+ }
+
+ /// <summary>
+ /// RegexConstraint can test whether a string matches
+ /// the pattern provided.
+ /// </summary>
+ public class RegexConstraint : Constraint
+ {
+ string pattern;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:RegexConstraint"/> class.
+ /// </summary>
+ /// <param name="pattern">The pattern.</param>
+ public RegexConstraint(string pattern)
+ {
+ this.pattern = pattern;
+ }
+
+ /// <summary>
+ /// Test whether the constraint is satisfied by a given value
+ /// </summary>
+ /// <param name="actual">The value to be tested</param>
+ /// <returns>True for success, false for failure</returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+
+ return actual is string &&
+ Regex.IsMatch(
+ (string)actual,
+ this.pattern,
+ this.caseInsensitive ? RegexOptions.IgnoreCase : RegexOptions.None );
+ }
+
+ /// <summary>
+ /// Write the constraint description to a MessageWriter
+ /// </summary>
+ /// <param name="writer">The writer on which the description is displayed</param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("String matching");
+ writer.WriteExpectedValue(this.pattern);
+ if ( this.caseInsensitive )
+ writer.WriteModifier( "ignoring case" );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Constraints/TypeConstraints.cs b/mcs/nunit24/NUnitFramework/framework/Constraints/TypeConstraints.cs
new file mode 100644
index 00000000000..2141b740ca7
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Constraints/TypeConstraints.cs
@@ -0,0 +1,143 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// TypeConstraint is the abstract base for constraints
+ /// that take a Type as their expected value.
+ /// </summary>
+ public abstract class TypeConstraint : Constraint
+ {
+ /// <summary>
+ /// The expected Type used by the constraint
+ /// </summary>
+ protected Type expectedType;
+
+ /// <summary>
+ /// Construct a TypeConstraint for a given Type
+ /// </summary>
+ /// <param name="type"></param>
+ public TypeConstraint(Type type)
+ {
+ this.expectedType = type;
+ }
+
+ /// <summary>
+ /// Write the actual value for a failing constraint test to a
+ /// MessageWriter. TypeCOnstraints override this method to write
+ /// the name of the type.
+ /// </summary>
+ /// <param name="writer">The writer on which the actual value is displayed</param>
+ public override void WriteActualValueTo(MessageWriter writer)
+ {
+ writer.WriteActualValue( actual == null ? null : actual.GetType() );
+ }
+ }
+
+ /// <summary>
+ /// ExactTypeConstraint is used to test that an object
+ /// is of the exact type provided in the constructor
+ /// </summary>
+ public class ExactTypeConstraint : TypeConstraint
+ {
+ /// <summary>
+ /// Construct an ExactTypeConstraint for a given Type
+ /// </summary>
+ /// <param name="type"></param>
+ public ExactTypeConstraint(Type type) : base( type ) { }
+
+ /// <summary>
+ /// Test that an object is of the exact type specified
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ return actual != null && actual.GetType() == this.expectedType;
+ }
+
+ /// <summary>
+ /// Write the description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WriteExpectedValue(expectedType);
+ }
+ }
+
+ /// <summary>
+ /// InstanceOfTypeConstraint is used to test that an object
+ /// is of the same type provided or derived from it.
+ /// </summary>
+ public class InstanceOfTypeConstraint : TypeConstraint
+ {
+ /// <summary>
+ /// Construct an InstanceOfTypeConstraint for the type provided
+ /// </summary>
+ /// <param name="type"></param>
+ public InstanceOfTypeConstraint(Type type) : base(type) { }
+
+ /// <summary>
+ /// Test whether an object is of the specified type or a derived type
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ return actual != null && expectedType.IsInstanceOfType(actual);
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("instance of");
+ writer.WriteExpectedValue(expectedType);
+ }
+ }
+
+ /// <summary>
+ /// AssignableFromConstraint is used to test that an object
+ /// can be assigned from a given Type.
+ /// </summary>
+ public class AssignableFromConstraint : TypeConstraint
+ {
+ /// <summary>
+ /// Construct an AssignableFromConstraint for the type provided
+ /// </summary>
+ /// <param name="type"></param>
+ public AssignableFromConstraint(Type type) : base(type) { }
+
+ /// <summary>
+ /// Test whether an object can be assigned from the specified type
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public override bool Matches(object actual)
+ {
+ this.actual = actual;
+ return actual != null && actual.GetType().IsAssignableFrom( expectedType );
+ }
+
+ /// <summary>
+ /// Write a description of this constraint to a MessageWriter
+ /// </summary>
+ /// <param name="writer"></param>
+ public override void WriteDescriptionTo(MessageWriter writer)
+ {
+ writer.WritePredicate("Type assignable from");
+ writer.WriteExpectedValue(expectedType);
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/DescriptionAttribute.cs b/mcs/nunit24/NUnitFramework/framework/DescriptionAttribute.cs
new file mode 100644
index 00000000000..0400a32e9ca
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/DescriptionAttribute.cs
@@ -0,0 +1,31 @@
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Attribute used to provide descriptive text about a
+ /// test case or fixture.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)]
+ public class DescriptionAttribute : Attribute
+ {
+ string description;
+
+ /// <summary>
+ /// Construct the attribute
+ /// </summary>
+ /// <param name="description">Text describing the test</param>
+ public DescriptionAttribute(string description)
+ {
+ this.description=description;
+ }
+
+ /// <summary>
+ /// Gets the test description
+ /// </summary>
+ public string Description
+ {
+ get { return description; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/ExpectedExceptionAttribute.cs b/mcs/nunit24/NUnitFramework/framework/ExpectedExceptionAttribute.cs
new file mode 100644
index 00000000000..9a75e018d0e
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/ExpectedExceptionAttribute.cs
@@ -0,0 +1,144 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Enumeration indicating how the expected message parameter is to be used
+ /// </summary>
+ public enum MessageMatch
+ {
+ /// Expect an exact match
+ Exact,
+ /// Expect a message containing the parameter string
+ Contains,
+ /// Match the regular expression provided as a parameter
+ Regex
+ }
+
+ /// <summary>
+ /// ExpectedExceptionAttribute
+ /// </summary>
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class ExpectedExceptionAttribute : Attribute
+ {
+ private Type expectedException;
+ private string expectedExceptionName;
+ private string expectedMessage;
+ private MessageMatch matchType;
+ private string userMessage;
+ private string handler;
+
+ /// <summary>
+ /// Constructor for a non-specific exception
+ /// </summary>
+ public ExpectedExceptionAttribute()
+ {
+ }
+
+ /// <summary>
+ /// Constructor for a given type of exception
+ /// </summary>
+ /// <param name="exceptionType">The type of the expected exception</param>
+ public ExpectedExceptionAttribute(Type exceptionType)
+ {
+ this.expectedException = exceptionType;
+ this.expectedExceptionName = exceptionType.FullName;
+ }
+
+ /// <summary>
+ /// Constructor for a given exception name
+ /// </summary>
+ /// <param name="exceptionName">The full name of the expected exception</param>
+ public ExpectedExceptionAttribute(string exceptionName)
+ {
+ this.expectedExceptionName = exceptionName;
+ }
+
+ /// <summary>
+ /// Constructor for a given type of exception and expected message text
+ /// </summary>
+ /// <param name="exceptionType">The type of the expected exception</param>
+ /// <param name="expectedMessage">The expected message text</param>
+ [Obsolete("Use named parameter format 'ExpectedMessage=...'", false)]
+ public ExpectedExceptionAttribute(Type exceptionType, string expectedMessage)
+ : this(exceptionType)
+ {
+ this.expectedMessage = expectedMessage;
+ this.matchType = MessageMatch.Exact;
+ }
+
+ /// <summary>
+ /// Constructor for a given exception name and expected message text
+ /// </summary>
+ /// <param name="exceptionName">The full name of the expected exception</param>
+ /// <param name="expectedMessage">The expected messge text</param>
+ [Obsolete("Use named parameter format 'ExpectedMessage=...'", false)]
+ public ExpectedExceptionAttribute(string exceptionName, string expectedMessage)
+ : this(exceptionName)
+ {
+ this.expectedMessage = expectedMessage;
+ this.matchType = MessageMatch.Exact;
+ }
+
+ /// <summary>
+ /// Gets or sets the expected exception type
+ /// </summary>
+ public Type ExceptionType
+ {
+ get{ return expectedException; }
+ set{ expectedException = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the full Type name of the expected exception
+ /// </summary>
+ public string ExceptionName
+ {
+ get{ return expectedExceptionName; }
+ set{ expectedExceptionName = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the expected message text
+ /// </summary>
+ public string ExpectedMessage
+ {
+ get { return expectedMessage; }
+ set { expectedMessage = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the user message displayed in case of failure
+ /// </summary>
+ public string UserMessage
+ {
+ get { return userMessage; }
+ set { userMessage = value; }
+ }
+
+ /// <summary>
+ /// Gets or sets the type of match to be performed on the expected message
+ /// </summary>
+ public MessageMatch MatchType
+ {
+ get { return matchType; }
+ set { matchType = value; }
+ }
+
+ /// <summary>
+ /// Gets the name of a method to be used as an exception handler
+ /// </summary>
+ public string Handler
+ {
+ get { return handler; }
+ set { handler = value; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/ExplicitAttribute.cs b/mcs/nunit24/NUnitFramework/framework/ExplicitAttribute.cs
new file mode 100644
index 00000000000..ad43c12c525
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/ExplicitAttribute.cs
@@ -0,0 +1,47 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// ExplicitAttribute marks a test or test fixture so that it will
+ /// only be run if explicitly executed from the gui or command line
+ /// or if it is included by use of a filter. The test will not be
+ /// run simply because an enclosing suite is run.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)]
+ public class ExplicitAttribute : Attribute
+ {
+ private string reason;
+
+ /// <summary>
+ /// Default constructor
+ /// </summary>
+ public ExplicitAttribute()
+ {
+ this.reason = "";
+ }
+
+ /// <summary>
+ /// Constructor with a reason
+ /// </summary>
+ /// <param name="reason">The reason test is marked explicit</param>
+ public ExplicitAttribute(string reason)
+ {
+ this.reason = reason;
+ }
+
+ /// <summary>
+ /// The reason test is marked explicit
+ /// </summary>
+ public string Reason
+ {
+ get { return reason; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/FileAssert.cs b/mcs/nunit24/NUnitFramework/framework/FileAssert.cs
new file mode 100644
index 00000000000..9415d0e9dc3
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/FileAssert.cs
@@ -0,0 +1,333 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.ComponentModel;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Summary description for FileAssert.
+ /// </summary>
+ public class FileAssert
+ {
+ #region Equals and ReferenceEquals
+
+ /// <summary>
+ /// The Equals method throws an AssertionException. This is done
+ /// to make sure there is no mistake by calling this function.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static new bool Equals(object a, object b)
+ {
+ throw new AssertionException("Assert.Equals should not be used for Assertions");
+ }
+
+ /// <summary>
+ /// override the default ReferenceEquals to throw an AssertionException. This
+ /// implementation makes sure there is no mistake in calling this function
+ /// as part of Assert.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ public static new void ReferenceEquals(object a, object b)
+ {
+ throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
+ }
+
+ #endregion
+
+ #region Constructor
+
+ /// <summary>
+ /// We don't actually want any instances of this object, but some people
+ /// like to inherit from it to add other static methods. Hence, the
+ /// protected constructor disallows any instances of this object.
+ /// </summary>
+ protected FileAssert() {}
+
+ #endregion
+
+ #region AreEqual
+
+ #region Streams
+
+ /// <summary>
+ /// Verifies that two Streams are equal. Two Streams are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected Stream</param>
+ /// <param name="actual">The actual Stream</param>
+ /// <param name="message">The message to display if Streams are not equal</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(Stream expected, Stream actual, string message, params object[] args)
+ {
+ Assert.That( actual, new EqualConstraint( expected ), message, args );
+ }
+
+ /// <summary>
+ /// Verifies that two Streams are equal. Two Streams are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected Stream</param>
+ /// <param name="actual">The actual Stream</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ static public void AreEqual(Stream expected, Stream actual, string message)
+ {
+ AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two Streams are equal. Two Streams are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected Stream</param>
+ /// <param name="actual">The actual Stream</param>
+ static public void AreEqual(Stream expected, Stream actual)
+ {
+ AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region FileInfo
+ /// <summary>
+ /// Verifies that two files are equal. Two files are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">A file containing the value that is expected</param>
+ /// <param name="actual">A file containing the actual value</param>
+ /// <param name="message">The message to display if Streams are not equal</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(FileInfo expected, FileInfo actual, string message, params object[] args)
+ {
+ using (FileStream exStream = expected.OpenRead())
+ {
+ using (FileStream acStream = actual.OpenRead())
+ {
+ AreEqual(exStream,acStream,message,args);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Verifies that two files are equal. Two files are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">A file containing the value that is expected</param>
+ /// <param name="actual">A file containing the actual value</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ static public void AreEqual(FileInfo expected, FileInfo actual, string message)
+ {
+ AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two files are equal. Two files are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">A file containing the value that is expected</param>
+ /// <param name="actual">A file containing the actual value</param>
+ static public void AreEqual(FileInfo expected, FileInfo actual)
+ {
+ AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region String
+ /// <summary>
+ /// Verifies that two files are equal. Two files are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The path to a file containing the value that is expected</param>
+ /// <param name="actual">The path to a file containing the actual value</param>
+ /// <param name="message">The message to display if Streams are not equal</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreEqual(string expected, string actual, string message, params object[] args)
+ {
+ using (FileStream exStream = File.OpenRead(expected))
+ {
+ using (FileStream acStream = File.OpenRead(actual))
+ {
+ AreEqual(exStream,acStream,message,args);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Verifies that two files are equal. Two files are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The path to a file containing the value that is expected</param>
+ /// <param name="actual">The path to a file containing the actual value</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ static public void AreEqual(string expected, string actual, string message)
+ {
+ AreEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that two files are equal. Two files are considered
+ /// equal if both are null, or if both have the same value byte for byte.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The path to a file containing the value that is expected</param>
+ /// <param name="actual">The path to a file containing the actual value</param>
+ static public void AreEqual(string expected, string actual)
+ {
+ AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region AreNotEqual
+
+ #region Streams
+ /// <summary>
+ /// Asserts that two Streams are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected Stream</param>
+ /// <param name="actual">The actual Stream</param>
+ /// <param name="message">The message to be displayed when the two Stream are the same.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual( Stream expected, Stream actual, string message, params object[] args)
+ {
+ Assert.That( actual, new NotConstraint( new EqualConstraint( expected ) ), message, args );
+ }
+
+ /// <summary>
+ /// Asserts that two Streams are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected Stream</param>
+ /// <param name="actual">The actual Stream</param>
+ /// <param name="message">The message to be displayed when the Streams are the same.</param>
+ static public void AreNotEqual(Stream expected, Stream actual, string message)
+ {
+ AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two Streams are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected Stream</param>
+ /// <param name="actual">The actual Stream</param>
+ static public void AreNotEqual(Stream expected, Stream actual)
+ {
+ AreNotEqual(expected, actual, string.Empty, null);
+ }
+ #endregion
+
+ #region FileInfo
+ /// <summary>
+ /// Asserts that two files are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">A file containing the value that is expected</param>
+ /// <param name="actual">A file containing the actual value</param>
+ /// <param name="message">The message to display if Streams are not equal</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual(FileInfo expected, FileInfo actual, string message, params object[] args)
+ {
+ using (FileStream exStream = expected.OpenRead())
+ {
+ using (FileStream acStream = actual.OpenRead())
+ {
+ AreNotEqual(exStream,acStream,message,args);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Asserts that two files are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">A file containing the value that is expected</param>
+ /// <param name="actual">A file containing the actual value</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ static public void AreNotEqual(FileInfo expected, FileInfo actual, string message)
+ {
+ AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two files are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">A file containing the value that is expected</param>
+ /// <param name="actual">A file containing the actual value</param>
+ static public void AreNotEqual(FileInfo expected, FileInfo actual)
+ {
+ AreNotEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region String
+ /// <summary>
+ /// Asserts that two files are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The path to a file containing the value that is expected</param>
+ /// <param name="actual">The path to a file containing the actual value</param>
+ /// <param name="message">The message to display if Streams are not equal</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void AreNotEqual(string expected, string actual, string message, params object[] args)
+ {
+ using (FileStream exStream = File.OpenRead(expected))
+ {
+ using (FileStream acStream = File.OpenRead(actual))
+ {
+ AreNotEqual(exStream,acStream,message,args);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Asserts that two files are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The path to a file containing the value that is expected</param>
+ /// <param name="actual">The path to a file containing the actual value</param>
+ /// <param name="message">The message to display if objects are not equal</param>
+ static public void AreNotEqual(string expected, string actual, string message)
+ {
+ AreNotEqual(expected, actual, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that two files are not equal. If they are equal
+ /// an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The path to a file containing the value that is expected</param>
+ /// <param name="actual">The path to a file containing the actual value</param>
+ static public void AreNotEqual(string expected, string actual)
+ {
+ AreNotEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/GlobalSettings.cs b/mcs/nunit24/NUnitFramework/framework/GlobalSettings.cs
new file mode 100644
index 00000000000..2e8b7207b6f
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/GlobalSettings.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// GlobalSettings is a place for setting default values used
+ /// by the framework in performing asserts.
+ /// </summary>
+ public class GlobalSettings
+ {
+ /// <summary>
+ /// Default tolerance for floating point equality
+ /// </summary>
+ public static double DefaultFloatingPointTolerance = 0.0d;
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/IAsserter.cs b/mcs/nunit24/NUnitFramework/framework/IAsserter.cs
new file mode 100644
index 00000000000..9aa818f5870
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/IAsserter.cs
@@ -0,0 +1,41 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// NOTE: The use of asserters for extending NUnit has
+ /// now been replaced by the use of constraints. This
+ /// interface is marked obsolete.
+ ///
+ /// The interface implemented by an asserter. Asserters
+ /// encapsulate a condition test and generation of an
+ /// AssertionException with a tailored message. They
+ /// are used by the Assert class as helper objects.
+ ///
+ /// User-defined asserters may be passed to the
+ /// Assert.DoAssert method in order to implement
+ /// extended asserts.
+ /// </summary>
+ [Obsolete("Use Constraints rather than Asserters for new work")]
+ public interface IAsserter
+ {
+ /// <summary>
+ /// Test the condition for the assertion.
+ /// </summary>
+ /// <returns>True if the test succeeds</returns>
+ bool Test();
+
+ /// <summary>
+ /// Return the message giving the failure reason.
+ /// The return value is unspecified if no failure
+ /// has occured.
+ /// </summary>
+ string Message { get; }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/IExpectException.cs b/mcs/nunit24/NUnitFramework/framework/IExpectException.cs
new file mode 100644
index 00000000000..88a3b81313e
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/IExpectException.cs
@@ -0,0 +1,25 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Interface implemented by a user fixture in order to
+ /// validate any expected exceptions. It is only called
+ /// for test methods marked with the ExpectedException
+ /// attribute.
+ /// </summary>
+ public interface IExpectException
+ {
+ /// <summary>
+ /// Method to handle an expected exception
+ /// </summary>
+ /// <param name="ex">The exception to be handled</param>
+ void HandleException(Exception ex);
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/IgnoreAttribute.cs b/mcs/nunit24/NUnitFramework/framework/IgnoreAttribute.cs
new file mode 100644
index 00000000000..779ec11642d
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/IgnoreAttribute.cs
@@ -0,0 +1,47 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Attribute used to mark a test that is to be ignored.
+ /// Ignored tests result in a warning message when the
+ /// tests are run.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method|AttributeTargets.Class|AttributeTargets.Assembly, AllowMultiple=false)]
+ public class IgnoreAttribute : Attribute
+ {
+ private string reason;
+
+ /// <summary>
+ /// Constructs the attribute without giving a reason
+ /// for ignoring the test.
+ /// </summary>
+ public IgnoreAttribute()
+ {
+ this.reason = "";
+ }
+
+ /// <summary>
+ /// Constructs the attribute giving a reason for ignoring the test
+ /// </summary>
+ /// <param name="reason">The reason for ignoring the test</param>
+ public IgnoreAttribute(string reason)
+ {
+ this.reason = reason;
+ }
+
+ /// <summary>
+ /// The reason for ignoring a test
+ /// </summary>
+ public string Reason
+ {
+ get { return reason; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/IgnoreException.cs b/mcs/nunit24/NUnitFramework/framework/IgnoreException.cs
new file mode 100644
index 00000000000..8b62f7a6004
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/IgnoreException.cs
@@ -0,0 +1,38 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ /// <summary>
+ /// Thrown when an assertion failed.
+ /// </summary>
+ [Serializable]
+ public class IgnoreException : System.Exception
+ {
+ /// <param name="message"></param>
+ public IgnoreException (string message) : base(message)
+ {}
+
+ /// <param name="message">The error message that explains
+ /// the reason for the exception</param>
+ /// <param name="inner">The exception that caused the
+ /// current exception</param>
+ public IgnoreException(string message, Exception inner) :
+ base(message, inner)
+ {}
+
+ /// <summary>
+ /// Serialization Constructor
+ /// </summary>
+ protected IgnoreException(SerializationInfo info,
+ StreamingContext context) : base(info,context)
+ {}
+
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/IncludeExcludeAttributes.cs b/mcs/nunit24/NUnitFramework/framework/IncludeExcludeAttributes.cs
new file mode 100644
index 00000000000..24f35a01c2e
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/IncludeExcludeAttributes.cs
@@ -0,0 +1,106 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Abstract base for Attributes that are used to include tests
+ /// in the test run based on environmental settings.
+ /// </summary>
+ public abstract class IncludeExcludeAttribute : Attribute
+ {
+ private string include;
+ private string exclude;
+ private string reason;
+
+ /// <summary>
+ /// Constructor with no included items specified, for use
+ /// with named property syntax.
+ /// </summary>
+ public IncludeExcludeAttribute() { }
+
+ /// <summary>
+ /// Constructor taking one or more included items
+ /// </summary>
+ /// <param name="include">Comma-delimited list of included items</param>
+ public IncludeExcludeAttribute( string include )
+ {
+ this.include = include;
+ }
+
+ /// <summary>
+ /// Name of the item that is needed in order for
+ /// a test to run. Multiple itemss may be given,
+ /// separated by a comma.
+ /// </summary>
+ public string Include
+ {
+ get { return this.include; }
+ set { include = value; }
+ }
+
+ /// <summary>
+ /// Name of the item to be excluded. Multiple items
+ /// may be given, separated by a comma.
+ /// </summary>
+ public string Exclude
+ {
+ get { return this.exclude; }
+ set { this.exclude = value; }
+ }
+
+ /// <summary>
+ /// The reason for including or excluding the test
+ /// </summary>
+ public string Reason
+ {
+ get { return reason; }
+ set { reason = value; }
+ }
+ }
+
+ /// <summary>
+ /// PlatformAttribute is used to mark a test fixture or an
+ /// individual method as applying to a particular platform only.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
+ public class PlatformAttribute : IncludeExcludeAttribute
+ {
+ /// <summary>
+ /// Constructor with no platforms specified, for use
+ /// with named property syntax.
+ /// </summary>
+ public PlatformAttribute() { }
+
+ /// <summary>
+ /// Constructor taking one or more platforms
+ /// </summary>
+ /// <param name="platforms">Comma-deliminted list of platforms</param>
+ public PlatformAttribute( string platforms ) : base( platforms ) { }
+ }
+
+ /// <summary>
+ /// CultureAttribute is used to mark a test fixture or an
+ /// individual method as applying to a particular Culture only.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=false)]
+ public class CultureAttribute : IncludeExcludeAttribute
+ {
+ /// <summary>
+ /// Constructor with no cultures specified, for use
+ /// with named property syntax.
+ /// </summary>
+ public CultureAttribute() { }
+
+ /// <summary>
+ /// Constructor taking one or more cultures
+ /// </summary>
+ /// <param name="cultures">Comma-deliminted list of cultures</param>
+ public CultureAttribute( string cultures ) : base( cultures ) { }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/Makefile b/mcs/nunit24/NUnitFramework/framework/Makefile
new file mode 100644
index 00000000000..aefc1831585
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/Makefile
@@ -0,0 +1,30 @@
+thisdir = nunit24/NUnit.Framework/framework
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = NUnit.Framework.dll
+LIBRARY_NAME = nunit.framework.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LIB_MCS_FLAGS = -debug /r:System.Xml.dll /r:System.dll /d:StronglyNamedAssembly
+NO_TEST = yo
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+EXTRA_DISTFILES = \
+ nunit.framework.dll.csproj \
+ nunit.framework.dll_VS2005.csproj
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/NUnitFramework/framework/MessageWriter.cs b/mcs/nunit24/NUnitFramework/framework/MessageWriter.cs
new file mode 100644
index 00000000000..bcdd59ec68d
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/MessageWriter.cs
@@ -0,0 +1,139 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// MessageWriter is the abstract base for classes that write
+ /// constraint descriptions and messages in some form. The
+ /// class has separate methods for writing various components
+ /// of a message, allowing implementations to tailor the
+ /// presentation as needed.
+ /// </summary>
+ public abstract class MessageWriter : StringWriter
+ {
+
+ /// <summary>
+ /// Construct a MessageWriter given a culture
+ /// </summary>
+ public MessageWriter() : base( System.Globalization.CultureInfo.InvariantCulture ) { }
+
+ /// <summary>
+ /// Abstract method to get the max line length
+ /// </summary>
+ public abstract int MaxLineLength { get; set; }
+
+ /// <summary>
+ /// Method to write single line message with optional args, usually
+ /// written to precede the general failure message.
+ /// </summary>
+ /// <param name="message">The message to be written</param>
+ /// <param name="args">Any arguments used in formatting the message</param>
+ public void WriteMessageLine(string message, params object[] args)
+ {
+ WriteMessageLine(0, message, args);
+ }
+
+ /// <summary>
+ /// Method to write single line message with optional args, usually
+ /// written to precede the general failure message, at a givel
+ /// indentation level.
+ /// </summary>
+ /// <param name="level">The indentation level of the message</param>
+ /// <param name="message">The message to be written</param>
+ /// <param name="args">Any arguments used in formatting the message</param>
+ public abstract void WriteMessageLine(int level, string message, params object[] args);
+
+ /// <summary>
+ /// Display Expected and Actual lines for a constraint. This
+ /// is called by MessageWriter's default implementation of
+ /// WriteMessageTo and provides the generic two-line display.
+ /// </summary>
+ /// <param name="constraint">The constraint that failed</param>
+ public abstract void DisplayDifferences(Constraint constraint);
+
+ /// <summary>
+ /// Display Expected and Actual lines for given values. This
+ /// method may be called by constraints that need more control over
+ /// the display of actual and expected values than is provided
+ /// by the default implementation.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value causing the failure</param>
+ public abstract void DisplayDifferences(object expected, object actual);
+
+ /// <summary>
+ /// Display Expected and Actual lines for given values, including
+ /// a tolerance value on the Expected line.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value causing the failure</param>
+ /// <param name="tolerance">The tolerance within which the test was made</param>
+ public abstract void DisplayDifferences(object expected, object actual, object tolerance);
+
+ /// <summary>
+ /// Display the expected and actual string values on separate lines.
+ /// If the mismatch parameter is >=0, an additional line is displayed
+ /// line containing a caret that points to the mismatch point.
+ /// </summary>
+ /// <param name="expected">The expected string value</param>
+ /// <param name="actual">The actual string value</param>
+ /// <param name="mismatch">The point at which the strings don't match or -1</param>
+ /// <param name="ignoreCase">If true, case is ignored in locating the point where the strings differ</param>
+ /// <param name="clipping">If true, the strings should be clipped to fit the line</param>
+ public abstract void DisplayStringDifferences(string expected, string actual, int mismatch, bool ignoreCase, bool clipping);
+
+ /// <summary>
+ /// Writes the text for a connector.
+ /// </summary>
+ /// <param name="connector">The connector.</param>
+ public abstract void WriteConnector(string connector);
+
+ /// <summary>
+ /// Writes the text for a predicate.
+ /// </summary>
+ /// <param name="predicate">The predicate.</param>
+ public abstract void WritePredicate(string predicate);
+
+ /// <summary>
+ /// Writes the text for an expected value.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public abstract void WriteExpectedValue(object expected);
+
+ /// <summary>
+ /// Writes the text for a modifier
+ /// </summary>
+ /// <param name="modifier">The modifier.</param>
+ public abstract void WriteModifier(string modifier);
+
+ /// <summary>
+ /// Writes the text for an actual value.
+ /// </summary>
+ /// <param name="actual">The actual value.</param>
+ public abstract void WriteActualValue(object actual);
+
+ /// <summary>
+ /// Writes the text for a generalized value.
+ /// </summary>
+ /// <param name="val">The value.</param>
+ public abstract void WriteValue(object val);
+
+ /// <summary>
+ /// Writes the text for a collection value,
+ /// starting at a particular point, to a max length
+ /// </summary>
+ /// <param name="collection">The collection containing elements to write.</param>
+ /// <param name="start">The starting point of the elements to write</param>
+ /// <param name="max">The maximum number of elements to write</param>
+ public abstract void WriteCollectionElements(ICollection collection, int start, int max);
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/MsgUtils.cs b/mcs/nunit24/NUnitFramework/framework/MsgUtils.cs
new file mode 100644
index 00000000000..dd2e06dff48
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/MsgUtils.cs
@@ -0,0 +1,217 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Text;
+using System.Collections;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Static methods used in creating messages
+ /// </summary>
+ public class MsgUtils
+ {
+ /// <summary>
+ /// Static string used when strings are clipped
+ /// </summary>
+ public static readonly string ELLIPSIS = "...";
+
+ /// <summary>
+ /// Returns the representation of a type as used in NUnitLite.
+ /// This is the same as Type.ToString() except for arrays,
+ /// which are displayed with their declared sizes.
+ /// </summary>
+ /// <param name="obj"></param>
+ /// <returns></returns>
+ public static string GetTypeRepresentation(object obj)
+ {
+ Array array = obj as Array;
+ if ( array == null )
+ return string.Format( "<{0}>", obj.GetType() );
+
+ StringBuilder sb = new StringBuilder();
+ Type elementType = array.GetType();
+ int nest = 0;
+ while (elementType.IsArray)
+ {
+ elementType = elementType.GetElementType();
+ ++nest;
+ }
+ sb.Append(elementType.ToString());
+ sb.Append('[');
+ for (int r = 0; r < array.Rank; r++)
+ {
+ if (r > 0) sb.Append(',');
+ sb.Append(array.GetLength(r));
+ }
+ sb.Append(']');
+
+ while (--nest > 0)
+ sb.Append("[]");
+
+ return string.Format( "<{0}>", sb.ToString() );
+ }
+ /// <summary>
+ /// Converts any control characters in a string
+ /// to their escaped representation.
+ /// </summary>
+ /// <param name="s">The string to be converted</param>
+ /// <returns>The converted string</returns>
+ public static string ConvertWhitespace(string s)
+ {
+ if( s != null )
+ {
+ s = s.Replace( "\\", "\\\\" );
+ s = s.Replace( "\r", "\\r" );
+ s = s.Replace( "\n", "\\n" );
+ s = s.Replace( "\t", "\\t" );
+ }
+ return s;
+ }
+
+ /// <summary>
+ /// Return the a string representation for a set of indices into an array
+ /// </summary>
+ /// <param name="indices">Array of indices for which a string is needed</param>
+ public static string GetArrayIndicesAsString(int[] indices)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append('[');
+ for (int r = 0; r < indices.Length; r++)
+ {
+ if (r > 0) sb.Append(',');
+ sb.Append(indices[r].ToString());
+ }
+ sb.Append(']');
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// Get an array of indices representing the point in a collection or
+ /// array corresponding to a single int index into the collection.
+ /// </summary>
+ /// <param name="collection">The collection to which the indices apply</param>
+ /// <param name="index">Index in the collection</param>
+ /// <returns>Array of indices</returns>
+ public static int[] GetArrayIndicesFromCollectionIndex(ICollection collection, int index)
+ {
+ Array array = collection as Array;
+
+ if ( array == null || array.Rank == 1)
+ return new int[] { index };
+
+ int[] result = new int[array.Rank];
+
+ for (int r = array.Rank; --r > 0; )
+ {
+ int l = array.GetLength(r);
+ result[r] = index % l;
+ index /= l;
+ }
+
+ result[0] = index;
+ return result;
+ }
+
+ /// <summary>
+ /// Clip a string to a given length, starting at a particular offset, returning the clipped
+ /// string with ellipses representing the removed parts
+ /// </summary>
+ /// <param name="s">The string to be clipped</param>
+ /// <param name="maxStringLength">The maximum permitted length of the result string</param>
+ /// <param name="clipStart">The point at which to start clipping</param>
+ /// <returns>The clipped string</returns>
+ public static string ClipString(string s, int maxStringLength, int clipStart)
+ {
+ int clipLength = maxStringLength;
+ StringBuilder sb = new StringBuilder();
+
+ if (clipStart > 0)
+ {
+ clipLength -= ELLIPSIS.Length;
+ sb.Append( ELLIPSIS );
+ }
+
+ if (s.Length - clipStart > clipLength)
+ {
+ clipLength -= ELLIPSIS.Length;
+ sb.Append( s.Substring( clipStart, clipLength ));
+ sb.Append(ELLIPSIS);
+ }
+ else if (clipStart > 0)
+ sb.Append( s.Substring(clipStart));
+ else
+ sb.Append( s );
+
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// Clip the expected and actual strings in a coordinated fashion,
+ /// so that they may be displayed together.
+ /// </summary>
+ /// <param name="expected"></param>
+ /// <param name="actual"></param>
+ /// <param name="maxDisplayLength"></param>
+ /// <param name="mismatch"></param>
+ public static void ClipExpectedAndActual(ref string expected, ref string actual, int maxDisplayLength, int mismatch)
+ {
+ // Case 1: Both strings fit on line
+ int maxStringLength = Math.Max(expected.Length, actual.Length);
+ if (maxStringLength <= maxDisplayLength)
+ return;
+
+ // Case 2: Assume that the tail of each string fits on line
+ int clipLength = maxDisplayLength - ELLIPSIS.Length;
+ int tailLength = clipLength - mismatch;
+ int clipStart = maxStringLength - clipLength;
+
+ // Case 3: If it doesn't, center the mismatch position
+ if ( clipStart > mismatch )
+ clipStart = Math.Max( 0, mismatch - clipLength / 2 );
+
+ expected = ClipString(expected, maxDisplayLength, clipStart);
+ actual = ClipString(actual, maxDisplayLength, clipStart);
+ }
+
+ /// <summary>
+ /// Shows the position two strings start to differ. Comparison
+ /// starts at the start index.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The actual string</param>
+ /// <param name="istart">The index in the strings at which comparison should start</param>
+ /// <param name="ignoreCase">Boolean indicating whether case should be ignored</param>
+ /// <returns>-1 if no mismatch found, or the index where mismatch found</returns>
+ static public int FindMismatchPosition(string expected, string actual, int istart, bool ignoreCase)
+ {
+ int length = Math.Min(expected.Length, actual.Length);
+
+ string s1 = ignoreCase ? expected.ToLower() : expected;
+ string s2 = ignoreCase ? actual.ToLower() : actual;
+
+ for (int i = istart; i < length; i++)
+ {
+ if (s1[i] != s2[i])
+ return i;
+ }
+
+ //
+ // Strings have same content up to the length of the shorter string.
+ // Mismatch occurs because string lengths are different, so show
+ // that they start differing where the shortest string ends
+ //
+ if (expected.Length != actual.Length)
+ return length;
+
+ //
+ // Same strings : We shouldn't get here
+ //
+ return -1;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/NUnit.Framework.dll.sources b/mcs/nunit24/NUnitFramework/framework/NUnit.Framework.dll.sources
new file mode 100644
index 00000000000..2b92a8c080d
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/NUnit.Framework.dll.sources
@@ -0,0 +1,54 @@
+../../CommonAssemblyInfo.cs
+AbstractAsserter.cs
+AssemblyInfo.cs
+Assert.cs
+Assertion.cs
+AssertionException.cs
+AssertionFailureMessage.cs
+AssertionHelper.cs
+CategoryAttribute.cs
+CollectionAssert.cs
+Constraints/BinaryOperations.cs
+Constraints/CollectionConstraints.cs
+Constraints/ComparisonConstraints.cs
+Constraints/Constraint.cs
+Constraints/ConstraintBuilder.cs
+Constraints/ContainsConstraint.cs
+Constraints/EmptyConstraint.cs
+Constraints/EqualConstraint.cs
+Constraints/Numerics.cs
+Constraints/PrefixConstraints.cs
+Constraints/PropertyConstraint.cs
+Constraints/SameAsConstraint.cs
+Constraints/StringConstraints.cs
+Constraints/TypeConstraints.cs
+DescriptionAttribute.cs
+ExpectedExceptionAttribute.cs
+ExplicitAttribute.cs
+FileAssert.cs
+GlobalSettings.cs
+IAsserter.cs
+IExpectException.cs
+IgnoreAttribute.cs
+IgnoreException.cs
+IncludeExcludeAttributes.cs
+MessageWriter.cs
+MsgUtils.cs
+OldTestCase.cs
+PropertyAttribute.cs
+SetCultureAttribute.cs
+SetUpAttribute.cs
+SetUpFixtureAttribute.cs
+StringAssert.cs
+SuiteAttribute.cs
+SyntaxHelpers/Has.cs
+SyntaxHelpers/Is.cs
+SyntaxHelpers/List.cs
+SyntaxHelpers/ListMapper.cs
+SyntaxHelpers/Text.cs
+TearDownAttribute.cs
+TestAttribute.cs
+TestFixtureAttribute.cs
+TestFixtureSetUpAttribute.cs
+TestFixtureTearDownAttribute.cs
+TextMessageWriter.cs
diff --git a/mcs/nunit24/NUnitFramework/framework/OldTestCase.cs b/mcs/nunit24/NUnitFramework/framework/OldTestCase.cs
new file mode 100644
index 00000000000..66a0662a273
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/OldTestCase.cs
@@ -0,0 +1,36 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Obsolete class, formerly used to identify tests through
+ /// inheritance. Avoid using this class for new tests.
+ /// </summary>
+ [TestFixture]
+ [Obsolete("use TestFixture attribute instead of inheritance",false)]
+ public class TestCase : Assertion
+ {
+ /// <summary>
+ /// Method called immediately before running the test.
+ /// </summary>
+ [SetUp]
+ [Obsolete("use SetUp attribute instead of naming convention",false)]
+ protected virtual void SetUp()
+ {}
+
+ /// <summary>
+ /// Method Called immediately after running the test. It is
+ /// guaranteed to be called, even if an exception is thrown.
+ /// </summary>
+ [TearDown]
+ [Obsolete("use TearDown attribute instead of naming convention",false)]
+ protected virtual void TearDown()
+ {}
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/PropertyAttribute.cs b/mcs/nunit24/NUnitFramework/framework/PropertyAttribute.cs
new file mode 100644
index 00000000000..7accb1e238b
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/PropertyAttribute.cs
@@ -0,0 +1,66 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// PropertyAttribute is used to attach information to a test as a name/value pair..
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
+ public class PropertyAttribute : Attribute
+ {
+ /// <summary>
+ /// The property name
+ /// </summary>
+ protected string propertyName;
+
+ /// <summary>
+ /// The property value
+ /// </summary>
+ protected object propertyValue;
+
+ /// <summary>
+ /// Construct a PropertyAttribute with a name and value
+ /// </summary>
+ /// <param name="propertyName">The name of the property</param>
+ /// <param name="propertyValue">The property value</param>
+ public PropertyAttribute( string propertyName, object propertyValue )
+ {
+ this.propertyName = propertyName;
+ this.propertyValue = propertyValue;
+ }
+
+ /// <summary>
+ /// Constructor for use by inherited classes that use the
+ /// name of the type as the property name.
+ /// </summary>
+ protected PropertyAttribute( object propertyValue )
+ {
+ this.propertyName = this.GetType().Name;
+ if ( propertyName.EndsWith( "Attribute" ) )
+ propertyName = propertyName.Substring( 0, propertyName.Length - 9 );
+ this.propertyValue = propertyValue;
+ }
+
+ /// <summary>
+ /// Gets the property name
+ /// </summary>
+ public string Name
+ {
+ get { return propertyName; }
+ }
+
+ /// <summary>
+ /// Gets the property value
+ /// </summary>
+ public object Value
+ {
+ get { return propertyValue; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SetCultureAttribute.cs b/mcs/nunit24/NUnitFramework/framework/SetCultureAttribute.cs
new file mode 100644
index 00000000000..45dfb652c36
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SetCultureAttribute.cs
@@ -0,0 +1,17 @@
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Summary description for SetCultureAttribute.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method|AttributeTargets.Assembly, AllowMultiple=true)]
+ public class SetCultureAttribute : PropertyAttribute
+ {
+ /// <summary>
+ /// Construct given the name of a culture
+ /// </summary>
+ /// <param name="culture"></param>
+ public SetCultureAttribute( string culture ) : base( "_SETCULTURE", culture ) { }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SetUpAttribute.cs b/mcs/nunit24/NUnitFramework/framework/SetUpAttribute.cs
new file mode 100644
index 00000000000..34e46eca24a
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SetUpAttribute.cs
@@ -0,0 +1,19 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Attribute used to mark a class that contains one-time SetUp
+ /// and/or TearDown methods that apply to all the tests in a
+ /// namespace or an assembly.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class SetUpAttribute : Attribute
+ {}
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SetUpFixtureAttribute.cs b/mcs/nunit24/NUnitFramework/framework/SetUpFixtureAttribute.cs
new file mode 100644
index 00000000000..40c0655ad89
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SetUpFixtureAttribute.cs
@@ -0,0 +1,18 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// SetUpFixtureAttribute is used to identify a SetUpFixture
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
+ public class SetUpFixtureAttribute : Attribute
+ {
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/StringAssert.cs b/mcs/nunit24/NUnitFramework/framework/StringAssert.cs
new file mode 100644
index 00000000000..c2510b84112
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/StringAssert.cs
@@ -0,0 +1,227 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System.ComponentModel;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Basic Asserts on strings.
+ /// </summary>
+ public class StringAssert
+ {
+ #region Equals and ReferenceEquals
+
+ /// <summary>
+ /// The Equals method throws an AssertionException. This is done
+ /// to make sure there is no mistake by calling this function.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static new bool Equals(object a, object b)
+ {
+ throw new AssertionException("Assert.Equals should not be used for Assertions");
+ }
+
+ /// <summary>
+ /// override the default ReferenceEquals to throw an AssertionException. This
+ /// implementation makes sure there is no mistake in calling this function
+ /// as part of Assert.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ public static new void ReferenceEquals(object a, object b)
+ {
+ throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
+ }
+
+ #endregion
+
+ #region Contains
+
+ /// <summary>
+ /// Asserts that a string is found within another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Arguments used in formatting the message</param>
+ static public void Contains( string expected, string actual, string message, params object[] args )
+ {
+ Assert.That(actual, new SubstringConstraint(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a string is found within another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ static public void Contains( string expected, string actual, string message )
+ {
+ Contains( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that a string is found within another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ static public void Contains( string expected, string actual )
+ {
+ Contains( expected, actual, string.Empty, null );
+ }
+
+ #endregion
+
+ #region StartsWith
+
+ /// <summary>
+ /// Asserts that a string starts with another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Arguments used in formatting the message</param>
+ static public void StartsWith( string expected, string actual, string message, params object[] args )
+ {
+ Assert.That(actual, new StartsWithConstraint(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a string starts with another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ static public void StartsWith( string expected, string actual, string message )
+ {
+ StartsWith( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that a string starts with another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ static public void StartsWith( string expected, string actual )
+ {
+ StartsWith( expected, actual, string.Empty, null );
+ }
+
+ #endregion
+
+ #region EndsWith
+
+ /// <summary>
+ /// Asserts that a string ends with another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Arguments used in formatting the message</param>
+ static public void EndsWith( string expected, string actual, string message, params object[] args )
+ {
+ Assert.That(actual, new EndsWithConstraint(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a string ends with another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ static public void EndsWith( string expected, string actual, string message )
+ {
+ EndsWith( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that a string ends with another string.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The string to be examined</param>
+ static public void EndsWith( string expected, string actual )
+ {
+ EndsWith( expected, actual, string.Empty, null );
+ }
+
+ #endregion
+
+ #region AreEqualIgnoringCase
+ /// <summary>
+ /// Asserts that two strings are equal, without regard to case.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The actual string</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Arguments used in formatting the message</param>
+ static public void AreEqualIgnoringCase( string expected, string actual, string message, params object[] args )
+ {
+ Assert.That(actual, new EqualConstraint(expected).IgnoreCase, message, args);
+ }
+
+ /// <summary>
+ /// Asserts that two strings are equal, without regard to case.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The actual string</param>
+ /// <param name="message">The message to display in case of failure</param>
+ static public void AreEqualIgnoringCase( string expected, string actual, string message )
+ {
+ AreEqualIgnoringCase( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that two strings are equal, without regard to case.
+ /// </summary>
+ /// <param name="expected">The expected string</param>
+ /// <param name="actual">The actual string</param>
+ static public void AreEqualIgnoringCase( string expected, string actual )
+ {
+ AreEqualIgnoringCase( expected, actual, string.Empty, null );
+ }
+
+ #endregion
+
+ #region IsMatch
+ /// <summary>
+ /// Asserts that a string matches an expected regular expression pattern.
+ /// </summary>
+ /// <param name="expected">The expected expression</param>
+ /// <param name="actual">The actual string</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Arguments used in formatting the message</param>
+ static public void IsMatch( string expected, string actual, string message, params object[] args )
+ {
+ Assert.That(actual, new RegexConstraint(expected), message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a string matches an expected regular expression pattern.
+ /// </summary>
+ /// <param name="expected">The expected expression</param>
+ /// <param name="actual">The actual string</param>
+ /// <param name="message">The message to display in case of failure</param>
+ static public void IsMatch( string expected, string actual, string message )
+ {
+ IsMatch( expected, actual, message, null );
+ }
+
+ /// <summary>
+ /// Asserts that a string matches an expected regular expression pattern.
+ /// </summary>
+ /// <param name="expected">The expected expression</param>
+ /// <param name="actual">The actual string</param>
+ static public void IsMatch( string expected, string actual )
+ {
+ IsMatch( expected, actual, string.Empty, null );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SuiteAttribute.cs b/mcs/nunit24/NUnitFramework/framework/SuiteAttribute.cs
new file mode 100644
index 00000000000..a2bb6712b7e
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SuiteAttribute.cs
@@ -0,0 +1,18 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Attribute used to mark a static (shared in VB) property
+ /// that returns a list of tests.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property, AllowMultiple=false)]
+ public class SuiteAttribute : Attribute
+ {}
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Has.cs b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Has.cs
new file mode 100644
index 00000000000..147c7f4425d
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Has.cs
@@ -0,0 +1,144 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework.SyntaxHelpers
+{
+ /// <summary>
+ /// Summary description for HasNoPrefixB.
+ /// </summary>
+ public class Has
+ {
+ /// <summary>
+ /// Nested class that allows us to restrict the number
+ /// of key words that may appear after Has.No.
+ /// </summary>
+ public class HasNoPrefixBuilder
+ {
+ /// <summary>
+ /// Return a ConstraintBuilder conditioned to apply
+ /// the following constraint to a property.
+ /// </summary>
+ /// <param name="name">The property name</param>
+ /// <returns>A ConstraintBuilder</returns>
+ public ConstraintBuilder Property(string name)
+ {
+ return new ConstraintBuilder().Not.Property(name);
+ }
+
+ /// <summary>
+ /// Return a Constraint that succeeds if the expected object is
+ /// not contained in a collection.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <returns>A Constraint</returns>
+ public Constraint Member(object expected)
+ {
+ return new NotConstraint( new CollectionContainsConstraint(expected) ) ;
+ }
+ }
+
+ #region Prefix Operators
+ /// <summary>
+ /// Has.No returns a ConstraintBuilder that negates
+ /// the constraint that follows it.
+ /// </summary>
+ public static HasNoPrefixBuilder No
+ {
+ get { return new HasNoPrefixBuilder(); }
+ }
+
+ /// <summary>
+ /// Has.AllItems returns a ConstraintBuilder, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+ public static ConstraintBuilder All
+ {
+ get { return new ConstraintBuilder().All; }
+ }
+
+ /// <summary>
+ /// Has.Some returns a ConstraintBuilder, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if any of them succeed. It is a synonym
+ /// for Has.Item.
+ /// </summary>
+ public static ConstraintBuilder Some
+ {
+ get { return new ConstraintBuilder().Some; }
+ }
+
+ /// <summary>
+ /// Has.None returns a ConstraintBuilder, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding only if none of them succeed.
+ /// </summary>
+ public static ConstraintBuilder None
+ {
+ get { return new ConstraintBuilder().None; }
+ }
+
+ /// <summary>
+ /// Returns a new ConstraintBuilder, which will apply the
+ /// following constraint to a named property of the object
+ /// being tested.
+ /// </summary>
+ /// <param name="name">The name of the property</param>
+ public static ConstraintBuilder Property( string name )
+ {
+ return new ConstraintBuilder().Property(name);
+ }
+ #endregion
+
+ #region Property Constraints
+ /// <summary>
+ /// Returns a new PropertyConstraint checking for the
+ /// existence of a particular property value.
+ /// </summary>
+ /// <param name="name">The name of the property to look for</param>
+ /// <param name="expected">The expected value of the property</param>
+ public static Constraint Property( string name, object expected )
+ {
+ return new PropertyConstraint( name, new EqualConstraint( expected ) );
+ }
+
+ /// <summary>
+ /// Returns a new PropertyConstraint for the Length property
+ /// </summary>
+ /// <param name="length"></param>
+ /// <returns></returns>
+ public static Constraint Length( int length )
+ {
+ return Property( "Length", length );
+ }
+
+ /// <summary>
+ /// Returns a new PropertyConstraint or the Count property
+ /// </summary>
+ /// <param name="count"></param>
+ /// <returns></returns>
+ public static Constraint Count( int count )
+ {
+ return Property( "Count", count );
+ }
+ #endregion
+
+ #region Member Constraint
+ /// <summary>
+ /// Returns a new CollectionContainsConstraint checking for the
+ /// presence of a particular object in the collection.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ public static Constraint Member( object expected )
+ {
+ return new CollectionContainsConstraint( expected );
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Is.cs b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Is.cs
new file mode 100644
index 00000000000..90f3bb48e5e
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Is.cs
@@ -0,0 +1,212 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework.SyntaxHelpers
+{
+ /// <summary>
+ /// The Is class is a helper class with properties and methods
+ /// that supply a number of constraints used in Asserts.
+ /// </summary>
+ public class Is
+ {
+ #region Prefix Operators
+ /// <summary>
+ /// Is.Not returns a ConstraintBuilder that negates
+ /// the constraint that follows it.
+ /// </summary>
+ public static ConstraintBuilder Not
+ {
+ get { return new ConstraintBuilder().Not; }
+ }
+
+ /// <summary>
+ /// Is.All returns a ConstraintBuilder, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed. This property is
+ /// a synonym for Has.AllItems.
+ /// </summary>
+ public static ConstraintBuilder All
+ {
+ get { return new ConstraintBuilder().All; }
+ }
+ #endregion
+
+ #region Constraints Without Arguments
+ /// <summary>
+ /// Is.Null returns a static constraint that tests for null
+ /// </summary>
+ public static readonly Constraint Null = new EqualConstraint( null );
+ /// <summary>
+ /// Is.True returns a static constraint that tests whether a value is true
+ /// </summary>
+ public static readonly Constraint True = new EqualConstraint(true);
+ /// <summary>
+ /// Is.False returns a static constraint that tests whether a value is false
+ /// </summary>
+ public static readonly Constraint False = new EqualConstraint(false);
+ /// <summary>
+ /// Is.NaN returns a static constraint that tests whether a value is an NaN
+ /// </summary>
+ public static readonly Constraint NaN = new EqualConstraint(double.NaN);
+ /// <summary>
+ /// Is.Empty returns a static constraint that tests whether a string or collection is empty
+ /// </summary>
+ public static readonly Constraint Empty = new EmptyConstraint();
+ /// <summary>
+ /// Is.Unique returns a static constraint that tests whether a collection contains all unque items.
+ /// </summary>
+ public static readonly Constraint Unique = new UniqueItemsConstraint();
+ #endregion
+
+ #region Constraints with an expected value
+
+ #region Equality and Identity
+ /// <summary>
+ /// Is.EqualTo returns a constraint that tests whether the
+ /// actual value equals the supplied argument
+ /// </summary>
+ /// <param name="expected"></param>
+ /// <returns></returns>
+ public static EqualConstraint EqualTo(object expected)
+ {
+ return new EqualConstraint(expected);
+ }
+ /// <summary>
+ /// Is.SameAs returns a constraint that tests whether the
+ /// actual value is the same object as the supplied argument.
+ /// </summary>
+ /// <param name="expected"></param>
+ /// <returns></returns>
+ public static Constraint SameAs(object expected)
+ {
+ return new SameAsConstraint(expected);
+ }
+ #endregion
+
+ #region Comparison Constraints
+ /// <summary>
+ /// Is.GreaterThan returns a constraint that tests whether the
+ /// actual value is greater than the suppled argument
+ /// </summary>
+ public static Constraint GreaterThan(IComparable expected)
+ {
+ return new GreaterThanConstraint(expected);
+ }
+ /// <summary>
+ /// Is.GreaterThanOrEqualTo returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+ public static Constraint GreaterThanOrEqualTo(IComparable expected)
+ {
+ return new GreaterThanOrEqualConstraint(expected);
+ }
+
+ /// <summary>
+ /// Is.AtLeast is a synonym for Is.GreaterThanOrEqualTo
+ /// </summary>
+ public static Constraint AtLeast(IComparable expected)
+ {
+ return GreaterThanOrEqualTo(expected);
+ }
+
+ /// <summary>
+ /// Is.LessThan returns a constraint that tests whether the
+ /// actual value is less than the suppled argument
+ /// </summary>
+ public static Constraint LessThan(IComparable expected)
+ {
+ return new LessThanConstraint(expected);
+ }
+
+ /// <summary>
+ /// Is.LessThanOrEqualTo returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+ public static Constraint LessThanOrEqualTo(IComparable expected)
+ {
+ return new LessThanOrEqualConstraint(expected);
+ }
+
+ /// <summary>
+ /// Is.AtMost is a synonym for Is.LessThanOrEqualTo
+ /// </summary>
+ public static Constraint AtMost(IComparable expected)
+ {
+ return LessThanOrEqualTo(expected);
+ }
+ #endregion
+
+ #region Type Constraints
+ /// <summary>
+ /// Is.TypeOf returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+ public static Constraint TypeOf(Type expectedType)
+ {
+ return new ExactTypeConstraint(expectedType);
+ }
+
+ /// <summary>
+ /// Is.InstanceOfType returns a constraint that tests whether
+ /// the actual value is of the type supplied as an argument
+ /// or a derived type.
+ /// </summary>
+ public static Constraint InstanceOfType(Type expectedType)
+ {
+ return new InstanceOfTypeConstraint(expectedType);
+ }
+
+ /// <summary>
+ /// Is.AssignableFrom returns a constraint that tests whether
+ /// the actual value is assignable from the type supplied as
+ /// an argument.
+ /// </summary>
+ /// <param name="expectedType"></param>
+ /// <returns></returns>
+ public static Constraint AssignableFrom(Type expectedType)
+ {
+ return new AssignableFromConstraint(expectedType);
+ }
+ #endregion
+
+ #region Collection Constraints
+ /// <summary>
+ /// Is.EquivalentTo returns a constraint that tests whether
+ /// the actual value is a collection containing the same
+ /// elements as the collection supplied as an arument
+ /// </summary>
+ public static Constraint EquivalentTo(ICollection expected)
+ {
+ return new CollectionEquivalentConstraint(expected);
+ }
+
+ /// <summary>
+ /// Is.SubsetOf returns a constraint that tests whether
+ /// the actual value is a subset of the collection
+ /// supplied as an arument
+ /// </summary>
+ public static Constraint SubsetOf(ICollection expected)
+ {
+ return new CollectionSubsetConstraint(expected);
+ }
+ #endregion
+
+ #endregion
+ }
+
+
+ /// <summary>
+ /// The Iz class is a synonym for Is intended for use in VB,
+ /// which regards Is as a keyword.
+ /// </summary>
+ public class Iz : Is
+ {
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/List.cs b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/List.cs
new file mode 100644
index 00000000000..91c9d31c5d6
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/List.cs
@@ -0,0 +1,30 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework.SyntaxHelpers
+{
+ /// <summary>
+ /// The List class is a helper class with properties and methods
+ /// that supply a number of constraints used with lists and collections.
+ /// </summary>
+ public class List
+ {
+ /// <summary>
+ /// List.Map returns a ListMapper, which can be used to map
+ /// the original collection to another collection.
+ /// </summary>
+ /// <param name="actual"></param>
+ /// <returns></returns>
+ public static ListMapper Map( ICollection actual )
+ {
+ return new ListMapper( actual );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/ListMapper.cs b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/ListMapper.cs
new file mode 100644
index 00000000000..957746991d7
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/ListMapper.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections;
+using System.Reflection;
+
+namespace NUnit.Framework.SyntaxHelpers
+{
+ /// <summary>
+ /// ListMapper is used to transform a collection used as an actual argument
+ /// producing another collection to be used in the assertion.
+ /// </summary>
+ public class ListMapper
+ {
+ ICollection original;
+
+ /// <summary>
+ /// Construct a ListMapper based on a collection
+ /// </summary>
+ /// <param name="original">The collection to be transformed</param>
+ public ListMapper( ICollection original )
+ {
+ this.original = original;
+ }
+
+ /// <summary>
+ /// Produces a collection containing all the values of a property
+ /// </summary>
+ /// <param name="name">The collection of property values</param>
+ /// <returns></returns>
+ public ICollection Property( string name )
+ {
+ ArrayList propList = new ArrayList();
+ foreach( object item in original )
+ {
+ PropertyInfo property = item.GetType().GetProperty( name,
+ BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
+ if ( property == null )
+ throw new ArgumentException( string.Format(
+ "{0} does not have a {1} property", item, name ) );
+
+ propList.Add( property.GetValue( item, null ) );
+ }
+
+ return propList;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Text.cs b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Text.cs
new file mode 100644
index 00000000000..8a53eb264aa
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/SyntaxHelpers/Text.cs
@@ -0,0 +1,104 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework.SyntaxHelpers
+{
+ /// <summary>
+ /// The Text class is a helper class with properties and methods
+ /// that supply a number of constraints used with strings.
+ /// </summary>
+ public class Text
+ {
+ /// <summary>
+ /// Text.All returns a ConstraintBuilder, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+ public static ConstraintBuilder All
+ {
+ get { return new ConstraintBuilder().All; }
+ }
+
+ /// <summary>
+ /// Contains returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+ public static Constraint Contains(string substring)
+ {
+ return new SubstringConstraint(substring);
+ }
+
+ /// <summary>
+ /// DoesNotContain returns a constraint that fails if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+ public static Constraint DoesNotContain(string substring)
+ {
+ return new NotConstraint( Contains(substring) );
+ }
+
+ /// <summary>
+ /// StartsWith returns a constraint that succeeds if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+ public static Constraint StartsWith(string substring)
+ {
+ return new StartsWithConstraint(substring);
+ }
+
+ /// <summary>
+ /// DoesNotStartWith returns a constraint that fails if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+ public static Constraint DoesNotStartWith(string substring)
+ {
+ return new NotConstraint( StartsWith(substring) );
+ }
+
+ /// <summary>
+ /// EndsWith returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+ public static Constraint EndsWith(string substring)
+ {
+ return new EndsWithConstraint(substring);
+ }
+
+ /// <summary>
+ /// DoesNotEndWith returns a constraint that fails if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+ public static Constraint DoesNotEndWith(string substring)
+ {
+ return new NotConstraint( EndsWith(substring) );
+ }
+
+ /// <summary>
+ /// Matches returns a constraint that succeeds if the actual
+ /// value matches the pattern supplied as an argument.
+ /// </summary>
+ /// <param name="pattern"></param>
+ /// <returns></returns>
+ public static Constraint Matches(string pattern)
+ {
+ return new RegexConstraint(pattern);
+ }
+
+ /// <summary>
+ /// DoesNotMatch returns a constraint that failss if the actual
+ /// value matches the pattern supplied as an argument.
+ /// </summary>
+ /// <param name="pattern"></param>
+ /// <returns></returns>
+ public static Constraint DoesNotMatch(string pattern)
+ {
+ return new NotConstraint( Matches(pattern) );
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/TearDownAttribute.cs b/mcs/nunit24/NUnitFramework/framework/TearDownAttribute.cs
new file mode 100644
index 00000000000..a08f49172c7
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/TearDownAttribute.cs
@@ -0,0 +1,19 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Attribute used to identify a method that is called
+ /// immediately after each test is run. The method is
+ /// guaranteed to be called, even if an exception is thrown.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class TearDownAttribute : Attribute
+ {}
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/TestAttribute.cs b/mcs/nunit24/NUnitFramework/framework/TestAttribute.cs
new file mode 100644
index 00000000000..be455d60079
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/TestAttribute.cs
@@ -0,0 +1,46 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Adding this attribute to a method within a <seealso cref="TestFixtureAttribute"/>
+ /// class makes the method callable from the NUnit test runner. There is a property
+ /// called Description which is optional which you can provide a more detailed test
+ /// description. This class cannot be inherited.
+ /// </summary>
+ ///
+ /// <example>
+ /// [TestFixture]
+ /// public class Fixture
+ /// {
+ /// [Test]
+ /// public void MethodToTest()
+ /// {}
+ ///
+ /// [Test(Description = "more detailed description")]
+ /// publc void TestDescriptionMethod()
+ /// {}
+ /// }
+ /// </example>
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class TestAttribute : Attribute
+ {
+ private string description;
+
+ /// <summary>
+ /// Descriptive text for this test
+ /// </summary>
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/TestFixtureAttribute.cs b/mcs/nunit24/NUnitFramework/framework/TestFixtureAttribute.cs
new file mode 100644
index 00000000000..06794aa8b12
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/TestFixtureAttribute.cs
@@ -0,0 +1,30 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <example>
+ /// [TestFixture]
+ /// public class ExampleClass
+ /// {}
+ /// </example>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
+ public class TestFixtureAttribute : Attribute
+ {
+ private string description;
+
+ /// <summary>
+ /// Descriptive text for this fixture
+ /// </summary>
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/TestFixtureSetUpAttribute.cs b/mcs/nunit24/NUnitFramework/framework/TestFixtureSetUpAttribute.cs
new file mode 100644
index 00000000000..628ca011e2a
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/TestFixtureSetUpAttribute.cs
@@ -0,0 +1,19 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Attribute used to identify a method that is
+ /// called before any tests in a fixture are run.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class TestFixtureSetUpAttribute : Attribute
+ {
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/TestFixtureTearDownAttribute.cs b/mcs/nunit24/NUnitFramework/framework/TestFixtureTearDownAttribute.cs
new file mode 100644
index 00000000000..17978762971
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/TestFixtureTearDownAttribute.cs
@@ -0,0 +1,21 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// <summary>
+ /// Attribute used to identify a method that is called after
+ /// all the tests in a fixture have run. The method is
+ /// guaranteed to be called, even if an exception is thrown.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class TestFixtureTearDownAttribute : Attribute
+ {
+ }
+}
+
diff --git a/mcs/nunit24/NUnitFramework/framework/TextMessageWriter.cs b/mcs/nunit24/NUnitFramework/framework/TextMessageWriter.cs
new file mode 100644
index 00000000000..a3dc245e729
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/TextMessageWriter.cs
@@ -0,0 +1,474 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.IO;
+using System.Text;
+using System.Collections;
+using System.Globalization;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// TextMessageWriter writes constraint descriptions and messages
+ /// in displayable form as a text stream. It tailors the display
+ /// of individual message components to form the standard message
+ /// format of NUnit assertion failure messages.
+ /// </summary>
+ public class TextMessageWriter : MessageWriter
+ {
+ #region Message Formats and Constants
+ private static readonly int DEFAULT_LINE_LENGTH = 78;
+
+ // Prefixes used in all failure messages. All must be the same
+ // length, which is held in the PrefixLength field. Should not
+ // contain any tabs or newline characters.
+ /// <summary>
+ /// Prefix used for the expected value line of a message
+ /// </summary>
+ public static readonly string Pfx_Expected = " Expected: ";
+ /// <summary>
+ /// Prefix used for the actual value line of a message
+ /// </summary>
+ public static readonly string Pfx_Actual = " But was: ";
+ /// <summary>
+ /// Length of a message prefix
+ /// </summary>
+ public static readonly int PrefixLength = Pfx_Expected.Length;
+
+ private static readonly string Fmt_Connector = " {0} ";
+ private static readonly string Fmt_Predicate = "{0} ";
+ //private static readonly string Fmt_Label = "{0}";
+ private static readonly string Fmt_Modifier = ", {0}";
+
+ private static readonly string Fmt_Null = "null";
+ private static readonly string Fmt_EmptyString = "<string.Empty>";
+ private static readonly string Fmt_EmptyCollection = "<empty>";
+
+ private static readonly string Fmt_String = "\"{0}\"";
+ private static readonly string Fmt_Char = "'{0}'";
+ private static readonly string Fmt_DateTime = "yyyy-MM-dd HH:mm:ss.fff";
+ private static readonly string Fmt_ValueType = "{0}";
+ private static readonly string Fmt_Default = "<{0}>";
+ #endregion
+
+ private int maxLineLength = DEFAULT_LINE_LENGTH;
+
+ #region Constructors
+ /// <summary>
+ /// Construct a TextMessageWriter
+ /// </summary>
+ public TextMessageWriter() { }
+
+ /// <summary>
+ /// Construct a TextMessageWriter, specifying a user message
+ /// and optional formatting arguments.
+ /// </summary>
+ /// <param name="userMessage"></param>
+ /// <param name="args"></param>
+ public TextMessageWriter(string userMessage, params object[] args)
+ {
+ if ( userMessage != null && userMessage != string.Empty)
+ this.WriteMessageLine(userMessage, args);
+ }
+ #endregion
+
+ #region Properties
+ /// <summary>
+ /// Gets or sets the maximum line length for this writer
+ /// </summary>
+ public override int MaxLineLength
+ {
+ get { return maxLineLength; }
+ set { maxLineLength = value; }
+ }
+ #endregion
+
+ #region Public Methods - High Level
+ /// <summary>
+ /// Method to write single line message with optional args, usually
+ /// written to precede the general failure message, at a givel
+ /// indentation level.
+ /// </summary>
+ /// <param name="level">The indentation level of the message</param>
+ /// <param name="message">The message to be written</param>
+ /// <param name="args">Any arguments used in formatting the message</param>
+ public override void WriteMessageLine(int level, string message, params object[] args)
+ {
+ if (message != null)
+ {
+ while (level-- >= 0) Write(" ");
+
+ if (args != null && args.Length > 0)
+ message = string.Format(message, args);
+
+ WriteLine(message);
+ }
+ }
+
+ /// <summary>
+ /// Display Expected and Actual lines for a constraint. This
+ /// is called by MessageWriter's default implementation of
+ /// WriteMessageTo and provides the generic two-line display.
+ /// </summary>
+ /// <param name="constraint">The constraint that failed</param>
+ public override void DisplayDifferences(Constraint constraint)
+ {
+ WriteExpectedLine(constraint);
+ WriteActualLine(constraint);
+ }
+
+ /// <summary>
+ /// Display Expected and Actual lines for given values. This
+ /// method may be called by constraints that need more control over
+ /// the display of actual and expected values than is provided
+ /// by the default implementation.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value causing the failure</param>
+ public override void DisplayDifferences(object expected, object actual)
+ {
+ WriteExpectedLine(expected);
+ WriteActualLine(actual);
+ }
+
+ /// <summary>
+ /// Display Expected and Actual lines for given values, including
+ /// a tolerance value on the expected line.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value causing the failure</param>
+ /// <param name="tolerance">The tolerance within which the test was made</param>
+ public override void DisplayDifferences(object expected, object actual, object tolerance)
+ {
+ WriteExpectedLine(expected, tolerance);
+ WriteActualLine(actual);
+ }
+
+ /// <summary>
+ /// Display the expected and actual string values on separate lines.
+ /// If the mismatch parameter is >=0, an additional line is displayed
+ /// line containing a caret that points to the mismatch point.
+ /// </summary>
+ /// <param name="expected">The expected string value</param>
+ /// <param name="actual">The actual string value</param>
+ /// <param name="mismatch">The point at which the strings don't match or -1</param>
+ /// <param name="ignoreCase">If true, case is ignored in string comparisons</param>
+ /// <param name="clipping">If true, clip the strings to fit the max line length</param>
+ public override void DisplayStringDifferences(string expected, string actual, int mismatch, bool ignoreCase, bool clipping)
+ {
+ // Maximum string we can display without truncating
+ int maxDisplayLength = MaxLineLength
+ - PrefixLength // Allow for prefix
+ - 2; // 2 quotation marks
+
+ if ( clipping )
+ MsgUtils.ClipExpectedAndActual(ref expected, ref actual, maxDisplayLength, mismatch);
+
+ expected = MsgUtils.ConvertWhitespace(expected);
+ actual = MsgUtils.ConvertWhitespace(actual);
+
+ // The mismatch position may have changed due to clipping or white space conversion
+ mismatch = MsgUtils.FindMismatchPosition(expected, actual, 0, ignoreCase);
+
+ Write( Pfx_Expected );
+ WriteExpectedValue( expected );
+ if ( ignoreCase )
+ WriteModifier( "ignoring case" );
+ WriteLine();
+ WriteActualLine( actual );
+ //DisplayDifferences(expected, actual);
+ if (mismatch >= 0)
+ WriteCaretLine(mismatch);
+ }
+ #endregion
+
+ #region Public Methods - Low Level
+ /// <summary>
+ /// Writes the text for a connector.
+ /// </summary>
+ /// <param name="connector">The connector.</param>
+ public override void WriteConnector(string connector)
+ {
+ Write(Fmt_Connector, connector);
+ }
+
+ /// <summary>
+ /// Writes the text for a predicate.
+ /// </summary>
+ /// <param name="predicate">The predicate.</param>
+ public override void WritePredicate(string predicate)
+ {
+ Write(Fmt_Predicate, predicate);
+ }
+
+ //public override void WriteLabel(string label)
+ //{
+ // Write(Fmt_Label, label);
+ //}
+
+ /// <summary>
+ /// Write the text for a modifier.
+ /// </summary>
+ /// <param name="modifier">The modifier.</param>
+ public override void WriteModifier(string modifier)
+ {
+ Write(Fmt_Modifier, modifier);
+ }
+
+
+ /// <summary>
+ /// Writes the text for an expected value.
+ /// </summary>
+ /// <param name="expected">The expected value.</param>
+ public override void WriteExpectedValue(object expected)
+ {
+ WriteValue(expected);
+ }
+
+ /// <summary>
+ /// Writes the text for an actual value.
+ /// </summary>
+ /// <param name="actual">The actual value.</param>
+ public override void WriteActualValue(object actual)
+ {
+ WriteValue(actual);
+ }
+
+ /// <summary>
+ /// Writes the text for a generalized value.
+ /// </summary>
+ /// <param name="val">The value.</param>
+ public override void WriteValue(object val)
+ {
+ if (val == null)
+ Write(Fmt_Null);
+ else if (val.GetType().IsArray)
+ WriteArray((Array)val);
+ else if (val is ICollection)
+ WriteCollectionElements((ICollection)val, 0, 10);
+ else if (val is string)
+ WriteString((string)val);
+ else if (val is char)
+ WriteChar((char)val);
+ else if (val is double)
+ WriteDouble((double)val);
+ else if (val is float)
+ WriteFloat((float)val);
+ else if (val is decimal)
+ WriteDecimal((decimal)val);
+ else if (val is DateTime)
+ WriteDateTime((DateTime)val);
+ else if (val.GetType().IsValueType)
+ Write(Fmt_ValueType, val);
+ else
+ Write(Fmt_Default, val);
+ }
+
+ /// <summary>
+ /// Writes the text for a collection value,
+ /// starting at a particular point, to a max length
+ /// </summary>
+ /// <param name="collection">The collection containing elements to write.</param>
+ /// <param name="start">The starting point of the elements to write</param>
+ /// <param name="max">The maximum number of elements to write</param>
+ public override void WriteCollectionElements(ICollection collection, int start, int max)
+ {
+ if ( collection.Count == 0 )
+ {
+ Write(Fmt_EmptyCollection);
+ return;
+ }
+
+ int count = 0;
+ int index = 0;
+ Write("< ");
+
+ foreach (object obj in collection)
+ {
+ if ( index++ >= start )
+ {
+ if (count > 0)
+ Write(", ");
+ WriteValue(obj);
+ if ( ++count >= max )
+ break;
+ }
+ }
+
+ if ( index < collection.Count )
+ Write("...");
+
+ Write(" >");
+ }
+
+ private void WriteArray(Array array)
+ {
+ if ( array.Length == 0 )
+ {
+ Write( Fmt_EmptyCollection );
+ return;
+ }
+
+ int rank = array.Rank;
+ int[] products = new int[rank];
+
+ for (int product = 1, r = rank; --r >= 0; )
+ products[r] = product *= array.GetLength(r);
+
+ int count = 0;
+ foreach (object obj in array)
+ {
+ if (count > 0)
+ Write(", ");
+
+ bool startSegment = false;
+ for (int r = 0; r < rank; r++)
+ {
+ startSegment = startSegment || count % products[r] == 0;
+ if (startSegment) Write("< ");
+ }
+
+ WriteValue(obj);
+
+ ++count;
+
+ bool nextSegment = false;
+ for (int r = 0; r < rank; r++)
+ {
+ nextSegment = nextSegment || count % products[r] == 0;
+ if (nextSegment) Write(" >");
+ }
+ }
+ }
+
+ private void WriteString(string s)
+ {
+ if (s == string.Empty)
+ Write(Fmt_EmptyString);
+ else
+ Write(Fmt_String, s);
+ }
+
+ private void WriteChar(char c)
+ {
+ Write(Fmt_Char, c);
+ }
+
+ private void WriteDouble(double d)
+ {
+
+ if (double.IsNaN(d) || double.IsInfinity(d))
+ Write(d);
+ else
+ {
+ string s = d.ToString("G17", CultureInfo.InvariantCulture);
+
+ if (s.IndexOf('.') > 0)
+ Write(s + "d");
+ else
+ Write(s + ".0d");
+ }
+ }
+
+ private void WriteFloat(float f)
+ {
+ if (float.IsNaN(f) || float.IsInfinity(f))
+ Write(f);
+ else
+ {
+ string s = f.ToString("G9", CultureInfo.InvariantCulture);
+
+ if (s.IndexOf('.') > 0)
+ Write(s + "f");
+ else
+ Write(s + ".0f");
+ }
+ }
+
+ private void WriteDecimal(Decimal d)
+ {
+ Write(d.ToString("G29", CultureInfo.InvariantCulture) + "m");
+ }
+
+ private void WriteDateTime(DateTime dt)
+ {
+ Write(dt.ToString(Fmt_DateTime, CultureInfo.InvariantCulture));
+ }
+ #endregion
+
+ #region Helper Methods
+ /// <summary>
+ /// Write the generic 'Expected' line for a constraint
+ /// </summary>
+ /// <param name="constraint">The constraint that failed</param>
+ private void WriteExpectedLine(Constraint constraint)
+ {
+ Write(Pfx_Expected);
+ constraint.WriteDescriptionTo(this);
+ WriteLine();
+ }
+
+ /// <summary>
+ /// Write the generic 'Expected' line for a given value
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ private void WriteExpectedLine(object expected)
+ {
+ WriteExpectedLine(expected, null);
+ }
+
+ /// <summary>
+ /// Write the generic 'Expected' line for a given value
+ /// and tolerance.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="tolerance">The tolerance within which the test was made</param>
+ private void WriteExpectedLine(object expected, object tolerance)
+ {
+ Write(Pfx_Expected);
+ WriteExpectedValue(expected);
+
+ if (tolerance != null)
+ {
+ WriteConnector("+/-");
+ WriteExpectedValue(tolerance);
+ }
+
+ WriteLine();
+ }
+
+ /// <summary>
+ /// Write the generic 'Actual' line for a constraint
+ /// </summary>
+ /// <param name="constraint">The constraint for which the actual value is to be written</param>
+ private void WriteActualLine(Constraint constraint)
+ {
+ Write(Pfx_Actual);
+ constraint.WriteActualValueTo(this);
+ WriteLine();
+ }
+
+ /// <summary>
+ /// Write the generic 'Actual' line for a given value
+ /// </summary>
+ /// <param name="actual">The actual value causing a failure</param>
+ private void WriteActualLine(object actual)
+ {
+ Write(Pfx_Actual);
+ WriteActualValue(actual);
+ WriteLine();
+ }
+
+ private void WriteCaretLine(int mismatch)
+ {
+ // We subtract 2 for the initial 2 blanks and add back 1 for the initial quote
+ WriteLine(" {0}^", new string('-', PrefixLength + mismatch - 2 + 1));
+ }
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitFramework/framework/nunit.framework.build b/mcs/nunit24/NUnitFramework/framework/nunit.framework.build
new file mode 100644
index 00000000000..b18c5ecd58f
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/nunit.framework.build
@@ -0,0 +1,79 @@
+<?xml version="1.0"?>
+<project name="NUnitFramework" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.framework.dll"
+ doc="${current.build.dir}/nunit.framework.xml"
+ debug="${build.debug}"
+ define="${build.defines}">
+ <nowarn>
+ <warning number="618,672"/>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <sources basedir=".">
+ <include name="Constraints/BinaryOperations.cs"/>
+ <include name="Constraints/CollectionConstraints.cs"/>
+ <include name="Constraints/ComparisonConstraints.cs"/>
+ <include name="Constraints/Constraint.cs"/>
+ <include name="Constraints/ConstraintBuilder.cs"/>
+ <include name="Constraints/ContainsConstraint.cs"/>
+ <include name="Constraints/EmptyConstraint.cs"/>
+ <include name="Constraints/EqualConstraint.cs"/>
+ <include name="Constraints/Numerics.cs"/>
+ <include name="Constraints/PrefixConstraints.cs"/>
+ <include name="Constraints/PropertyConstraint.cs"/>
+ <include name="Constraints/SameAsConstraint.cs"/>
+ <include name="Constraints/StringConstraints.cs"/>
+ <include name="Constraints/TypeConstraints.cs"/>
+ <include name="SyntaxHelpers/Has.cs"/>
+ <include name="SyntaxHelpers/Is.cs"/>
+ <include name="SyntaxHelpers/List.cs"/>
+ <include name="SyntaxHelpers/ListMapper.cs"/>
+ <include name="SyntaxHelpers/Text.cs"/>
+ <include name="AbstractAsserter.cs"/>
+ <include name="AssemblyInfo.cs"/>
+ <include name="Assert.cs"/>
+ <include name="Assertion.cs"/>
+ <include name="AssertionException.cs"/>
+ <include name="AssertionFailureMessage.cs"/>
+ <include name="AssertionHelper.cs"/>
+ <include name="CategoryAttribute.cs"/>
+ <include name="CollectionAssert.cs"/>
+ <include name="DescriptionAttribute.cs"/>
+ <include name="ExpectedExceptionAttribute.cs"/>
+ <include name="ExplicitAttribute.cs"/>
+ <include name="FileAssert.cs"/>
+ <include name="GlobalSettings.cs"/>
+ <include name="IAsserter.cs"/>
+ <include name="IExpectException.cs"/>
+ <include name="IgnoreAttribute.cs"/>
+ <include name="IgnoreException.cs"/>
+ <include name="IncludeExcludeAttributes.cs"/>
+ <include name="MessageWriter.cs"/>
+ <include name="MsgUtils.cs"/>
+ <include name="OldTestCase.cs"/>
+ <include name="PropertyAttribute.cs"/>
+ <include name="SetCultureAttribute.cs"/>
+ <include name="SetUpAttribute.cs"/>
+ <include name="SetUpFixtureAttribute.cs"/>
+ <include name="StringAssert.cs"/>
+ <include name="SuiteAttribute.cs"/>
+ <include name="TearDownAttribute.cs"/>
+ <include name="TestAttribute.cs"/>
+ <include name="TestFixtureAttribute.cs"/>
+ <include name="TestFixtureSetUpAttribute.cs"/>
+ <include name="TestFixtureTearDownAttribute.cs"/>
+ <include name="TextMessageWriter.cs"/>
+ <include name="../../CommonAssemblyInfo.cs" />
+ </sources>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitFramework/framework">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitFramework/framework/nunit.framework.dll.csproj b/mcs/nunit24/NUnitFramework/framework/nunit.framework.dll.csproj
new file mode 100644
index 00000000000..6ebd26d4f89
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/nunit.framework.dll.csproj
@@ -0,0 +1,361 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.framework"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Framework"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = "bin\Debug\nunit.framework.xml"
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "true"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = "bin\Release\nunit.framework.xml"
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AbstractAsserter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Assert.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Assertion.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssertionException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssertionFailureMessage.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "AssertionHelper.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CategoryAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CollectionAssert.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DescriptionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExpectedExceptionAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ExplicitAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "FileAssert.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IAsserter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IExpectException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IgnoreAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IgnoreException.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IncludeExcludeAttributes.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MessageWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MsgUtils.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "OldTestCase.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "PropertyAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SetCultureAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "GlobalSettings.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SetUpAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SetUpFixtureAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "StringAssert.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SuiteAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TearDownAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFixtureAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFixtureSetUpAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TestFixtureTearDownAttribute.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "TextMessageWriter.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\BinaryOperations.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\CollectionConstraints.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\ComparisonConstraints.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\Constraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\ConstraintBuilder.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\ContainsConstraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\EmptyConstraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\EqualConstraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\Numerics.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\PrefixConstraints.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\PropertyConstraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\SameAsConstraint.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\StringConstraints.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Constraints\TypeConstraints.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SyntaxHelpers\Has.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SyntaxHelpers\Is.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SyntaxHelpers\List.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SyntaxHelpers\ListMapper.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "SyntaxHelpers\Text.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitFramework/framework/nunit.framework.dll_VS2005.csproj b/mcs/nunit24/NUnitFramework/framework/nunit.framework.dll_VS2005.csproj
new file mode 100644
index 00000000000..d54161bade6
--- /dev/null
+++ b/mcs/nunit24/NUnitFramework/framework/nunit.framework.dll_VS2005.csproj
@@ -0,0 +1,165 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{83DD7E12-A705-4DBA-9D71-09C8973D9382}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.framework</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Framework</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ <SignAssembly>false</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <DocumentationFile>nunit.framework.xml</DocumentationFile>
+ <Optimize>true</Optimize>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <DocumentationFile>nunit.framework.xml</DocumentationFile>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="AbstractAsserter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Assert.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Assertion.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssertionException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssertionFailureMessage.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="AssertionHelper.cs" />
+ <Compile Include="CategoryAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="CollectionAssert.cs" />
+ <Compile Include="Constraints\BinaryOperations.cs" />
+ <Compile Include="Constraints\CollectionConstraints.cs" />
+ <Compile Include="Constraints\ComparisonConstraints.cs" />
+ <Compile Include="Constraints\Constraint.cs" />
+ <Compile Include="Constraints\ConstraintBuilder.cs" />
+ <Compile Include="Constraints\ContainsConstraint.cs" />
+ <Compile Include="Constraints\EmptyConstraint.cs" />
+ <Compile Include="Constraints\EqualConstraint.cs" />
+ <Compile Include="Constraints\Numerics.cs" />
+ <Compile Include="Constraints\PrefixConstraints.cs" />
+ <Compile Include="Constraints\PropertyConstraint.cs" />
+ <Compile Include="Constraints\SameAsConstraint.cs" />
+ <Compile Include="Constraints\StringConstraints.cs" />
+ <Compile Include="Constraints\TypeConstraints.cs" />
+ <Compile Include="DescriptionAttribute.cs" />
+ <Compile Include="ExpectedExceptionAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ExplicitAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="FileAssert.cs" />
+ <Compile Include="IAsserter.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IExpectException.cs" />
+ <Compile Include="IgnoreAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IgnoreException.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IncludeExcludeAttributes.cs" />
+ <Compile Include="MessageWriter.cs" />
+ <Compile Include="MsgUtils.cs" />
+ <Compile Include="OldTestCase.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="PropertyAttribute.cs" />
+ <Compile Include="SetCultureAttribute.cs" />
+ <Compile Include="GlobalSettings.cs" />
+ <Compile Include="SetUpAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SetUpFixtureAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="StringAssert.cs" />
+ <Compile Include="SuiteAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="SyntaxHelpers\List.cs" />
+ <Compile Include="SyntaxHelpers\Has.cs" />
+ <Compile Include="SyntaxHelpers\Is.cs" />
+ <Compile Include="SyntaxHelpers\ListMapper.cs" />
+ <Compile Include="SyntaxHelpers\Text.cs" />
+ <Compile Include="TearDownAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestFixtureAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestFixtureSetUpAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TestFixtureTearDownAttribute.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="TextMessageWriter.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs b/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs
new file mode 100644
index 00000000000..599b04ce453
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/AssemblyInfo.cs
@@ -0,0 +1,12 @@
+// ****************************************************************
+// This is free software licensed under the NUnit license. You
+// may obtain a copy of the license as well as information regarding
+// copyright ownership at http://nunit.org/?p=license&r=2.4.
+// ****************************************************************
+
+using System;
+using System.Reflection;
+
+[assembly: AssemblyDelaySign(false)]
+[assembly: AssemblyKeyFile("../../nunit.snk")]
+[assembly: AssemblyKeyName("")]
diff --git a/mcs/nunit24/NUnitMocks/mocks/DynamicMock.cs b/mcs/nunit24/NUnitMocks/mocks/DynamicMock.cs
new file mode 100644
index 00000000000..b65b35123c5
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/DynamicMock.cs
@@ -0,0 +1,47 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// Summary description for DynamicMock.
+ /// </summary>
+ public class DynamicMock : Mock
+ {
+ private Type type;
+
+ private object mockInstance;
+
+ public object MockInstance
+ {
+ get
+ {
+ if ( mockInstance == null )
+ {
+ MockInterfaceHandler handler = new MockInterfaceHandler( type, this );
+ mockInstance = handler.GetTransparentProxy();
+ }
+
+ return mockInstance;
+ }
+ }
+
+ #region Constructors
+
+ public DynamicMock( Type type ) : this( "Mock" + type.Name, type ) { }
+
+ public DynamicMock( string name, Type type ) : base( name )
+ {
+// if ( !type.IsInterface )
+// throw new VerifyException( "DynamicMock constructor requires an interface type" );
+ this.type = type;
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/ICall.cs b/mcs/nunit24/NUnitMocks/mocks/ICall.cs
new file mode 100644
index 00000000000..c178dc746d6
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/ICall.cs
@@ -0,0 +1,24 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// The ICall interface is implemented by objects that can be called
+ /// with an array of arguments and return a value.
+ /// </summary>
+ public interface ICall
+ {
+ /// <summary>
+ /// Process a call with a possibly empty set of arguments.
+ /// </summary>
+ /// <param name="args">Arguments for this call</param>
+ /// <returns>An implementation-defined return value</returns>
+ object Call( object[] args );
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/ICallHandler.cs b/mcs/nunit24/NUnitMocks/mocks/ICallHandler.cs
new file mode 100644
index 00000000000..c844a0a6c09
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/ICallHandler.cs
@@ -0,0 +1,25 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// The ICallHandler interface dispatches calls to methods or
+ /// other objects implementing the ICall interface.
+ /// </summary>
+ public interface ICallHandler
+ {
+ /// <summary>
+ /// Simulate a method call on the mocked object.
+ /// </summary>
+ /// <param name="methodName">The name of the method</param>
+ /// <param name="args">Arguments for this call</param>
+ /// <returns>Previously specified object or null</returns>
+ object Call( string methodName, params object[] args );
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/IMethod.cs b/mcs/nunit24/NUnitMocks/mocks/IMethod.cs
new file mode 100644
index 00000000000..5d394bb8d08
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/IMethod.cs
@@ -0,0 +1,28 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// The IMethod interface represents an method or other named object that
+ /// is both callable and self-verifying.
+ /// </summary>
+ public interface IMethod : IVerify, ICall
+ {
+ /// <summary>
+ /// The name of the object
+ /// </summary>
+ string Name { get; }
+
+ /// <summary>
+ /// Tell the object to expect a certain call.
+ /// </summary>
+ /// <param name="call"></param>
+ void Expect( ICall call );
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/IMock.cs b/mcs/nunit24/NUnitMocks/mocks/IMock.cs
new file mode 100644
index 00000000000..43d1e09c349
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/IMock.cs
@@ -0,0 +1,66 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// Summary description for IMock.
+ /// </summary>
+ public interface IMock : IVerify, ICallHandler
+ {
+ /// <summary>
+ /// The name of this mock - used in messages
+ /// </summary>
+ string Name { get; }
+
+ /// <summary>
+ /// True if unexpected calls should cause an error, false to ignore them
+ /// </summary>
+ bool Strict { get; set; }
+
+ /// <summary>
+ /// Set up to expect a call to a method with a set of arguments
+ /// </summary>
+ /// <param name="methodName">The name of the method</param>
+ /// <param name="args">Arguments for this call</param>
+ void Expect( string methodName, params object[] args );
+
+ void Expect( string MethodName );
+
+ /// <summary>
+ /// Set up expectation that the named method will not be called
+ /// </summary>
+ /// <param name="methodName">The name of the method</param>
+ void ExpectNoCall( string methodName );
+
+ /// <summary>
+ /// Set up to expect a call to a method with a set of arguments.
+ /// The specified value will be returned.
+ /// </summary>
+ /// <param name="methodName">The name of the method</param>
+ /// <param name="returnVal">The value to be returned</param>
+ /// <param name="args">Arguments for this call</param>
+ void ExpectAndReturn( string methodName, object returnVal, params object[] args );
+
+ /// <summary>
+ /// Set up to expect a call to a method with a set of arguments.
+ /// The specified exception will be thrown.
+ /// </summary>
+ /// <param name="methodname">The name of the method</param>
+ /// <param name="exception">The exception to throw</param>
+ /// <param name="args">Arguments for this call</param>
+ void ExpectAndThrow( string methodname, Exception exception, params object[] args );
+
+ /// <summary>
+ /// Set value to return for a method or property called with any arguments
+ /// </summary>
+ /// <param name="methodName">The name of the method</param>
+ /// <param name="returnVal">The value to be returned</param>
+ void SetReturnValue( string methodName, object returnVal );
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/IVerify.cs b/mcs/nunit24/NUnitMocks/mocks/IVerify.cs
new file mode 100644
index 00000000000..53aaee8992d
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/IVerify.cs
@@ -0,0 +1,18 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// The IVerify interface is implemented by objects capable of self-verification.
+ /// </summary>
+ public interface IVerify
+ {
+ void Verify();
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/Makefile b/mcs/nunit24/NUnitMocks/mocks/Makefile
new file mode 100644
index 00000000000..e0916c4025a
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/Makefile
@@ -0,0 +1,29 @@
+thisdir = nunit24/NUnitMocks/mocks
+SUBDIRS =
+include ../../../build/rules.make
+
+LIBRARY = nunit.mocks.dll
+LIBRARY_SNK = $(topdir)/nunit24/nunit.snk
+
+LOCAL_MCS_FLAGS= -debug -r:nunit.framework.dll -r:System.dll /d:StronglyNamedAssembly
+NO_TEST = yo
+
+ifeq (net_2_0, $(PROFILE))
+NO_INSTALL = yes
+install-local: install-symlink
+uninstall-local: uninstall-symlink
+endif
+
+EXTRA_DISTFILES = \
+ nunit.mocks.csproj \
+ nunit.mocks_VS2005.csproj
+
+include ../../../build/library.make
+
+symlinkdir = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
+install-symlink:
+ $(MKINSTALLDIRS) $(DESTDIR)$(symlinkdir)
+ cd $(DESTDIR)$(symlinkdir) && rm -f $(LIBRARY_NAME) && ln -s ../1.0/$(LIBRARY_NAME) $(LIBRARY_NAME)
+
+uninstall-symlink:
+ rm -f $(DESTDIR)$(symlinkdir)/$(LIBRARY_NAME)
diff --git a/mcs/nunit24/NUnitMocks/mocks/MethodSignature.cs b/mcs/nunit24/NUnitMocks/mocks/MethodSignature.cs
new file mode 100644
index 00000000000..9dd6226ae21
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/MethodSignature.cs
@@ -0,0 +1,56 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// Summary description for MockSignature.
+ /// </summary>
+ public class MethodSignature
+ {
+ public readonly string typeName;
+ public readonly string methodName;
+ public readonly Type[] argTypes;
+
+ public MethodSignature( string typeName, string methodName, Type[] argTypes )
+ {
+ this.typeName = typeName;
+ this.methodName = methodName;
+ this.argTypes = argTypes;
+ }
+
+ public bool IsCompatibleWith( object[] args )
+ {
+ if ( args.Length != argTypes.Length )
+ return false;
+
+ for( int i = 0; i < args.Length; i++ )
+ if ( !argTypes[i].IsAssignableFrom( args[i].GetType() ) )
+ return false;
+
+ return true;
+ }
+
+ public static Type[] GetArgTypes( object[] args )
+ {
+ if ( args == null )
+ return new Type[0];
+
+ Type[] argTypes = new Type[args.Length];
+ for (int i = 0; i < argTypes.Length; ++i)
+ {
+ if (args[i] == null)
+ argTypes[i] = typeof(object);
+ else
+ argTypes[i] = args[i].GetType();
+ }
+
+ return argTypes;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/Mock.cs b/mcs/nunit24/NUnitMocks/mocks/Mock.cs
new file mode 100644
index 00000000000..534e6de0cc3
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/Mock.cs
@@ -0,0 +1,155 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Messaging;
+using NUnit.Framework;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// Summary description for MockObject.
+ /// </summary>
+ public class Mock : IMock
+ {
+ #region Private Fields
+
+ private string name;
+
+ private bool strict;
+
+ private IDictionary methods = new Hashtable();
+
+ private Exception lastException;
+
+ #endregion
+
+ #region Properties
+
+ public Exception LastException
+ {
+ get { return lastException; }
+ }
+
+ #endregion
+
+ #region Constructors
+
+ public Mock() : this( "Mock" ) { }
+
+ public Mock( string name )
+ {
+ this.name = name;
+ }
+
+ #endregion
+
+ #region IMock Members
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public bool Strict
+ {
+ get { return strict; }
+ set { strict = value; }
+ }
+
+ public void Expect( string methodName, params object[] args )
+ {
+ ExpectAndReturn( methodName, null, args );
+ }
+
+ public void Expect( string methodName )
+ {
+ ExpectAndReturn( methodName, null, null );
+ }
+
+ public void ExpectNoCall( string methodName )
+ {
+ methods[methodName] = new MockMethod( methodName, null,
+ new AssertionException("Unexpected call to method " + methodName) );
+ }
+
+ public void ExpectAndReturn( string methodName, object returnVal, params object[] args )
+ {
+ AddExpectedCall( methodName, returnVal, null, args );
+ }
+
+ public void ExpectAndThrow( string methodName, Exception exception, params object[] args )
+ {
+ AddExpectedCall( methodName, null, exception, args );
+ }
+
+ public void SetReturnValue( string methodName, object returnVal )
+ {
+ methods[methodName] = new MockMethod( methodName, returnVal );
+ }
+
+ #endregion
+
+ #region IVerify Members
+
+ public virtual void Verify()
+ {
+ foreach( IMethod method in methods.Values )
+ method.Verify();
+ }
+
+ #endregion
+
+ #region ICallHandler Members
+
+ public virtual object Call( string methodName, params object[] args )
+ {
+ if ( methods.Contains( methodName ) )
+ {
+ try
+ {
+ IMethod method = (IMethod)methods[methodName];
+ return method.Call( args );
+ }
+ catch( Exception exception )
+ {
+ // Save exception in case MO is running on a separate thread
+ lastException = exception;
+ throw;
+ }
+ }
+ else // methodName is not listed in methods
+ if ( Strict )
+ Assert.Fail( "Unexpected call to " + methodName );
+
+ // not listed but Strict is not specified
+ return null;
+ }
+
+ #endregion
+
+ #region Helper Methods
+
+ private void AddExpectedCall( string methodName, object returnVal, Exception exception, object[] args )
+ {
+ IMethod method = (IMethod)methods[methodName];
+ if ( method == null )
+ {
+ method = new MockMethod( methodName );
+ methods[methodName] = method;
+ }
+
+ Type[] argTypes = MethodSignature.GetArgTypes( args );
+ MethodSignature signature = new MethodSignature( this.Name, methodName, argTypes );
+
+ method.Expect( new MockCall( signature, returnVal, exception, args ) );
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/MockCall.cs b/mcs/nunit24/NUnitMocks/mocks/MockCall.cs
new file mode 100644
index 00000000000..2d5ef7fd52a
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/MockCall.cs
@@ -0,0 +1,54 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using NUnit.Framework;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// Summary description for ExpectedCall.
+ /// </summary>
+ public class MockCall : ICall
+ {
+ private MethodSignature signature;
+ private object returnVal;
+ private Exception exception;
+ private object[] expectedArgs;
+
+// public static object[] Any = new object[0];
+
+ public MockCall( MethodSignature signature, object returnVal, Exception exception, params object[] args )
+ {
+ this.signature = signature;
+ this.returnVal = returnVal;
+ this.exception = exception;
+ this.expectedArgs = args;
+ }
+
+ public object Call( object[] actualArgs )
+ {
+ if ( expectedArgs != null )
+ {
+ Assert.AreEqual( expectedArgs.Length, actualArgs.Length, "Invalid argument count in call to {0}", this.signature.methodName );
+
+ for( int i = 0; i < expectedArgs.Length; i++ )
+ {
+ if ( expectedArgs[i] is Constraint )
+ Assert.That( actualArgs[i], (Constraint)expectedArgs[i] );
+ else
+ Assert.AreEqual( expectedArgs[i], actualArgs[i] );
+ }
+ }
+
+ if ( exception != null )
+ throw exception;
+
+ return returnVal;
+ }
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/MockInterfaceHandler.cs b/mcs/nunit24/NUnitMocks/mocks/MockInterfaceHandler.cs
new file mode 100644
index 00000000000..1306517db32
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/MockInterfaceHandler.cs
@@ -0,0 +1,72 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.Runtime.Remoting.Proxies;
+using System.Runtime.Remoting.Messaging;
+using System.Reflection;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// Summary description for MockInterfaceHandler.
+ /// </summary>
+ public class MockInterfaceHandler : RealProxy
+ {
+ private ICallHandler callHandler;
+
+ public MockInterfaceHandler( Type type, ICallHandler callHandler ) : base( type )
+ {
+ this.callHandler = callHandler;
+ }
+
+ public override IMessage Invoke( IMessage msg )
+ {
+ IMethodCallMessage call = (IMethodCallMessage)msg;
+ IMethodReturnMessage result = null;
+
+ if ( call != null )
+ {
+ try
+ {
+ object ret = callHandler.Call( call.MethodName, call.Args );
+
+ if ( ret == null )
+ {
+ MethodInfo info = call.MethodBase as MethodInfo;
+ Type returnType = info.ReturnType;
+
+ if( returnType == typeof( System.Boolean ) ) ret = false;
+
+ if( returnType == typeof( System.Byte ) ) ret = (System.Byte)0;
+ if( returnType == typeof( System.SByte ) ) ret = (System.SByte)0;
+ if( returnType == typeof( System.Decimal ) ) ret = (System.Decimal)0;
+ if( returnType == typeof( System.Double ) ) ret = (System.Double)0;
+ if( returnType == typeof( System.Single ) ) ret = (System.Single)0;
+ if( returnType == typeof( System.Int32 ) ) ret = (System.Int32)0;
+ if( returnType == typeof( System.UInt32 ) ) ret = (System.UInt32)0;
+ if( returnType == typeof( System.Int64 ) ) ret = (System.Int64)0;
+ if( returnType == typeof( System.UInt64 ) ) ret = (System.UInt64)0;
+ if( returnType == typeof( System.Int16 ) ) ret = (System.Int16)0;
+ if( returnType == typeof( System.UInt16 ) ) ret = (System.UInt16)0;
+
+ if( returnType == typeof( System.Char ) ) ret = '?';
+ }
+
+ result = new ReturnMessage( ret, null, 0, null, call );
+ }
+ catch( Exception e )
+ {
+ result = new ReturnMessage( e, call );
+ }
+ }
+
+ return result;
+ }
+ }
+}
+
diff --git a/mcs/nunit24/NUnitMocks/mocks/MockMethod.cs b/mcs/nunit24/NUnitMocks/mocks/MockMethod.cs
new file mode 100644
index 00000000000..c8799beda4c
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/MockMethod.cs
@@ -0,0 +1,119 @@
+// ****************************************************************
+// Copyright 2007, Charlie Poole
+// This is free software licensed under the NUnit license. You may
+// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace NUnit.Mocks
+{
+ /// <summary>
+ /// The MockMethod object represents one named method on a mock object.
+ /// All overloads are represented by one MockMethod. A method may return
+ /// a fixed value, throw a fixed exception or have an expected sequence
+ /// of calls. If it has a call sequence, then the signature must match and
+ /// each call provides it's own return value or exception.
+ /// </summary>
+ public class MockMethod : IMethod
+ {
+ #region Private Fields
+
+ /// <summary>
+ /// Name of this method
+ /// </summary>
+ private string methodName;
+
+ /// <summary>
+ /// Fixed return value
+ /// </summary>
+ private object returnVal;
+
+ /// <summary>
+ /// Exception to be thrown
+ /// </summary>
+ private Exception exception;
+
+ /// <summary>
+ /// Expected call sequence. If null, this method has no expectations
+ /// and simply provides a fixed return value or exception.
+ /// </summary>
+ private ArrayList expectedCalls = null;
+
+ /// <summary>
+ /// Actual sequence of calls... currently not used
+ /// </summary>
+ //private ArrayList actualCalls = null;
+
+ #endregion
+
+ #region Constructors
+
+ public MockMethod( string methodName )
+ : this( methodName, null, null ) { }
+
+ public MockMethod( string methodName, object returnVal )
+ : this( methodName, returnVal, null ) { }
+
+ public MockMethod( string methodName, object returnVal, Exception exception )
+ {
+ this.methodName = methodName;
+ this.returnVal = returnVal;
+ this.exception = exception;
+ }
+
+ #endregion
+
+ #region IMethod Members
+
+ public string Name
+ {
+ get { return methodName; }
+ }
+
+ public void Expect( ICall call )
+ {
+ if ( expectedCalls == null )
+ expectedCalls = new ArrayList();
+
+ expectedCalls.Add( call );
+ }
+
+ #endregion
+
+ #region ICall Members
+
+ public object Call( object[] args )
+ {
+ if ( expectedCalls == null )
+ {
+ if ( exception != null )
+ throw exception;
+
+ return returnVal;
+ }
+ else
+ {
+ //actualCalls.Add( new MethodCall( methodName, null, null, args ) );
+ Assert.IsTrue( expectedCalls.Count > 0, "Too many calls to " + Name );
+ MockCall mockCall = (MockCall)expectedCalls[0];
+ expectedCalls.RemoveAt( 0 );
+ return mockCall.Call( args );
+ }
+ }
+
+ #endregion
+
+ #region IVerify Members
+
+ public void Verify()
+ {
+ if ( expectedCalls != null )
+ Assert.IsTrue( expectedCalls.Count == 0, "Not all methods were called" );
+ }
+
+ #endregion
+ }
+}
diff --git a/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.build b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.build
new file mode 100644
index 00000000000..d4dc5436def
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.build
@@ -0,0 +1,38 @@
+<?xml version="1.0"?>
+<project name="NUnitMocks" default="build" basedir=".">
+
+ <target name="build">
+ <csc target="library"
+ output="${current.build.dir}/nunit.mocks.dll"
+ debug="${build.debug}" define="${build.defines}">
+ <sources>
+ <include name="AssemblyInfo.cs"/>
+ <include name="DynamicMock.cs"/>
+ <include name="ICall.cs"/>
+ <include name="ICallHandler.cs"/>
+ <include name="IMethod.cs"/>
+ <include name="IMock.cs"/>
+ <include name="IVerify.cs"/>
+ <include name="MethodSignature.cs"/>
+ <include name="Mock.cs"/>
+ <include name="MockCall.cs"/>
+ <include name="MockInterfaceHandler.cs"/>
+ <include name="MockMethod.cs"/>
+ <include name="../../CommonAssemblyInfo.cs"/>
+ </sources>
+ <nowarn>
+ <warning number="1699" if="${runtime.version=='2.0'}"/>
+ </nowarn>
+ <references basedir="${current.build.dir}">
+ <include name="nunit.framework.dll"/>
+ </references>
+ </csc>
+ </target>
+
+ <target name="package">
+ <copy todir="${package.src.dir}/NUnitMocks/mocks">
+ <fileset refid="source-files" />
+ </copy>
+ </target>
+
+</project> \ No newline at end of file
diff --git a/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj
new file mode 100644
index 00000000000..1f2943ce185
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.csproj
@@ -0,0 +1,161 @@
+<VisualStudioProject>
+ <CSHARP
+ ProjectType = "Local"
+ ProductVersion = "7.10.3077"
+ SchemaVersion = "2.0"
+ ProjectGuid = "{EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}"
+ >
+ <Build>
+ <Settings
+ ApplicationIcon = ""
+ AssemblyKeyContainerName = ""
+ AssemblyName = "nunit.mocks"
+ AssemblyOriginatorKeyFile = ""
+ DefaultClientScript = "JScript"
+ DefaultHTMLPageLayout = "Grid"
+ DefaultTargetSchema = "IE50"
+ DelaySign = "false"
+ OutputType = "Library"
+ PreBuildEvent = ""
+ PostBuildEvent = ""
+ RootNamespace = "NUnit.Mocks"
+ RunPostBuildEvent = "OnBuildSuccess"
+ StartupObject = ""
+ >
+ <Config
+ Name = "Debug"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "DEBUG;TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "true"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "false"
+ OutputPath = "bin\Debug\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ <Config
+ Name = "Release"
+ AllowUnsafeBlocks = "false"
+ BaseAddress = "285212672"
+ CheckForOverflowUnderflow = "false"
+ ConfigurationOverrideFile = ""
+ DefineConstants = "TRACE"
+ DocumentationFile = ""
+ DebugSymbols = "false"
+ FileAlignment = "4096"
+ IncrementalBuild = "false"
+ NoStdLib = "false"
+ NoWarn = ""
+ Optimize = "true"
+ OutputPath = "bin\Release\"
+ RegisterForComInterop = "false"
+ RemoveIntegerChecks = "false"
+ TreatWarningsAsErrors = "false"
+ WarningLevel = "4"
+ />
+ </Settings>
+ <References>
+ <Reference
+ Name = "System"
+ AssemblyName = "System"
+ HintPath = "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
+ />
+ <Reference
+ Name = "System.Data"
+ AssemblyName = "System.Data"
+ HintPath = "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
+ />
+ <Reference
+ Name = "System.XML"
+ AssemblyName = "System.Xml"
+ HintPath = "c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
+ />
+ <Reference
+ Name = "nunit.framework.dll"
+ Project = "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+ Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"
+ />
+ </References>
+ </Build>
+ <Files>
+ <Include>
+ <File
+ RelPath = "AssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "CommonAssemblyInfo.cs"
+ Link = "..\..\CommonAssemblyInfo.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "DynamicMock.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ICall.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "ICallHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IMethod.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IMock.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "IVerify.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MethodSignature.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Mock.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MockCall.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MockInterfaceHandler.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "MockMethod.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ </Include>
+ </Files>
+ </CSHARP>
+</VisualStudioProject>
+
diff --git a/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.dll.sources b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.dll.sources
new file mode 100644
index 00000000000..cb29752c513
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks.dll.sources
@@ -0,0 +1,13 @@
+../../CommonAssemblyInfo.cs
+AssemblyInfo.cs
+DynamicMock.cs
+ICall.cs
+ICallHandler.cs
+IMethod.cs
+IMock.cs
+IVerify.cs
+MethodSignature.cs
+Mock.cs
+MockCall.cs
+MockInterfaceHandler.cs
+MockMethod.cs
diff --git a/mcs/nunit24/NUnitMocks/mocks/nunit.mocks_VS2005.csproj b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks_VS2005.csproj
new file mode 100644
index 00000000000..557e98b6539
--- /dev/null
+++ b/mcs/nunit24/NUnitMocks/mocks/nunit.mocks_VS2005.csproj
@@ -0,0 +1,107 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectType>Local</ProjectType>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}</ProjectGuid>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ApplicationIcon>
+ </ApplicationIcon>
+ <AssemblyKeyContainerName>
+ </AssemblyKeyContainerName>
+ <AssemblyName>nunit.mocks</AssemblyName>
+ <AssemblyOriginatorKeyFile>
+ </AssemblyOriginatorKeyFile>
+ <DefaultClientScript>JScript</DefaultClientScript>
+ <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+ <DefaultTargetSchema>IE50</DefaultTargetSchema>
+ <DelaySign>false</DelaySign>
+ <OutputType>Library</OutputType>
+ <RootNamespace>NUnit.Mocks</RootNamespace>
+ <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+ <StartupObject>
+ </StartupObject>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release2005|AnyCPU' ">
+ <OutputPath>bin\Release2005\</OutputPath>
+ <DefineConstants>TRACE;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <Optimize>true</Optimize>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug2005|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug2005\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;VS2005</DefineConstants>
+ <BaseAddress>285212672</BaseAddress>
+ <NoWarn>1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System">
+ <Name>System</Name>
+ </Reference>
+ <Reference Include="System.Data">
+ <Name>System.Data</Name>
+ </Reference>
+ <Reference Include="System.Xml">
+ <Name>System.XML</Name>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\CommonAssemblyInfo.cs">
+ <Link>CommonAssemblyInfo.cs</Link>
+ </Compile>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="DynamicMock.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ICall.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="ICallHandler.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IMethod.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IMock.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="IVerify.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MethodSignature.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Mock.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MockCall.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MockInterfaceHandler.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MockMethod.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\NUnitFramework\framework\nunit.framework.dll_VS2005.csproj">
+ <Project>{83DD7E12-A705-4DBA-9D71-09C8973D9382}</Project>
+ <Name>nunit.framework.dll_VS2005</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <PropertyGroup>
+ <PreBuildEvent>
+ </PreBuildEvent>
+ <PostBuildEvent>
+ </PostBuildEvent>
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/mcs/nunit24/license.rtf b/mcs/nunit24/license.rtf
new file mode 100644
index 00000000000..b8f1486b642
--- /dev/null
+++ b/mcs/nunit24/license.rtf
@@ -0,0 +1,41 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}
+{\f2\fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}SimSun{\*\falt ????\'a1\'a7???};}{\f37\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@SimSun;}
+{\f38\froman\fcharset238\fprq2 Times New Roman CE;}{\f39\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f41\froman\fcharset161\fprq2 Times New Roman Greek;}{\f42\froman\fcharset162\fprq2 Times New Roman Tur;}
+{\f43\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f44\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f45\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f46\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}
+{\f58\fmodern\fcharset238\fprq1 Courier New CE;}{\f59\fmodern\fcharset204\fprq1 Courier New Cyr;}{\f61\fmodern\fcharset161\fprq1 Courier New Greek;}{\f62\fmodern\fcharset162\fprq1 Courier New Tur;}{\f63\fmodern\fcharset177\fprq1 Courier New (Hebrew);}
+{\f64\fmodern\fcharset178\fprq1 Courier New (Arabic);}{\f65\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f66\fmodern\fcharset163\fprq1 Courier New (Vietnamese);}{\f170\fnil\fcharset0\fprq2 SimSun Western{\*\falt ????\'a1\'a7???};}
+{\f410\fnil\fcharset0\fprq2 @SimSun Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;
+\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
+\fs24\lang1033\langfe2052\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\*
+\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
+\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{
+\s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1033\langfe2052\loch\f2\hich\af2\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon0 \snext15 \styrsid9332467 Plain Text;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}
+{\*\rsidtbl \rsid610709\rsid818068\rsid5008211\rsid7476632\rsid8721477\rsid9332467\rsid10426157\rsid11172945\rsid11871043\rsid15552035\rsid16677168}{\*\generator Microsoft Word 11.0.6568;}{\info{\title Copyright (c) 2002 James W}{\author James Newkirk}
+{\operator Charlie Poole}{\creatim\yr2002\mo9\dy11\hr14\min43}{\revtim\yr2007\mo2\dy18\hr17\min58}{\version8}{\edmins15}{\nofpages1}{\nofwords166}{\nofchars950}{\*\company Nascent Software, Inc.}{\nofcharsws1114}{\vern24579}}\margl1319\margr1319
+\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1319\dgvorigin1440\dghshow1\dgvshow1
+\jexpand\viewkind1\viewscale120\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot15552035 \fet0\sectd
+\linex0\endnhere\sectlinegrid360\sectdefaultcl\sectrsid9332467\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}
+{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang
+{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
+\s15\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid9332467 \fs20\lang1033\langfe2052\loch\af2\hich\af2\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid16677168\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Copyright }{
+\insrsid16677168 \loch\af2\dbch\af13\hich\f2 \'a9\loch\f2 \hich\af2\dbch\af13\loch\f2 2002-2007 Charlie Poole
+\par }{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Copyright }{\insrsid10426157 \loch\af2\dbch\af13\hich\f2 \'a9\loch\f2 }{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 2002}{\insrsid8721477 \hich\af2\dbch\af13\loch\f2 -200}{
+\insrsid11871043 \hich\af2\dbch\af13\loch\f2 4}{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 James W. Newkirk, Mich}{\insrsid7476632 \hich\af2\dbch\af13\loch\f2 ael C. Two, Alexei A. Vorontsov
+\par }{\insrsid16677168 \hich\af2\dbch\af13\loch\f2 \hich\f2 Copyright \'a9\loch\f2 2000-2002}{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Philip A. Craig
+\par
+\par \hich\af2\dbch\af13\loch\f2 This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+\par
+\par \hich\af2\dbch\af13\loch\f2 Permission is granted to anyone to use this software for any purpose, including \hich\af2\dbch\af13\loch\f2 commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+\par
+\par \hich\af2\dbch\af13\loch\f2 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a p\hich\af2\dbch\af13\loch\f2
+roduct, an acknowledgment (see the following) in the product documentation is required.
+\par
+\par \hich\af2\dbch\af13\loch\f2 Portions }{\insrsid16677168\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Copyright }{\insrsid16677168 \loch\af2\dbch\af13\hich\f2 \'a9\loch\f2 2002\hich\af2\dbch\af13\loch\f2 -2007 Charlie Poole or\hich\af2\dbch\af13\loch\f2 }
+{\insrsid16677168\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Copyright }{\insrsid16677168 \loch\af2\dbch\af13\hich\f2 \'a9\loch\f2 2002\hich\af2\dbch\af13\loch\f2 -2004\hich\af2\dbch\af13\loch\f2 }{\insrsid10426157 \hich\af2\dbch\af13\loch\f2
+James W. Newkirk, }{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Michae}{\insrsid16677168 \hich\af2\dbch\af13\loch\f2 l C. Two, Alexei A. Vorontsov}{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 or Copyright }{\insrsid10426157
+\loch\af2\dbch\af13\hich\f2 \'a9}{\insrsid5008211 \hich\af2\dbch\af13\loch\f2 2000-2002}{\insrsid610709\charrsid9332467 \hich\af2\dbch\af13\loch\f2 Philip A. Craig
+\par
+\par \hich\af2\dbch\af13\loch\f2 2. Altered source version\hich\af2\dbch\af13\loch\f2 s must be plainly marked as such, and must not be misrepresented as being the original software.
+\par
+\par \hich\af2\dbch\af13\loch\f2 3. This notice may not be removed or altered from any source distribution.}{\insrsid9332467
+\par }} \ No newline at end of file
diff --git a/mcs/nunit24/nunit.sln b/mcs/nunit24/nunit.sln
new file mode 100644
index 00000000000..568c94338cd
--- /dev/null
+++ b/mcs/nunit24/nunit.sln
@@ -0,0 +1,258 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-gui", "GuiRunner\nunit-gui\nunit-gui.csproj", "{3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.mocks", "NUnitMocks\mocks\nunit.mocks.csproj", "{EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.uikit.dll", "GuiComponents\UiKit\nunit.uikit.dll.csproj", "{27531BBF-183D-4C3A-935B-D840B9F1A3A4}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.util.dll", "ClientUtilities\util\nunit.util.dll.csproj", "{61CE9CE5-943E-44D4-A381-814DC1406767}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll", "NUnitFramework\framework\nunit.framework.dll.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.mocks.tests", "NUnitMocks\tests\nunit.mocks.tests.csproj", "{8667C588-1A05-4773-A9E8-272EB302B8AB}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.uikit.tests", "GuiComponents\tests\nunit.uikit.tests.csproj", "{63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-console.exe", "ConsoleRunner\nunit-console-exe\nunit-console.exe.csproj", "{53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-console.tests", "ConsoleRunner\tests\nunit-console.tests.csproj", "{8597D2C6-804D-48CB-BFC7-ED2404D389B0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.util.tests", "ClientUtilities\tests\nunit.util.tests.csproj", "{74EF7165-117E-48ED-98EA-068EAE438E53}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.tests", "NUnitFramework\tests\nunit.framework.tests.csproj", "{8C326431-AE57-4645-ACC1-A90A0B425129}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-gui.exe", "GuiRunner\nunit-gui-exe\nunit-gui.exe.csproj", "{AAB186A4-FA3D-404D-AD78-7EB5BB861655}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-gui.tests", "GuiRunner\tests\nunit-gui.tests.csproj", "{AAD27267-DE1F-4F61-A1FB-D1680A5B8001}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.extensions.tests", "NUnitExtensions\tests\nunit.extensions.tests.csproj", "{92961F10-EB6D-4C91-AD4F-B4F27BA571B2}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.extensions.dll", "NUnitExtensions\core\nunit.core.extensions.dll.csproj", "{98B10E98-003C-45A0-9587-119142E39986}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.dll", "NUnitCore\core\nunit.core.dll.csproj", "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.tests", "NUnitCore\tests\nunit.core.tests.csproj", "{DD758D21-E5D5-4D40-9450-5F65A32F359C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test-assembly", "tests\test-assembly\test-assembly.csproj", "{1960CAC4-9A82-47C5-A9B3-55BC37572C3C}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.extensions.dll", "NUnitExtensions\framework\nunit.framework.extensions.dll.csproj", "{486C498D-B9F8-477F-ACA7-CED9245BBFCF}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.interfaces.dll", "NUnitCore\interfaces\nunit.core.interfaces.dll.csproj", "{435428F8-5995-4CE4-8022-93D595A8CC0F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly", "tests\mock-assembly\mock-assembly.csproj", "{2E368281-3BA8-4050-B05E-0E0E43F8F446}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nonamespace-assembly", "tests\nonamespace-assembly\nonamespace-assembly.csproj", "{5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "notestfixtures-assembly", "tests\notestfixtures-assembly\notestfixtures-assembly.csproj", "{8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test-utilities", "tests\test-utilities\test-utilities.csproj", "{3E63AD0F-24D4-46BE-BEE4-5A3299847D86}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "timing-tests", "tests\timing-tests\timing-tests.csproj", "{F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-console", "ConsoleRunner\nunit-console\nunit-console.csproj", "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.fixtures", "NUnitFixtures\fixtures\nunit.fixtures.csproj", "{A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.fixtures.tests", "NUnitFixtures\tests\nunit.fixtures.tests.csproj", "{55F2D231-743C-48DD-B79A-00E5A7236CBE}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "loadtest-assembly", "tests\loadtest-assembly\loadtest-assembly.csproj", "{34734263-6F6C-403D-AD8C-CE3F8E340EA9}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Debug.ActiveCfg = Debug|.NET
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Debug.Build.0 = Debug|.NET
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Release.ActiveCfg = Release|.NET
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Release.Build.0 = Release|.NET
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Debug.ActiveCfg = Debug|.NET
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Debug.Build.0 = Debug|.NET
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Release.ActiveCfg = Release|.NET
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Release.Build.0 = Release|.NET
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Debug.ActiveCfg = Debug|.NET
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Debug.Build.0 = Debug|.NET
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Release.ActiveCfg = Release|.NET
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Release.Build.0 = Release|.NET
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Debug.ActiveCfg = Debug|.NET
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Debug.Build.0 = Debug|.NET
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Release.ActiveCfg = Release|.NET
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Release.Build.0 = Release|.NET
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Debug.ActiveCfg = Debug|.NET
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Debug.Build.0 = Debug|.NET
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Release.ActiveCfg = Release|.NET
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Release.Build.0 = Release|.NET
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Debug.ActiveCfg = Debug|.NET
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Debug.Build.0 = Debug|.NET
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Release.ActiveCfg = Release|.NET
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Release.Build.0 = Release|.NET
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Debug.ActiveCfg = Debug|.NET
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Debug.Build.0 = Debug|.NET
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Release.ActiveCfg = Release|.NET
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Release.Build.0 = Release|.NET
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Debug.ActiveCfg = Debug|.NET
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Debug.Build.0 = Debug|.NET
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Release.ActiveCfg = Release|.NET
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Release.Build.0 = Release|.NET
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Debug.ActiveCfg = Debug|.NET
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Debug.Build.0 = Debug|.NET
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Release.ActiveCfg = Release|.NET
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Release.Build.0 = Release|.NET
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Debug.ActiveCfg = Debug|.NET
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Debug.Build.0 = Debug|.NET
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Release.ActiveCfg = Release|.NET
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Release.Build.0 = Release|.NET
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Debug.ActiveCfg = Debug|.NET
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Debug.Build.0 = Debug|.NET
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Release.ActiveCfg = Release|.NET
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Release.Build.0 = Release|.NET
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Debug.ActiveCfg = Debug|.NET
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Debug.Build.0 = Debug|.NET
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Release.ActiveCfg = Release|.NET
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Release.Build.0 = Release|.NET
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Debug.ActiveCfg = Debug|.NET
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Debug.Build.0 = Debug|.NET
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Release.ActiveCfg = Release|.NET
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Release.Build.0 = Release|.NET
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Debug.ActiveCfg = Debug|.NET
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Debug.Build.0 = Debug|.NET
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Release.ActiveCfg = Release|.NET
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Release.Build.0 = Release|.NET
+ {98B10E98-003C-45A0-9587-119142E39986}.Debug.ActiveCfg = Debug|.NET
+ {98B10E98-003C-45A0-9587-119142E39986}.Debug.Build.0 = Debug|.NET
+ {98B10E98-003C-45A0-9587-119142E39986}.Release.ActiveCfg = Release|.NET
+ {98B10E98-003C-45A0-9587-119142E39986}.Release.Build.0 = Release|.NET
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Debug.ActiveCfg = Debug|.NET
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Debug.Build.0 = Debug|.NET
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Release.ActiveCfg = Release|.NET
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Release.Build.0 = Release|.NET
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Debug.ActiveCfg = Debug|.NET
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Debug.Build.0 = Debug|.NET
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Release.ActiveCfg = Release|.NET
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Release.Build.0 = Release|.NET
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Debug.ActiveCfg = Debug|.NET
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Debug.Build.0 = Debug|.NET
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Release.ActiveCfg = Release|.NET
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Release.Build.0 = Release|.NET
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Debug.ActiveCfg = Debug|.NET
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Debug.Build.0 = Debug|.NET
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Release.ActiveCfg = Release|.NET
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Release.Build.0 = Release|.NET
+ {435428F8-5995-4CE4-8022-93D595A8CC0F}.Debug.ActiveCfg = Debug|.NET
+ {435428F8-5995-4CE4-8022-93D595A8CC0F}.Debug.Build.0 = Debug|.NET
+ {435428F8-5995-4CE4-8022-93D595A8CC0F}.Release.ActiveCfg = Release|.NET
+ {435428F8-5995-4CE4-8022-93D595A8CC0F}.Release.Build.0 = Release|.NET
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Debug.ActiveCfg = Debug|.NET
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Debug.Build.0 = Debug|.NET
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Release.ActiveCfg = Release|.NET
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Release.Build.0 = Release|.NET
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Debug.ActiveCfg = Debug|.NET
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Debug.Build.0 = Debug|.NET
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Release.ActiveCfg = Release|.NET
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Release.Build.0 = Release|.NET
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Debug.ActiveCfg = Debug|.NET
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Debug.Build.0 = Debug|.NET
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Release.ActiveCfg = Release|.NET
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Release.Build.0 = Release|.NET
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Debug.ActiveCfg = Debug|.NET
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Debug.Build.0 = Debug|.NET
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Release.ActiveCfg = Release|.NET
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Release.Build.0 = Release|.NET
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Debug.ActiveCfg = Debug|.NET
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Debug.Build.0 = Debug|.NET
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Release.ActiveCfg = Release|.NET
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Release.Build.0 = Release|.NET
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Debug.ActiveCfg = Debug|.NET
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Debug.Build.0 = Debug|.NET
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Release.ActiveCfg = Release|.NET
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Release.Build.0 = Release|.NET
+ {A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}.Debug.ActiveCfg = Debug|.NET
+ {A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}.Debug.Build.0 = Debug|.NET
+ {A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}.Release.ActiveCfg = Release|.NET
+ {A8D36198-BE2F-44E5-AC4F-4E052AFCCF78}.Release.Build.0 = Release|.NET
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Debug.ActiveCfg = Debug|.NET
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Debug.Build.0 = Debug|.NET
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Release.ActiveCfg = Release|.NET
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Release.Build.0 = Release|.NET
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Debug.ActiveCfg = Debug|.NET
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Debug.Build.0 = Debug|.NET
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Release.ActiveCfg = Release|.NET
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Release.Build.0 = Release|.NET
+ EndGlobalSection
+ GlobalSection(SolutionItems) = postSolution
+ clr.bat = clr.bat
+ CommonAssemblyInfo.cs = CommonAssemblyInfo.cs
+ license.rtf = license.rtf
+ nunit.build = nunit.build
+ nunit.snk = nunit.snk
+ NUnitDevTests.nunit = NUnitDevTests.nunit
+ NUnitFitTests.html = NUnitFitTests.html
+ NUnitTests.config = NUnitTests.config
+ NUnitTests.nunit = NUnitTests.nunit
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/mcs/nunit24/nunit.snk b/mcs/nunit24/nunit.snk
new file mode 100644
index 00000000000..733af424559
--- /dev/null
+++ b/mcs/nunit24/nunit.snk
Binary files differ
diff --git a/mcs/nunit24/nunit20under21.config b/mcs/nunit24/nunit20under21.config
new file mode 100644
index 00000000000..abe0c3a7e44
--- /dev/null
+++ b/mcs/nunit24/nunit20under21.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+
+ <!--
+ In order to run NUnit 2.0 tests under NUnit 2.1, the test
+ configuration must include a redirect that instructs the
+ runtime to use the NUnit 2.1 framework. You may copy the
+ section below into your test config file, or use this
+ file in it's entirety.
+
+ Note that additional redirects could be required if you
+ are running under a different version of the CLR than
+ the one for which your tests were built.
+ -->
+
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="nunit.framework"
+ publicKeyToken="96d09a1eb7f44a77"
+ culture="Neutral" />
+ <bindingRedirect oldVersion="2.0.6.0" newVersion="2.1.4.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+
+</configuration>
diff --git a/mcs/nunit24/nunit20under22.config b/mcs/nunit24/nunit20under22.config
new file mode 100644
index 00000000000..dc58da5f8b1
--- /dev/null
+++ b/mcs/nunit24/nunit20under22.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+
+ <!--
+ In order to run NUnit 2.0 or 2.1 tests under NUnit 2.2, the
+ test configuration must include a redirect that instructs the
+ runtime to use the NUnit 2.2 framework. You may copy the
+ section below into your test config file, or use this
+ file in it's entirety.
+
+ Note that additional redirects could be required if you
+ are running under a different version of the CLR than
+ the one for which your tests were built.
+ -->
+
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="nunit.framework"
+ publicKeyToken="96d09a1eb7f44a77"
+ culture="Neutral" />
+ <bindingRedirect oldVersion="2.0.6.0" newVersion="2.2.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+
+</configuration>
diff --git a/mcs/nunit24/nunit21under22.config b/mcs/nunit24/nunit21under22.config
new file mode 100644
index 00000000000..eff1e5e8b9c
--- /dev/null
+++ b/mcs/nunit24/nunit21under22.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+
+ <!--
+ In order to run NUnit 2.0 or 2.1 tests under NUnit 2.2, the
+ test configuration must include a redirect that instructs the
+ runtime to use the NUnit 2.2 framework. You may copy the
+ section below into your test config file, or use this
+ file in it's entirety.
+
+ Note that additional redirects could be required if you
+ are running under a different version of the CLR than
+ the one for which your tests were built.
+ -->
+
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="nunit.framework"
+ publicKeyToken="96d09a1eb7f44a77"
+ culture="Neutral" />
+ <bindingRedirect oldVersion="2.1.4.0" newVersion="2.2.0.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+
+</configuration>
diff --git a/mcs/nunit24/nunit_VS2005.sln b/mcs/nunit24/nunit_VS2005.sln
new file mode 100644
index 00000000000..882ec9a14f5
--- /dev/null
+++ b/mcs/nunit24/nunit_VS2005.sln
@@ -0,0 +1,217 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test-utilities_VS2005", "tests\test-utilities\test-utilities_VS2005.csproj", "{3E63AD0F-24D4-46BE-BEE4-5A3299847D86}"
+ ProjectSection(ProjectDependencies) = postProject
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382} = {83DD7E12-A705-4DBA-9D71-09C8973D9382}
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446} = {2E368281-3BA8-4050-B05E-0E0E43F8F446}
+ {98B10E98-003C-45A0-9587-119142E39986} = {98B10E98-003C-45A0-9587-119142E39986}
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D} = {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}
+ {61CE9CE5-943E-44D4-A381-814DC1406767} = {61CE9CE5-943E-44D4-A381-814DC1406767}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mock-assembly_VS2005", "tests\mock-assembly\mock-assembly_VS2005.csproj", "{2E368281-3BA8-4050-B05E-0E0E43F8F446}"
+ ProjectSection(ProjectDependencies) = postProject
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382} = {83DD7E12-A705-4DBA-9D71-09C8973D9382}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nonamespace-assembly_VS2005", "tests\nonamespace-assembly\nonamespace-assembly_VS2005.csproj", "{5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382} = {83DD7E12-A705-4DBA-9D71-09C8973D9382}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "timing-tests_VS2005", "tests\timing-tests\timing-tests_VS2005.csproj", "{F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}"
+ ProjectSection(ProjectDependencies) = postProject
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382} = {83DD7E12-A705-4DBA-9D71-09C8973D9382}
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446} = {2E368281-3BA8-4050-B05E-0E0E43F8F446}
+ {61CE9CE5-943E-44D4-A381-814DC1406767} = {61CE9CE5-943E-44D4-A381-814DC1406767}
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "notestfixtures-assembly_VS2005", "tests\notestfixtures-assembly\notestfixtures-assembly_VS2005.csproj", "{8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-console_VS2005", "ConsoleRunner\nunit-console\nunit-console_VS2005.csproj", "{9367EC89-6A38-42BA-9607-0DC288E4BC3A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-gui_VS2005", "GuiRunner\nunit-gui\nunit-gui_VS2005.csproj", "{3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.mocks_VS2005", "NUnitMocks\mocks\nunit.mocks_VS2005.csproj", "{EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.uikit.dll_VS2005", "GuiComponents\UiKit\nunit.uikit.dll_VS2005.csproj", "{27531BBF-183D-4C3A-935B-D840B9F1A3A4}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.util.dll_VS2005", "ClientUtilities\util\nunit.util.dll_VS2005.csproj", "{61CE9CE5-943E-44D4-A381-814DC1406767}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll_VS2005", "NUnitFramework\framework\nunit.framework.dll_VS2005.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.mocks.tests_VS2005", "NUnitMocks\tests\nunit.mocks.tests_VS2005.csproj", "{8667C588-1A05-4773-A9E8-272EB302B8AB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.uikit.tests_VS2005", "GuiComponents\tests\nunit.uikit.tests_VS2005.csproj", "{63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-console.exe_VS2005", "ConsoleRunner\nunit-console-exe\nunit-console.exe_VS2005.csproj", "{53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-console.tests_VS2005", "ConsoleRunner\tests\nunit-console.tests_VS2005.csproj", "{8597D2C6-804D-48CB-BFC7-ED2404D389B0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.util.tests_VS2005", "ClientUtilities\tests\nunit.util.tests_VS2005.csproj", "{74EF7165-117E-48ED-98EA-068EAE438E53}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.tests_VS2005", "NUnitFramework\tests\nunit.framework.tests_VS2005.csproj", "{8C326431-AE57-4645-ACC1-A90A0B425129}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-gui.exe_VS2005", "GuiRunner\nunit-gui-exe\nunit-gui.exe_VS2005.csproj", "{AAB186A4-FA3D-404D-AD78-7EB5BB861655}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit-gui.tests_VS2005", "GuiRunner\tests\nunit-gui.tests_VS2005.csproj", "{AAD27267-DE1F-4F61-A1FB-D1680A5B8001}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.extensions.tests_VS2005", "NUnitExtensions\tests\nunit.extensions.tests_VS2005.csproj", "{92961F10-EB6D-4C91-AD4F-B4F27BA571B2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.extensions.dll_VS2005", "NUnitExtensions\core\nunit.core.extensions.dll_VS2005.csproj", "{98B10E98-003C-45A0-9587-119142E39986}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3EE8FF35-CFD4-474A-B122-68F5E8EE0C7D}"
+ ProjectSection(SolutionItems) = preProject
+ clr.bat = clr.bat
+ CommonAssemblyInfo.cs = CommonAssemblyInfo.cs
+ license.rtf = license.rtf
+ nunit.snk = nunit.snk
+ NUnitDevTests.nunit = NUnitDevTests.nunit
+ NUnitFitTests.html = NUnitFitTests.html
+ NUnitTests.config = NUnitTests.config
+ NUnitTests.nunit = NUnitTests.nunit
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.dll_VS2005", "NUnitCore\core\nunit.core.dll_VS2005.csproj", "{EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.tests_VS2005", "NUnitCore\tests\nunit.core.tests_VS2005.csproj", "{DD758D21-E5D5-4D40-9450-5F65A32F359C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test-assembly_VS2005", "tests\test-assembly\test-assembly_VS2005.csproj", "{1960CAC4-9A82-47C5-A9B3-55BC37572C3C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.extensions.dll_VS2005", "NUnitExtensions\framework\nunit.framework.extensions.dll_VS2005.csproj", "{486C498D-B9F8-477F-ACA7-CED9245BBFCF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.core.interfaces.dll_VS2005", "NUnitCore\interfaces\nunit.core.interfaces.dll_VS2005.csproj", "{DCC88998-255A-4247-B658-71DD932E9873}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.fixtures_VS2005", "NUnitFixtures\fixtures\nunit.fixtures_VS2005.csproj", "{67D6949E-F4D2-4821-B02B-4AAFC3F18B52}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.fixtures.tests_VS2005", "NUnitFixtures\tests\nunit.fixtures.tests_VS2005.csproj", "{55F2D231-743C-48DD-B79A-00E5A7236CBE}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "loadtest-assembly_VS2005", "tests\loadtest-assembly\loadtest-assembly_VS2005.csproj", "{34734263-6F6C-403D-AD8C-CE3F8E340EA9}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug2005|Any CPU = Debug2005|Any CPU
+ Release2005|Any CPU = Release2005|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {3E63AD0F-24D4-46BE-BEE4-5A3299847D86}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {2E368281-3BA8-4050-B05E-0E0E43F8F446}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {5110F0D2-8E50-46F8-9E17-7C8EBFECCA9D}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {F16DED73-A2AD-4711-BC1B-5DDFC2BF8667}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {8D330DE4-B980-4A57-9F07-E9F7A7A33F4F}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {9367EC89-6A38-42BA-9607-0DC288E4BC3A}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {3FF340D5-D3B4-4DF0-BAF1-98B3C00B6148}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {EEE7C98B-23E6-472D-9036-C2D53B0DFE7C}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {27531BBF-183D-4C3A-935B-D840B9F1A3A4}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {61CE9CE5-943E-44D4-A381-814DC1406767}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {8667C588-1A05-4773-A9E8-272EB302B8AB}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {63EC3999-FA6B-4C5B-8805-5A88AF4CBD7B}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {53BF8787-CB9C-4BB8-AFB4-605DD3A5CA0E}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {8597D2C6-804D-48CB-BFC7-ED2404D389B0}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {74EF7165-117E-48ED-98EA-068EAE438E53}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {8C326431-AE57-4645-ACC1-A90A0B425129}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {AAB186A4-FA3D-404D-AD78-7EB5BB861655}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {AAD27267-DE1F-4F61-A1FB-D1680A5B8001}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {92961F10-EB6D-4C91-AD4F-B4F27BA571B2}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {98B10E98-003C-45A0-9587-119142E39986}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {98B10E98-003C-45A0-9587-119142E39986}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {98B10E98-003C-45A0-9587-119142E39986}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {98B10E98-003C-45A0-9587-119142E39986}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {EBD43A7F-AFCA-4281-BB53-5CDD91F966A3}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {DD758D21-E5D5-4D40-9450-5F65A32F359C}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {1960CAC4-9A82-47C5-A9B3-55BC37572C3C}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {486C498D-B9F8-477F-ACA7-CED9245BBFCF}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {DCC88998-255A-4247-B658-71DD932E9873}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {DCC88998-255A-4247-B658-71DD932E9873}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {DCC88998-255A-4247-B658-71DD932E9873}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {DCC88998-255A-4247-B658-71DD932E9873}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {67D6949E-F4D2-4821-B02B-4AAFC3F18B52}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {67D6949E-F4D2-4821-B02B-4AAFC3F18B52}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {67D6949E-F4D2-4821-B02B-4AAFC3F18B52}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {67D6949E-F4D2-4821-B02B-4AAFC3F18B52}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {55F2D231-743C-48DD-B79A-00E5A7236CBE}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Debug2005|Any CPU.ActiveCfg = Debug2005|Any CPU
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Debug2005|Any CPU.Build.0 = Debug2005|Any CPU
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Release2005|Any CPU.ActiveCfg = Release2005|Any CPU
+ {34734263-6F6C-403D-AD8C-CE3F8E340EA9}.Release2005|Any CPU.Build.0 = Release2005|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal