diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2012-01-31 09:16:24 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2012-01-31 09:16:24 -0800 |
commit | 4e798edfaf93990c79d35e9322efc0b9c0415f49 (patch) | |
tree | 6a736fadfe671ca9812033aa664d015a96e49993 | |
parent | 4185e8eb532939d1879dfd9e256db413c699f626 (diff) | |
download | DotNetOpenAuth-4e798edfaf93990c79d35e9322efc0b9c0415f49.zip DotNetOpenAuth-4e798edfaf93990c79d35e9322efc0b9c0415f49.tar.gz DotNetOpenAuth-4e798edfaf93990c79d35e9322efc0b9c0415f49.tar.bz2 |
Deleted NUnit samples that were irrelevant to the project.
80 files changed, 0 insertions, 6834 deletions
diff --git a/tools/NUnit/samples/Extensibility/Core/CoreExtensibility.sln b/tools/NUnit/samples/Extensibility/Core/CoreExtensibility.sln deleted file mode 100644 index 6e5ae57..0000000 --- a/tools/NUnit/samples/Extensibility/Core/CoreExtensibility.sln +++ /dev/null @@ -1,53 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Minimal", "Minimal\Minimal.csproj", "{EF428E5B-B3E7-4C2F-B005-98DE7D6E7CDB}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleFixtureExtension", "SampleFixtureExtension\SampleFixtureExtension.csproj", "{ED281A23-9579-4A70-B608-1B86DCDEB78C}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleFixtureExtensionTests", "SampleFixtureExtension\Tests\SampleFixtureExtensionTests.csproj", "{0DE6C90F-BB74-4BC8-887A-2222DB56D2EB}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleSuiteExtension", "SampleSuiteExtension\SampleSuiteExtension.csproj", "{0C4269EE-3266-45DD-9062-E356C067FBEF}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleSuiteExtensionTests", "SampleSuiteExtension\Tests\SampleSuiteExtensionTests.csproj", "{9F609A0D-FF7E-4F0C-B2DF-417EBC557CFF}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {EF428E5B-B3E7-4C2F-B005-98DE7D6E7CDB}.Debug.ActiveCfg = Debug|.NET - {EF428E5B-B3E7-4C2F-B005-98DE7D6E7CDB}.Debug.Build.0 = Debug|.NET - {EF428E5B-B3E7-4C2F-B005-98DE7D6E7CDB}.Release.ActiveCfg = Release|.NET - {EF428E5B-B3E7-4C2F-B005-98DE7D6E7CDB}.Release.Build.0 = Release|.NET - {ED281A23-9579-4A70-B608-1B86DCDEB78C}.Debug.ActiveCfg = Debug|.NET - {ED281A23-9579-4A70-B608-1B86DCDEB78C}.Debug.Build.0 = Debug|.NET - {ED281A23-9579-4A70-B608-1B86DCDEB78C}.Release.ActiveCfg = Release|.NET - {ED281A23-9579-4A70-B608-1B86DCDEB78C}.Release.Build.0 = Release|.NET - {0DE6C90F-BB74-4BC8-887A-2222DB56D2EB}.Debug.ActiveCfg = Debug|.NET - {0DE6C90F-BB74-4BC8-887A-2222DB56D2EB}.Debug.Build.0 = Debug|.NET - {0DE6C90F-BB74-4BC8-887A-2222DB56D2EB}.Release.ActiveCfg = Release|.NET - {0DE6C90F-BB74-4BC8-887A-2222DB56D2EB}.Release.Build.0 = Release|.NET - {0C4269EE-3266-45DD-9062-E356C067FBEF}.Debug.ActiveCfg = Debug|.NET - {0C4269EE-3266-45DD-9062-E356C067FBEF}.Debug.Build.0 = Debug|.NET - {0C4269EE-3266-45DD-9062-E356C067FBEF}.Release.ActiveCfg = Release|.NET - {0C4269EE-3266-45DD-9062-E356C067FBEF}.Release.Build.0 = Release|.NET - {9F609A0D-FF7E-4F0C-B2DF-417EBC557CFF}.Debug.ActiveCfg = Debug|.NET - {9F609A0D-FF7E-4F0C-B2DF-417EBC557CFF}.Debug.Build.0 = Debug|.NET - {9F609A0D-FF7E-4F0C-B2DF-417EBC557CFF}.Release.ActiveCfg = Release|.NET - {9F609A0D-FF7E-4F0C-B2DF-417EBC557CFF}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.build b/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.build deleted file mode 100644 index f92d521..0000000 --- a/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.build +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<project name="Minimal" default="build" basedir="."> - - <include buildfile="../../../samples.common" /> - - <patternset id="source-files"> - <include name="Minimal.cs" /> - </patternset> - - <target name="packagex"> - <copy todir="${package.samples.dir}/Extensibility/Core/Minimal"> - <fileset basedir="."> - <include name="Minimal.csproj" /> - <include name="Minimal.build" /> - <include name="Readme.txt" /> - <patternset refid="source-files" /> - </fileset> - </copy> - </target> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.cs b/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.cs deleted file mode 100644 index 17b4bdb..0000000 --- a/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.cs +++ /dev/null @@ -1,36 +0,0 @@ -// **************************************************************** -// 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.Samples.Extensibility -{ - /// <summary> - /// This is the smallest possible Addin, which does nothing - /// but is recognized by NUnit and listed in the Addins dialog. - /// - /// The Addin class is marked by the NUnitAddin attribute and - /// implements IAddin, as required. Optional property syntax - /// is used here to override the default name of the addin and - /// to provide a description. Both are displayed by NUnit in the - /// Addin Dialog. - /// - /// The addin doesn't actually install anything, but simply - /// returns false in its Install method. - /// </summary> - [NUnitAddin(Name="Minimal Addin", Description="This Addin doesn't do anything")] - public class Minimal : IAddin - { - #region IAddin Members - public bool Install(IExtensionHost host) - { - // TODO: Add Minimal.Install implementation - return true; - } - #endregion - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.csproj b/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.csproj deleted file mode 100644 index f6677e1..0000000 --- a/tools/NUnit/samples/Extensibility/Core/Minimal/Minimal.csproj +++ /dev/null @@ -1,89 +0,0 @@ -<VisualStudioProject> - <CSHARP - ProjectType = "Local" - ProductVersion = "7.10.3077" - SchemaVersion = "2.0" - ProjectGuid = "{EF428E5B-B3E7-4C2F-B005-98DE7D6E7CDB}" - > - <Build> - <Settings - ApplicationIcon = "" - AssemblyKeyContainerName = "" - AssemblyName = "Minimal" - AssemblyOriginatorKeyFile = "" - DefaultClientScript = "JScript" - DefaultHTMLPageLayout = "Grid" - DefaultTargetSchema = "IE50" - DelaySign = "false" - OutputType = "Library" - PreBuildEvent = "" - PostBuildEvent = "" - RootNamespace = "NUnit.Samples.Extensibility" - 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" - /> - <Reference - Name = "nunit.core.interfaces" - AssemblyName = "nunit.core.interfaces" - HintPath = "..\..\..\..\solutions\vs2003\NUnitCore\interfaces\bin\Debug\nunit.core.interfaces.dll" - /> - </References> - </Build> - <Files> - <Include> - <File - RelPath = "Minimal.cs" - SubType = "Code" - BuildAction = "Compile" - /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject> - diff --git a/tools/NUnit/samples/Extensibility/Core/Minimal/ReadMe.txt b/tools/NUnit/samples/Extensibility/Core/Minimal/ReadMe.txt deleted file mode 100644 index 901df80..0000000 --- a/tools/NUnit/samples/Extensibility/Core/Minimal/ReadMe.txt +++ /dev/null @@ -1,27 +0,0 @@ -Minimal Addin Example - - -MinimalAddin Class - -This class represents the addin. It is marked by the NUnitAddinAttribute -and implements the required IAddin interface. When called by NUnit to -install itself, it simply returns false. - -Note on Building this Extension - -If you use the Visual Studio solution, the NUnit references in both -included projects must be changed so that they refer to the copy of -NUnit in which you want to install the extension. The post-build step -for the SampleSuiteExtension project must be changed to copy the -extension into the addins directory for your NUnit install. - -NOTE: - -The references to nunit.core and nunit.common in the -SampleSuiteExtension project have their Copy Local property set to -false, rather than the Visual Studio default of true. In developing -extensions, it is essential there be no extra copies of these assemblies -be created. Once the extension is complete, those who install it in -binary form will not need to deal with this issue. - - diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/AssemblyInfo.cs b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/AssemblyInfo.cs deleted file mode 100644 index 9f89a32..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -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/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/ReadMe.txt b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/ReadMe.txt deleted file mode 100644 index 11fb204..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/ReadMe.txt +++ /dev/null @@ -1,43 +0,0 @@ -SampleSuiteExtension Example - -This is a minimal example of a SuiteBuilder extension. It extends -NUnit.Core.TestSuite test suite and creates a fixture that runs every -test starting with "SampleTest..." It packages both the core extension -and the attribute used in the tests in the same assembly. - -SampleSuiteExtension Class - -This class derives from NUnit.Framework.TestSuite and represents the -extended suite within NUnit. Because it inherits from TestSuite, -rather than TestFixture, it has to construct its own fixture object and -find its own tests. Everything is done in the constructor for simplicity. - -SampleSuiteExtensionBuilder - -This class is the actual SuiteBuilder loaded by NUnit as an add-in. -It recognizes the SampleSuiteExtensionAttribute and invokes the -SampleSuiteExtension constructor to build the suite. - -SampleSuiteExtensionAttribute - -This is the special attribute used to mark tests to be constructed -using this add-in. It is the only class referenced from the user tests. - -Note on Building this Extension - -If you use the Visual Studio solution, the NUnit references in both -included projects must be changed so that they refer to the copy of -NUnit in which you want to install the extension. The post-build step -for the SampleSuiteExtension project must be changed to copy the -extension into the addins directory for your NUnit install. - -NOTE: - -The references to nunit.core and nunit.common in the -SampleSuiteExtension project have their Copy Local property set to -false, rather than the Visual Studio default of true. In developing -extensions, it is essential there be no extra copies of these assemblies -be created. Once the extension is complete, those who install it in -binary form will not need to deal with this issue. - - diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.build b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.build deleted file mode 100644 index 474d4aa..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.build +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<project name="SampleFixtureExtension" default="build" basedir="."> - - <include buildfile="../../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.cs" /> - <include name="SampleFixtureExtension.cs" /> - <include name="SampleFixtureExtensionAttribute.cs" /> - <include name="SampleFixtureExtensionBuilder.cs" /> - </patternset> - - <patternset id="test-files"> - <include name="AssemblyInfo.cs" /> - <include name="SampleFixtureExtensionTests.cs" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.cs b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.cs deleted file mode 100644 index 8359d2f..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.cs +++ /dev/null @@ -1,44 +0,0 @@ -// **************************************************************** -// 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.Extensions -{ - /// <summary> - /// SampleFixtureExtension extends NUnitTestFixture and adds a custom setup - /// before running TestFixtureSetUp and after running TestFixtureTearDown. - /// Because it inherits from NUnitTestFixture, a lot of work is done for it. - /// </summary> - class SampleFixtureExtension : NUnitTestFixture - { - public SampleFixtureExtension( Type fixtureType ) - : base( fixtureType ) - { - // NOTE: Since we are inheriting from NUnitTestFixture we don't - // have to do anything if we don't want to. All the attributes - // that are normally used with an NUnitTestFixture will be - // recognized. - // - // Just to have something to do, we override DoOneTimeSetUp and - // DoOneTimeTearDown below to do some special processing before - // and after the normal TestFixtureSetUp and TestFixtureTearDown. - // In this example, we simply display a message. - } - - protected override void DoOneTimeSetUp(TestResult suiteResult) - { - Console.WriteLine( "Extended Fixture SetUp called" ); - base.DoOneTimeSetUp (suiteResult); - } - - protected override void DoOneTimeTearDown(TestResult suiteResult) - { - base.DoOneTimeTearDown (suiteResult); - Console.WriteLine( "Extended Fixture TearDown called" ); - } - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.csproj b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.csproj deleted file mode 100644 index 1fb245b..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtension.csproj +++ /dev/null @@ -1,109 +0,0 @@ -<VisualStudioProject> - <CSHARP - ProjectType = "Local" - ProductVersion = "7.10.3077" - SchemaVersion = "2.0" - ProjectGuid = "{ED281A23-9579-4A70-B608-1B86DCDEB78C}" - > - <Build> - <Settings - ApplicationIcon = "" - AssemblyKeyContainerName = "" - AssemblyName = "SampleFixtureExtension" - AssemblyOriginatorKeyFile = "" - DefaultClientScript = "JScript" - DefaultHTMLPageLayout = "Grid" - DefaultTargetSchema = "IE50" - DelaySign = "false" - OutputType = "Library" - PreBuildEvent = "" - PostBuildEvent = "" - RootNamespace = "SampleFixtureExtension" - 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" - /> - <Reference - Name = "nunit.core.interfaces" - AssemblyName = "nunit.core.interfaces" - HintPath = "..\..\..\..\solutions\vs2003\NUnitCore\interfaces\bin\Debug\nunit.core.interfaces.dll" - /> - <Reference - Name = "nunit.core" - AssemblyName = "nunit.core" - HintPath = "..\..\..\..\solutions\vs2003\NUnitCore\core\bin\Debug\nunit.core.dll" - /> - </References> - </Build> - <Files> - <Include> - <File - RelPath = "AssemblyInfo.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SampleFixtureExtension.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SampleFixtureExtensionAttribute.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SampleFixtureExtensionBuilder.cs" - SubType = "Code" - BuildAction = "Compile" - /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject> - diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtensionAttribute.cs b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtensionAttribute.cs deleted file mode 100644 index 2d9737c..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtensionAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -// **************************************************************** -// 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.Extensions -{ - /// <summary> - /// SampleFixtureExtensionAttribute is used to identify a SampleFixtureExtension class - /// </summary> - [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)] - public sealed class SampleFixtureExtensionAttribute : Attribute - { - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtensionBuilder.cs b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtensionBuilder.cs deleted file mode 100644 index 3713a7e..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/SampleFixtureExtensionBuilder.cs +++ /dev/null @@ -1,58 +0,0 @@ -// **************************************************************** -// 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.Builders; -using NUnit.Core.Extensibility; - -namespace NUnit.Core.Extensions -{ - /// <summary> - /// MockFixtureExtensionBuilder knows how to build - /// a MockFixtureExtension. - /// </summary> - [NUnitAddin(Description="Wraps an NUnitTestFixture with an additional level of SetUp and TearDown")] - public class SampleFixtureExtensionBuilder : ISuiteBuilder, IAddin - { - #region NUnitTestFixtureBuilder Overrides - /// <summary> - /// Makes a SampleFixtureExtension instance - /// </summary> - /// <param name="type">The type to be used</param> - /// <returns>A SampleFixtureExtension as a TestSuite</returns> -// protected override TestSuite MakeSuite(Type type) -// { -// return new SampleFixtureExtension( type ); -// } - - // The builder recognizes the types that it can use by the presense - // of SampleFixtureExtensionAttribute. Note that an attribute does not - // have to be used. You can use any arbitrary set of rules that can be - // implemented using reflection on the type. - public bool CanBuildFrom(Type type) - { - return Reflect.HasAttribute( type, "NUnit.Core.Extensions.SampleFixtureExtensionAttribute", false ); - } - - public Test BuildFrom(Type type) - { - return null; - } - #endregion - - #region IAddin Members - public bool Install(IExtensionHost host) - { - IExtensionPoint suiteBuilders = host.GetExtensionPoint( "SuiteBuilders" ); - if ( suiteBuilders == null ) - return false; - - suiteBuilders.Install( this ); - return true; - } - #endregion - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/AssemblyInfo.cs b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/AssemblyInfo.cs deleted file mode 100644 index 9f89a32..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -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/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/SampleFixtureExtensionTests.cs b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/SampleFixtureExtensionTests.cs deleted file mode 100644 index 671fca9..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/SampleFixtureExtensionTests.cs +++ /dev/null @@ -1,48 +0,0 @@ -// **************************************************************** -// 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.Core.Extensions; - -namespace NUnit.Extensions.Tests -{ - /// <summary> - /// Test class that demonstrates SampleFixtureExtension - /// </summary> - [SampleFixtureExtension] - public class SampleFixtureExtensionTests - { - [TestFixtureSetUp] - public void SetUpTests() - { - Console.WriteLine( "TestFixtureSetUp called" ); - } - - [TestFixtureTearDown] - public void FixtureTearDown() - { - Console.WriteLine( "TestFixtureTearDown called" ); - } - - [Test] - public void SomeTest() - { - Console.WriteLine( "Hello from some test" ); - } - - [Test] - public void AnotherTest() - { - Console.WriteLine( "Hello from another test" ); - } - - public void NotATest() - { - Console.WriteLine( "I shouldn't be called!" ); - } - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/SampleFixtureExtensionTests.csproj b/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/SampleFixtureExtensionTests.csproj deleted file mode 100644 index cc082b9..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleFixtureExtension/Tests/SampleFixtureExtensionTests.csproj +++ /dev/null @@ -1,94 +0,0 @@ -<VisualStudioProject> - <CSHARP - ProjectType = "Local" - ProductVersion = "7.10.3077" - SchemaVersion = "2.0" - ProjectGuid = "{0DE6C90F-BB74-4BC8-887A-2222DB56D2EB}" - > - <Build> - <Settings - ApplicationIcon = "" - AssemblyKeyContainerName = "" - AssemblyName = "SampleFixtureExtensionTests" - AssemblyOriginatorKeyFile = "" - DefaultClientScript = "JScript" - DefaultHTMLPageLayout = "Grid" - DefaultTargetSchema = "IE50" - DelaySign = "false" - OutputType = "Library" - PreBuildEvent = "" - PostBuildEvent = "" - RootNamespace = "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" - /> - <Reference - Name = "SampleFixtureExtension" - Project = "{ED281A23-9579-4A70-B608-1B86DCDEB78C}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference - Name = "nunit.framework" - AssemblyName = "nunit.framework" - HintPath = "..\..\..\bin\nunit.framework.dll" - /> - </References> - </Build> - <Files> - <Include> - <File - RelPath = "SampleFixtureExtensionTests.cs" - SubType = "Code" - BuildAction = "Compile" - /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject> - diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Addin.cs b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Addin.cs deleted file mode 100644 index 20a359a..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Addin.cs +++ /dev/null @@ -1,30 +0,0 @@ -// **************************************************************** -// 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.Extensions -{ - /// <summary> - /// Summary description for Addin. - /// </summary> - [NUnitAddin(Name="SampleSuiteExtension", Description = "Recognizes Tests starting with SampleTest...")] - public class Addin : IAddin - { - #region IAddin Members - public bool Install(IExtensionHost host) - { - IExtensionPoint builders = host.GetExtensionPoint( "SuiteBuilders" ); - if ( builders == null ) - return false; - - builders.Install( new SampleSuiteExtensionBuilder() ); - return true; - } - #endregion - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/AssemblyInfo.cs b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/AssemblyInfo.cs deleted file mode 100644 index 9f89a32..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -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/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/ReadMe.txt b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/ReadMe.txt deleted file mode 100644 index 11fb204..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/ReadMe.txt +++ /dev/null @@ -1,43 +0,0 @@ -SampleSuiteExtension Example - -This is a minimal example of a SuiteBuilder extension. It extends -NUnit.Core.TestSuite test suite and creates a fixture that runs every -test starting with "SampleTest..." It packages both the core extension -and the attribute used in the tests in the same assembly. - -SampleSuiteExtension Class - -This class derives from NUnit.Framework.TestSuite and represents the -extended suite within NUnit. Because it inherits from TestSuite, -rather than TestFixture, it has to construct its own fixture object and -find its own tests. Everything is done in the constructor for simplicity. - -SampleSuiteExtensionBuilder - -This class is the actual SuiteBuilder loaded by NUnit as an add-in. -It recognizes the SampleSuiteExtensionAttribute and invokes the -SampleSuiteExtension constructor to build the suite. - -SampleSuiteExtensionAttribute - -This is the special attribute used to mark tests to be constructed -using this add-in. It is the only class referenced from the user tests. - -Note on Building this Extension - -If you use the Visual Studio solution, the NUnit references in both -included projects must be changed so that they refer to the copy of -NUnit in which you want to install the extension. The post-build step -for the SampleSuiteExtension project must be changed to copy the -extension into the addins directory for your NUnit install. - -NOTE: - -The references to nunit.core and nunit.common in the -SampleSuiteExtension project have their Copy Local property set to -false, rather than the Visual Studio default of true. In developing -extensions, it is essential there be no extra copies of these assemblies -be created. Once the extension is complete, those who install it in -binary form will not need to deal with this issue. - - diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.build b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.build deleted file mode 100644 index 0dda8cc..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.build +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<project name="SampleSuiteExtension" default="build" basedir="."> - - <include buildfile="../../../samples.common" /> - - <patternset id="source-files"> - <include name="Addin.cs" /> - <include name="AssemblyInfo.cs" /> - <include name="SampleSuiteExtension.cs" /> - <include name="SampleSuiteExtensionAttribute.cs" /> - <include name="SampleSuiteExtensionBuilder.cs" /> - </patternset> - - <patternset id="test-files"> - <include name="SampleSuiteExtensionTests.cs" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.cs b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.cs deleted file mode 100644 index 7abfa2c..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.cs +++ /dev/null @@ -1,39 +0,0 @@ -// **************************************************************** -// 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> - /// SampleSuiteExtension is a minimal example of a suite extension. It - /// extends test suite and creates a fixture that runs every test starting - /// with "SampleTest..." Because it inherits from TestSuite, rather than - /// TestFixture, it has to construct its own fixture object and find its - /// own tests. Everything is done in the constructor for simplicity. - /// </summary> - class SampleSuiteExtension : TestSuite - { - public SampleSuiteExtension( Type fixtureType ) - : base( fixtureType ) - { - // Create the fixture object. We could wait to do this when - // it is needed, but we do it here for simplicity. - this.Fixture = Reflect.Construct( fixtureType ); - - // Locate our test methods and add them to the suite using - // the Add method of TestSuite. Note that we don't do a simple - // Tests.Add, because that wouldn't set the parent of the tests. - foreach( MethodInfo method in fixtureType.GetMethods( - BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly ) ) - { - if ( method.Name.StartsWith( "SampleTest" ) ) - this.Add( new NUnitTestMethod( method ) ); - } - } - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.csproj b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.csproj deleted file mode 100644 index c7d0a70..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtension.csproj +++ /dev/null @@ -1,114 +0,0 @@ -<VisualStudioProject> - <CSHARP - ProjectType = "Local" - ProductVersion = "7.10.3077" - SchemaVersion = "2.0" - ProjectGuid = "{0C4269EE-3266-45DD-9062-E356C067FBEF}" - > - <Build> - <Settings - ApplicationIcon = "" - AssemblyKeyContainerName = "" - AssemblyName = "SampleSuiteExtension" - AssemblyOriginatorKeyFile = "" - DefaultClientScript = "JScript" - DefaultHTMLPageLayout = "Grid" - DefaultTargetSchema = "IE50" - DelaySign = "false" - OutputType = "Library" - PreBuildEvent = "" - PostBuildEvent = "" - RootNamespace = "SampleSuiteExtension" - 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" - /> - <Reference - Name = "nunit.core.interfaces" - AssemblyName = "nunit.core.interfaces" - HintPath = "..\..\..\bin\nunit.core.interfaces.dll" - /> - <Reference - Name = "nunit.core" - AssemblyName = "nunit.core" - HintPath = "..\..\..\bin\nunit.core.dll" - /> - </References> - </Build> - <Files> - <Include> - <File - RelPath = "Addin.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "AssemblyInfo.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SampleSuiteExtension.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SampleSuiteExtensionAttribute.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "SampleSuiteExtensionBuilder.cs" - SubType = "Code" - BuildAction = "Compile" - /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject> - diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionAttribute.cs b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionAttribute.cs deleted file mode 100644 index 7194ea5..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -// **************************************************************** -// 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.Extensions -{ - /// <summary> - /// SampleSuiteExtensionAttribute is used to identify a SampleSuiteExtension fixture - /// </summary> - [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)] - public sealed class SampleSuiteExtensionAttribute : Attribute - { - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionBuilder.cs b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionBuilder.cs deleted file mode 100644 index 39b7b49..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/SampleSuiteExtensionBuilder.cs +++ /dev/null @@ -1,41 +0,0 @@ -// **************************************************************** -// 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.Extensions -{ - /// <summary> - /// SampleSuiteExtensionBuilder knows how to build a SampleSuiteExtension - /// </summary> - public class SampleSuiteExtensionBuilder : ISuiteBuilder - { - #region ISuiteBuilder Members - - // This builder delegates all the work to the constructor of the - // extension suite. Many builders will need to do more work, - // looking for other attributes, setting properties on the - // suite and locating methods for tests, setup and teardown. - public Test BuildFrom(Type type) - { - if ( CanBuildFrom( type ) ) - return new SampleSuiteExtension( type ); - return null; - } - - // The builder recognizes the types that it can use by the presense - // of SampleSuiteExtensionAttribute. Note that an attribute does not - // have to be used. You can use any arbitrary set of rules that can be - // implemented using reflection on the type. - public bool CanBuildFrom(Type type) - { - return Reflect.HasAttribute( type, "NUnit.Core.Extensions.SampleSuiteExtensionAttribute", false ); - } - - #endregion - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Tests/SampleSuiteExtensionTests.cs b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Tests/SampleSuiteExtensionTests.cs deleted file mode 100644 index d1a7660..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Tests/SampleSuiteExtensionTests.cs +++ /dev/null @@ -1,33 +0,0 @@ -// **************************************************************** -// 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.Tests -{ - /// <summary> - /// Test class that demonstrates SampleSuiteExtension - /// </summary> - [SampleSuiteExtension] - public class SampleSuiteExtensionTests - { - public void SampleTest1() - { - Console.WriteLine( "Hello from sample test 1" ); - } - - public void SampleTest2() - { - Console.WriteLine( "Hello from sample test 2" ); - } - - public void NotATest() - { - Console.WriteLine( "I shouldn't be called!" ); - } - } -} diff --git a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Tests/SampleSuiteExtensionTests.csproj b/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Tests/SampleSuiteExtensionTests.csproj deleted file mode 100644 index 339d89b..0000000 --- a/tools/NUnit/samples/Extensibility/Core/SampleSuiteExtension/Tests/SampleSuiteExtensionTests.csproj +++ /dev/null @@ -1,94 +0,0 @@ -<VisualStudioProject> - <CSHARP - ProjectType = "Local" - ProductVersion = "7.10.3077" - SchemaVersion = "2.0" - ProjectGuid = "{9F609A0D-FF7E-4F0C-B2DF-417EBC557CFF}" - > - <Build> - <Settings - ApplicationIcon = "" - AssemblyKeyContainerName = "" - AssemblyName = "SampleSuiteExtensionTests" - AssemblyOriginatorKeyFile = "" - DefaultClientScript = "JScript" - DefaultHTMLPageLayout = "Grid" - DefaultTargetSchema = "IE50" - DelaySign = "false" - OutputType = "Library" - PreBuildEvent = "" - PostBuildEvent = "" - RootNamespace = "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" - /> - <Reference - Name = "SampleSuiteExtension" - Project = "{0C4269EE-3266-45DD-9062-E356C067FBEF}" - Package = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}" - /> - <Reference - Name = "nunit.framework" - AssemblyName = "nunit.framework" - HintPath = "..\..\..\..\bin\nunit.framework.dll" - /> - </References> - </Build> - <Files> - <Include> - <File - RelPath = "SampleSuiteExtensionTests.cs" - SubType = "Code" - BuildAction = "Compile" - /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject> - diff --git a/tools/NUnit/samples/ReadMe.txt b/tools/NUnit/samples/ReadMe.txt deleted file mode 100644 index 71e0ee7..0000000 --- a/tools/NUnit/samples/ReadMe.txt +++ /dev/null @@ -1,69 +0,0 @@ -NUnit Samples - -This directory contains sample applications demonstrating the use of NUnit and organized as follows... - - CSharp: Samples in C# - - Failures: Demonstrates 4 failing tests and one that is not run. - - Money: This is a C# version of the money example which is found in most xUnit implementations. Thanks to Kent Beck. - - Money-Port: This shows how the Money example can be ported from Version 1 of NUnit with minimal changes. - - Syntax: Illustrates most Assert methods using both the classic and constraint-based syntax. - - JSharp: Samples in J# - - Failures: Demonstrates 4 failing tests and one that is not run. - - CPP: C++ Samples - - MANAGED: Managed C++ Samples (VS 2003 compatible) - - Failures: Demonstrates 4 failing tests and one that is not run. - - CPP-CLI: C++/CLI Samples (VS 2005 only) - - Failures: Demonstrates 4 failing tests and one that is not run. - - Syntax: Illustrates most Assert methods using both the classic and constraint-based syntax. - - VB: Samples in VB.NET - - Failures: Demonstrates 4 failing tests and one that is not run. - - Money: This is a VB.NET version of the money example found in most xUnit implementations. Thanks to Kent Beck. - - Syntax: Illustrates most Assert methods using both the classic and constraint-based syntax. - - Extensibility: Examples of extending NUnit - - Framework: - - Core: - - TestSuiteExtension - - TestFixtureExtension - - -Building the Samples - -A Visual Studio 2003 project is included for most samples. -Visual Studio 2005 will convert the format automatically upon -opening it. The C++/CLI samples, as well as other samples that -depend on .NET 2.0 features, include Visual Studio 2005 projects. - -In most cases, you will need to remove the reference to the -nunit.framework assembly and replace it with a reference to -your installed copy of NUnit. - -To build using the Microsoft compiler, use a command similar -to the following: - - csc /target:library /r:<path-to-NUnit>/nunit.framework.dll example.cs - -To build using the mono compiler, use a command like this: - - msc /target:library /r:<path-to-NUNit>/nunit.framework.dll example.cs - diff --git a/tools/NUnit/samples/cpp/cpp-cli/cpp-cli.sln b/tools/NUnit/samples/cpp/cpp-cli/cpp-cli.sln deleted file mode 100644 index a30cf36..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/cpp-cli.sln +++ /dev/null @@ -1,41 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-cli-failures", "failures\cpp-cli-failures.vcproj", "{A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-cli-syntax", "syntax\cpp-cli-syntax.vcproj", "{72448C2D-17C9-419E-B28D-3B533E7E0CD5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Debug|Win32.ActiveCfg = Debug|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Debug|Win32.Build.0 = Debug|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Release|Any CPU.ActiveCfg = Release|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Release|Mixed Platforms.Build.0 = Release|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Release|Win32.ActiveCfg = Release|Win32 - {A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}.Release|Win32.Build.0 = Release|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Debug|Any CPU.ActiveCfg = Debug|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Debug|Win32.ActiveCfg = Debug|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Debug|Win32.Build.0 = Debug|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Release|Any CPU.ActiveCfg = Release|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Release|Mixed Platforms.Build.0 = Release|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Release|Win32.ActiveCfg = Release|Win32 - {72448C2D-17C9-419E-B28D-3B533E7E0CD5}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/NUnit/samples/cpp/cpp-cli/failures/AssemblyInfo.cpp b/tools/NUnit/samples/cpp/cpp-cli/failures/AssemblyInfo.cpp deleted file mode 100644 index e64d6ee..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/failures/AssemblyInfo.cpp +++ /dev/null @@ -1,56 +0,0 @@ -using namespace System::Reflection; -using namespace 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:AssemblyTitleAttribute("")]; -[assembly:AssemblyDescriptionAttribute("")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("")]; -[assembly:AssemblyProductAttribute("")]; -[assembly:AssemblyCopyrightAttribute("")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the value or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly:AssemblyVersionAttribute("2.2.0.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 directory. -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly:AssemblyDelaySignAttribute(false)]; -[assembly:AssemblyKeyFileAttribute("")]; -[assembly:AssemblyKeyNameAttribute("")]; - diff --git a/tools/NUnit/samples/cpp/cpp-cli/failures/cpp-cli-failures.build b/tools/NUnit/samples/cpp/cpp-cli/failures/cpp-cli-failures.build deleted file mode 100644 index 8cf139e..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/failures/cpp-cli-failures.build +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<project name="cpp-cli-failures" default="build"> - - <include buildfile="../../../samples.common"/> - - <patternset id="source-files"> - <include name="AssemblyInfo.cpp" /> - <include name="cppsample.cpp" /> - <include name="cppsample.h" /> - </patternset> - - <target name="packagex"> - <copy todir="${package.samples.dir}/cpp/cpp-cli/failures"> - <fileset basedir="."> - <include name="cpp-cli-failures.vcproj" /> - <include name="cpp-cli-failures.build" /> - <include name="AssemblyInfo.cpp" /> - <include name="cppsample.cpp" /> - <include name="cppsample.h" /> - </fileset> - </copy> - </target> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/cpp/cpp-cli/failures/cpp-cli-failures.vcproj b/tools/NUnit/samples/cpp/cpp-cli/failures/cpp-cli-failures.vcproj deleted file mode 100644 index 364a6be..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/failures/cpp-cli-failures.vcproj +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="cpp-cli-failures" - ProjectGUID="{A0987BCD-AFE6-40E4-95A8-ADA7ADB7E97D}" - RootNamespace="cpp-failures" - Keyword="ManagedCProj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="2" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - ManagedExtensions="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalUsingDirectories="" - PreprocessorDefinitions="WIN32;_DEBUG" - MinimalRebuild="false" - BasicRuntimeChecks="0" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - OutputFile="$(OutDir)/cpp-cli-failures.dll" - LinkIncremental="2" - GenerateDebugInformation="true" - AssemblyDebug="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="2" - InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - CharacterSet="2" - ManagedExtensions="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="1" - AdditionalUsingDirectories="" - PreprocessorDefinitions="WIN32;NDEBUG" - MinimalRebuild="false" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - OutputFile="$(OutDir)/cpp-cli-failures.dll" - LinkIncremental="1" - GenerateDebugInformation="true" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - <AssemblyReference - RelativePath="..\..\..\..\solutions\vs2005\NUnitFramework\framework\bin\Debug\nunit.framework.dll" - AssemblyName="nunit.framework, Version=2.5.0.0, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" - /> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm" - > - <File - RelativePath="AssemblyInfo.cpp" - > - </File> - <File - RelativePath="cppsample.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc" - > - <File - RelativePath="cppsample.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;r" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/tools/NUnit/samples/cpp/cpp-cli/failures/cppsample.cpp b/tools/NUnit/samples/cpp/cpp-cli/failures/cppsample.cpp deleted file mode 100644 index f5aea7c..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/failures/cppsample.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// **************************************************************** -// 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. -// **************************************************************** - -#include "cppsample.h" - -namespace NUnitSamples { - - void SimpleCPPSample::Init() { - fValue1 = 2; - fValue2 = 3; - } - - void SimpleCPPSample::Add() { - int result = fValue1 + fValue2; - Assert::AreEqual(6,result); - } - - void SimpleCPPSample::DivideByZero() - { - int zero= 0; - int result= 8/zero; - } - - void SimpleCPPSample::Equals() { - Assert::AreEqual(12, 12, "Integer"); - Assert::AreEqual(12L, 12L, "Long"); - Assert::AreEqual('a', 'a', "Char"); - - - Assert::AreEqual(12, 13, "Expected Failure (Integer)"); - Assert::AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double)"); - } - - void SimpleCPPSample::IgnoredTest() - { - throw gcnew InvalidCastException(); - } - - void SimpleCPPSample::ExpectAnException() - { - throw gcnew InvalidCastException(); - } - -} - diff --git a/tools/NUnit/samples/cpp/cpp-cli/failures/cppsample.h b/tools/NUnit/samples/cpp/cpp-cli/failures/cppsample.h deleted file mode 100644 index 863feb5..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/failures/cppsample.h +++ /dev/null @@ -1,28 +0,0 @@ -// **************************************************************** -// 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. -// **************************************************************** - -#pragma once - -using namespace System; -using namespace NUnit::Framework; - -namespace NUnitSamples -{ - [TestFixture] - public ref class SimpleCPPSample - { - int fValue1; - int fValue2; - public: - [SetUp] void Init(); - - [Test] void Add(); - [Test] void DivideByZero(); - [Test] void Equals(); - [Test] [Ignore("ignored test")] void IgnoredTest(); - [Test] [ExpectedException(InvalidOperationException::typeid)] void ExpectAnException(); - }; -} diff --git a/tools/NUnit/samples/cpp/cpp-cli/syntax/AssemblyInfo.cpp b/tools/NUnit/samples/cpp/cpp-cli/syntax/AssemblyInfo.cpp deleted file mode 100644 index b18cdfa..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/syntax/AssemblyInfo.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "stdafx.h" - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Permissions; - -// -// 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:AssemblyTitleAttribute("cppclisyntax")]; -[assembly:AssemblyDescriptionAttribute("")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("")]; -[assembly:AssemblyProductAttribute("cppclisyntax")]; -[assembly:AssemblyCopyrightAttribute("Copyright (c) 2007")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the value or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly:AssemblyVersionAttribute("1.0.*")]; - -[assembly:ComVisible(false)]; - -[assembly:CLSCompliantAttribute(true)]; - -[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; diff --git a/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.build b/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.build deleted file mode 100644 index f3b6328..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.build +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<project name="cpp-cli-syntax" default="build"> - - <include buildfile="../../../samples.common"/> - - <patternset id="source-files"> - <include name="AssemblyInfo.cpp" /> - <include name="cpp-cli-syntax.cpp" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.cpp b/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.cpp deleted file mode 100644 index a554e95..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.cpp +++ /dev/null @@ -1,641 +0,0 @@ -// **************************************************************** -// 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 namespace NUnit::Framework; -using NUnit::Framework::Is; -using NUnit::Framework::Text; -using NUnit::Framework::List; -using NUnit::Framework::Has; -using System::String; - -namespace NUnitSamples -{ - [TestFixture] - public ref class AssertSyntaxTests : AssertionHelper - { - public: - [Test] - void IsNull() - { - Object ^nada = nullptr; - - // Classic syntax - Assert::IsNull(nada); - - // Helper syntax - Assert::That(nada, Is::Null); - - // Inherited syntax - Expect(nada, Null); - } - - [Test] - void IsNotNull() - { - // Classic syntax - Assert::IsNotNull(42); - - // Helper syntax - Assert::That(42, Is::Not->Null); - - // Inherited syntax - Expect( 42, Not->Null ); - } - - [Test] - void IsTrue() - { - // Classic syntax - Assert::IsTrue(2+2==4); - - // Helper syntax - Assert::That(2+2==4, Is::True); - Assert::That(2+2==4); - - // Inherited syntax - Expect(2+2==4, True); - Expect(2+2==4); - } - - [Test] - void IsFalse() - { - // Classic syntax - Assert::IsFalse(2+2==5); - - // Helper syntax - Assert::That(2+2==5, Is::False); - - // Inherited syntax - Expect(2+2==5, False); - } - - [Test] - void IsNaN() - { - double d = double::NaN; - float f = float::NaN; - - // Classic syntax - Assert::IsNaN(d); - Assert::IsNaN(f); - - // Helper syntax - Assert::That(d, Is::NaN); - Assert::That(f, Is::NaN); - - // Inherited syntax - Expect(d, NaN); - Expect(f, NaN); - } - - [Test] - void EmptyStringTests() - { - // Classic syntax - Assert::IsEmpty(""); - Assert::IsNotEmpty("Hello!"); - - // Helper syntax - Assert::That("", Is::Empty); - Assert::That("Hello!", Is::Not->Empty); - - // Inherited syntax - Expect("", Empty); - Expect("Hello!", Not->Empty); - } - - [Test] - void EmptyCollectionTests() - { - // Classic syntax - Assert::IsEmpty(gcnew array<bool>(0)); - Assert::IsNotEmpty(gcnew array<int>(3)); - - // Helper syntax - Assert::That(gcnew array<bool>(0), Is::Empty); - Assert::That(gcnew array<int>(3), Is::Not->Empty); - - // Inherited syntax - Expect(gcnew array<bool>(0), Empty); - Expect(gcnew array<int>(3), Not->Empty); - } - - [Test] - void ExactTypeTests() - { - // Classic syntax workarounds) - String^ greeting = "Hello"; - Assert::AreEqual(String::typeid, greeting->GetType()); - Assert::AreEqual("System.String", greeting->GetType()->FullName); - Assert::AreNotEqual(int::typeid, greeting->GetType()); - Assert::AreNotEqual("System.Int32", greeting->GetType()->FullName); - - // Helper syntax - Assert::That(greeting, Is::TypeOf(String::typeid)); - Assert::That(greeting, Is::Not->TypeOf(int::typeid)); - - // Inherited syntax - Expect( "Hello", TypeOf(String::typeid)); - Expect( "Hello", Not->TypeOf(int::typeid)); - } - - [Test] - void InstanceOfTypeTests() - { - // Classic syntax - Assert::IsInstanceOfType(String::typeid, "Hello"); - Assert::IsNotInstanceOfType(String::typeid, 5); - - // Helper syntax - Assert::That("Hello", Is::InstanceOfType(String::typeid)); - Assert::That(5, Is::Not->InstanceOfType(String::typeid)); - - // Inherited syntax - Expect("Hello", InstanceOfType(String::typeid)); - Expect(5, Not->InstanceOfType(String::typeid)); - } - - [Test] - void AssignableFromTypeTests() - { - // Classic syntax - Assert::IsAssignableFrom(String::typeid, "Hello"); - Assert::IsNotAssignableFrom(String::typeid, 5); - - // Helper syntax - Assert::That( "Hello", Is::AssignableFrom(String::typeid)); - Assert::That( 5, Is::Not->AssignableFrom(String::typeid)); - - // Inherited syntax - Expect( "Hello", AssignableFrom(String::typeid)); - Expect( 5, Not->AssignableFrom(String::typeid)); - } - - [Test] - void SubstringTests() - { - String^ phrase = "Hello World!"; - array<String^>^ strings = {"abc", "bad", "dba" }; - - // Classic Syntax - StringAssert::Contains("World", phrase); - - // Helper syntax - Assert::That(phrase, Contains("World")); - // Only available using new syntax - Assert::That(phrase, Text::DoesNotContain("goodbye")); - Assert::That(phrase, Text::Contains("WORLD")->IgnoreCase); - Assert::That(phrase, Text::DoesNotContain("BYE")->IgnoreCase); - Assert::That(strings, Text::All->Contains( "b" ) ); - - // Inherited syntax - Expect(phrase, Contains("World")); - // Only available using new syntax - Expect(phrase, Not->Contains("goodbye")); - Expect(phrase, Contains("WORLD")->IgnoreCase); - Expect(phrase, Not->Contains("BYE")->IgnoreCase); - Expect(strings, All->Contains("b")); - } - - [Test] - void StartsWithTests() - { - String^ phrase = "Hello World!"; - array<String^>^ greetings = { "Hello!", "Hi!", "Hola!" }; - - // Classic syntax - StringAssert::StartsWith("Hello", phrase); - - // Helper syntax - Assert::That(phrase, Text::StartsWith("Hello")); - // Only available using new syntax - Assert::That(phrase, Text::DoesNotStartWith("Hi!")); - Assert::That(phrase, Text::StartsWith("HeLLo")->IgnoreCase); - Assert::That(phrase, Text::DoesNotStartWith("HI")->IgnoreCase); - Assert::That(greetings, Text::All->StartsWith("h")->IgnoreCase); - - // Inherited syntax - Expect(phrase, StartsWith("Hello")); - // Only available using new syntax - Expect(phrase, Not->StartsWith("Hi!")); - Expect(phrase, StartsWith("HeLLo")->IgnoreCase); - Expect(phrase, Not->StartsWith("HI")->IgnoreCase); - Expect(greetings, All->StartsWith("h")->IgnoreCase); - } - - [Test] - void EndsWithTests() - { - String^ phrase = "Hello World!"; - array<String^>^ greetings = { "Hello!", "Hi!", "Hola!" }; - - // Classic Syntax - StringAssert::EndsWith("!", phrase); - - // Helper syntax - Assert::That(phrase, Text::EndsWith("!")); - // Only available using new syntax - Assert::That(phrase, Text::DoesNotEndWith("?")); - Assert::That(phrase, Text::EndsWith("WORLD!")->IgnoreCase); - Assert::That(greetings, Text::All->EndsWith("!")); - - // Inherited syntax - Expect(phrase, EndsWith("!")); - // Only available using new syntax - Expect(phrase, Not->EndsWith("?")); - Expect(phrase, EndsWith("WORLD!")->IgnoreCase); - Expect(greetings, All->EndsWith("!") ); - } - - [Test] - void EqualIgnoringCaseTests() - { - String^ phrase = "Hello World!"; - - // Classic syntax - StringAssert::AreEqualIgnoringCase("hello world!",phrase); - - // Helper syntax - Assert::That(phrase, Is::EqualTo("hello world!")->IgnoreCase); - //Only available using new syntax - Assert::That(phrase, Is::Not->EqualTo("goodbye world!")->IgnoreCase); - Assert::That(gcnew array<String^> { "Hello", "World" }, - Is::EqualTo(gcnew array<Object^> { "HELLO", "WORLD" })->IgnoreCase); - Assert::That(gcnew array<String^> {"HELLO", "Hello", "hello" }, - Is::All->EqualTo( "hello" )->IgnoreCase); - - // Inherited syntax - Expect(phrase, EqualTo("hello world!")->IgnoreCase); - //Only available using new syntax - Expect(phrase, Not->EqualTo("goodbye world!")->IgnoreCase); - Expect(gcnew array<String^> { "Hello", "World" }, - EqualTo(gcnew array<Object^> { "HELLO", "WORLD" })->IgnoreCase); - Expect(gcnew array<String^> {"HELLO", "Hello", "hello" }, - All->EqualTo( "hello" )->IgnoreCase); - } - - [Test] - void RegularExpressionTests() - { - String^ phrase = "Now is the time for all good men to come to the aid of their country."; - array<String^>^ quotes = { "Never say never", "It's never too late", "Nevermore!" }; - - // Classic syntax - StringAssert::IsMatch( "all good men", phrase ); - StringAssert::IsMatch( "Now.*come", phrase ); - - // Helper syntax - Assert::That( phrase, Text::Matches( "all good men" ) ); - Assert::That( phrase, Text::Matches( "Now.*come" ) ); - // Only available using new syntax - Assert::That(phrase, Text::DoesNotMatch("all.*men.*good")); - Assert::That(phrase, Text::Matches("ALL")->IgnoreCase); - Assert::That(quotes, Text::All->Matches("never")->IgnoreCase); - - // Inherited syntax - Expect( phrase, Matches( "all good men" ) ); - Expect( phrase, Matches( "Now.*come" ) ); - // Only available using new syntax - Expect(phrase, Not->Matches("all.*men.*good")); - Expect(phrase, Matches("ALL")->IgnoreCase); - Expect(quotes, All->Matches("never")->IgnoreCase); - } - - [Test] - void EqualityTests() - { - array<int>^ i3 = { 1, 2, 3 }; - array<double>^ d3 = { 1.0, 2.0, 3.0 }; - array<int>^ iunequal = { 1, 3, 2 }; - - // Classic Syntax - Assert::AreEqual(4, 2 + 2); - Assert::AreEqual(i3, d3); - Assert::AreNotEqual(5, 2 + 2); - Assert::AreNotEqual(i3, iunequal); - - // Helper syntax - Assert::That(2 + 2, Is::EqualTo(4)); - Assert::That(2 + 2 == 4); - Assert::That(i3, Is::EqualTo(d3)); - Assert::That(2 + 2, Is::Not->EqualTo(5)); - Assert::That(i3, Is::Not->EqualTo(iunequal)); - - // Inherited syntax - Expect(2 + 2, EqualTo(4)); - Expect(2 + 2 == 4); - Expect(i3, EqualTo(d3)); - Expect(2 + 2, Not->EqualTo(5)); - Expect(i3, Not->EqualTo(iunequal)); - } - - [Test] - void EqualityTestsWithTolerance() - { - // CLassic syntax - Assert::AreEqual(5.0, 4.99, 0.05); - Assert::AreEqual(5.0F, 4.99F, 0.05F); - - // Helper syntax - Assert::That(4.99L, Is::EqualTo(5.0L)->Within(0.05L)); - Assert::That(4.99f, Is::EqualTo(5.0f)->Within(0.05f)); - - // Inherited syntax - Expect(4.99L, EqualTo(5.0L)->Within(0.05L)); - Expect(4.99f, EqualTo(5.0f)->Within(0.05f)); - } - - [Test] - void ComparisonTests() - { - // Classic Syntax - Assert::Greater(7, 3); - Assert::GreaterOrEqual(7, 3); - Assert::GreaterOrEqual(7, 7); - - // Helper syntax - Assert::That(7, Is::GreaterThan(3)); - Assert::That(7, Is::GreaterThanOrEqualTo(3)); - Assert::That(7, Is::AtLeast(3)); - Assert::That(7, Is::GreaterThanOrEqualTo(7)); - Assert::That(7, Is::AtLeast(7)); - - // Inherited syntax - Expect(7, GreaterThan(3)); - Expect(7, GreaterThanOrEqualTo(3)); - Expect(7, AtLeast(3)); - Expect(7, GreaterThanOrEqualTo(7)); - Expect(7, AtLeast(7)); - - // Classic syntax - Assert::Less(3, 7); - Assert::LessOrEqual(3, 7); - Assert::LessOrEqual(3, 3); - - // Helper syntax - Assert::That(3, Is::LessThan(7)); - Assert::That(3, Is::LessThanOrEqualTo(7)); - Assert::That(3, Is::AtMost(7)); - Assert::That(3, Is::LessThanOrEqualTo(3)); - Assert::That(3, Is::AtMost(3)); - - // Inherited syntax - Expect(3, LessThan(7)); - Expect(3, LessThanOrEqualTo(7)); - Expect(3, AtMost(7)); - Expect(3, LessThanOrEqualTo(3)); - Expect(3, AtMost(3)); - } - - [Test] - void AllItemsTests() - { - array<Object^>^ ints = { 1, 2, 3, 4 }; - array<Object^>^ strings = { "abc", "bad", "cab", "bad", "dad" }; - - // Classic syntax - CollectionAssert::AllItemsAreNotNull(ints); - CollectionAssert::AllItemsAreInstancesOfType(ints, int::typeid); - CollectionAssert::AllItemsAreInstancesOfType(strings, String::typeid); - CollectionAssert::AllItemsAreUnique(ints); - - // Helper syntax - Assert::That(ints, Is::All->Not->Null); - Assert::That(ints, Is::All->InstanceOfType(int::typeid)); - Assert::That(strings, Is::All->InstanceOfType(String::typeid)); - Assert::That(ints, Is::Unique); - // Only available using new syntax - Assert::That(strings, Is::Not->Unique); - Assert::That(ints, Is::All->GreaterThan(0)); - Assert::That(strings, Text::All->Contains( "a" ) ); - Assert::That(strings, Has::Some->StartsWith( "ba" ) ); - - // Inherited syntax - Expect(ints, All->Not->Null); - Expect(ints, All->InstanceOfType(int::typeid)); - Expect(strings, All->InstanceOfType(String::typeid)); - Expect(ints, Unique); - // Only available using new syntax - Expect(strings, Not->Unique); - Expect(ints, All->GreaterThan(0)); - Expect(strings, All->Contains( "a" ) ); - Expect(strings, Some->StartsWith( "ba" ) ); - } - - [Test] - void SomeItemsTests() - { - array<Object^>^ mixed = { 1, 2, "3", nullptr, "four", 100 }; - array<Object^>^ strings = { "abc", "bad", "cab", "bad", "dad" }; - - // Not available using the classic syntax - - // Helper syntax - Assert::That(mixed, Has::Some->Null); - Assert::That(mixed, Has::Some->InstanceOfType(int::typeid)); - Assert::That(mixed, Has::Some->InstanceOfType(String::typeid)); - Assert::That(strings, Has::Some->StartsWith( "ba" ) ); - Assert::That(strings, Has::Some->Not->StartsWith( "ba" ) ); - - // Inherited syntax - Expect(mixed, Some->Null); - Expect(mixed, Some->InstanceOfType(int::typeid)); - Expect(mixed, Some->InstanceOfType(String::typeid)); - Expect(strings, Some->StartsWith( "ba" ) ); - Expect(strings, Some->Not->StartsWith( "ba" ) ); - } - - [Test] - void NoItemsTests() - { - array<Object^>^ ints = { 1, 2, 3, 4, 5 }; - array<Object^>^ strings = { "abc", "bad", "cab", "bad", "dad" }; - - // Not available using the classic syntax - - // Helper syntax - Assert::That(ints, Has::None->Null); - Assert::That(ints, Has::None->InstanceOfType(String::typeid)); - Assert::That(ints, Has::None->GreaterThan(99)); - Assert::That(strings, Has::None->StartsWith( "qu" ) ); - - // Inherited syntax - Expect(ints, None->Null); - Expect(ints, None->InstanceOfType(String::typeid)); - Expect(ints, None->GreaterThan(99)); - Expect(strings, None->StartsWith( "qu" ) ); - } - - [Test] - void CollectionContainsTests() - { - array<int>^ iarray = { 1, 2, 3 }; - array<String^>^ sarray = { "a", "b", "c" }; - - // Classic syntax - Assert::Contains(3, iarray); - Assert::Contains("b", sarray); - CollectionAssert::Contains(iarray, 3); - CollectionAssert::Contains(sarray, "b"); - CollectionAssert::DoesNotContain(sarray, "x"); - - // Helper syntax - Assert::That(iarray, Has::Member(3)); - Assert::That(sarray, Has::Member("b")); - Assert::That(sarray, Has::No->Member("x")); // Yuck! - Assert::That(sarray, !Has::Member("x")); - - // Inherited syntax - Expect(iarray, Contains(3)); - Expect(sarray, Contains("b")); - Expect(sarray, Not->Contains("x")); - Expect(sarray, !Contains("x")); - } - - [Test] - void CollectionEquivalenceTests() - { - array<int>^ ints1to5 = { 1, 2, 3, 4, 5 }; - - // Classic syntax - CollectionAssert::AreEquivalent(gcnew array<int> { 2, 1, 4, 3, 5 }, ints1to5); - CollectionAssert::AreNotEquivalent(gcnew array<int> { 2, 2, 4, 3, 5 }, ints1to5); - CollectionAssert::AreNotEquivalent(gcnew array<int> { 2, 4, 3, 5 }, ints1to5); - CollectionAssert::AreNotEquivalent(gcnew array<int> { 2, 2, 1, 1, 4, 3, 5 }, ints1to5); - - // Helper syntax - Assert::That(gcnew array<int> { 2, 1, 4, 3, 5 }, Is::EquivalentTo(ints1to5)); - Assert::That(gcnew array<int> { 2, 2, 4, 3, 5 }, Is::Not->EquivalentTo(ints1to5)); - Assert::That(gcnew array<int> { 2, 4, 3, 5 }, Is::Not->EquivalentTo(ints1to5)); - Assert::That(gcnew array<int> { 2, 2, 1, 1, 4, 3, 5 }, Is::Not->EquivalentTo(ints1to5)); - - // Inherited syntax - Expect(gcnew array<int> { 2, 1, 4, 3, 5 }, EquivalentTo(ints1to5)); - Expect(gcnew array<int> { 2, 2, 4, 3, 5 }, Not->EquivalentTo(ints1to5)); - Expect(gcnew array<int> { 2, 4, 3, 5 }, Not->EquivalentTo(ints1to5)); - Expect(gcnew array<int> { 2, 2, 1, 1, 4, 3, 5 }, Not->EquivalentTo(ints1to5)); - } - - [Test] - void SubsetTests() - { - array<int>^ ints1to5 = { 1, 2, 3, 4, 5 }; - - // Classic syntax - CollectionAssert::IsSubsetOf(gcnew array<int> { 1, 3, 5 }, ints1to5); - CollectionAssert::IsSubsetOf(gcnew array<int> { 1, 2, 3, 4, 5 }, ints1to5); - CollectionAssert::IsNotSubsetOf(gcnew array<int> { 2, 4, 6 }, ints1to5); - CollectionAssert::IsNotSubsetOf(gcnew array<int> { 1, 2, 2, 2, 5 }, ints1to5); - - // Helper syntax - Assert::That(gcnew array<int> { 1, 3, 5 }, Is::SubsetOf(ints1to5)); - Assert::That(gcnew array<int> { 1, 2, 3, 4, 5 }, Is::SubsetOf(ints1to5)); - Assert::That(gcnew array<int> { 2, 4, 6 }, Is::Not->SubsetOf(ints1to5)); - Assert::That(gcnew array<int> { 1, 2, 2, 2, 5 }, Is::Not->SubsetOf(ints1to5)); - - // Inherited syntax - Expect(gcnew array<int> { 1, 3, 5 }, SubsetOf(ints1to5)); - Expect(gcnew array<int> { 1, 2, 3, 4, 5 }, SubsetOf(ints1to5)); - Expect(gcnew array<int> { 2, 4, 6 }, Not->SubsetOf(ints1to5)); - Expect(gcnew array<int> { 1, 2, 2, 2, 5 }, Not->SubsetOf(ints1to5)); - } - - [Test] - void PropertyTests() - { - array<String^>^ strings = { "abc", "bca", "xyz" }; - - // Helper syntax - Assert::That( "Hello", Has::Property("Length")->EqualTo(5) ); - Assert::That( "Hello", Has::Length->EqualTo( 5 ) ); - Assert::That( strings , Has::All->Property( "Length")->EqualTo(3) ); - Assert::That( strings, Has::All->Length->EqualTo( 3 ) ); - - // Inherited syntax - Expect( "Hello", Property("Length")->EqualTo(5) ); - Expect( "Hello", Length->EqualTo( 5 ) ); - Expect( strings, All->Property("Length")->EqualTo(3) ); - Expect( strings, All->Length->EqualTo( 3 ) ); - } - - [Test] - void NotTests() - { - // Not available using the classic syntax - - // Helper syntax - Assert::That(42, Is::Not->Null); - Assert::That(42, Is::Not->True); - Assert::That(42, Is::Not->False); - Assert::That(2.5, Is::Not->NaN); - Assert::That(2 + 2, Is::Not->EqualTo(3)); - Assert::That(2 + 2, Is::Not->Not->EqualTo(4)); - Assert::That(2 + 2, Is::Not->Not->Not->EqualTo(5)); - - // Inherited syntax - Expect(42, Not->Null); - Expect(42, Not->True); - Expect(42, Not->False); - Expect(2.5, Not->NaN); - Expect(2 + 2, Not->EqualTo(3)); - Expect(2 + 2, Not->Not->EqualTo(4)); - Expect(2 + 2, Not->Not->Not->EqualTo(5)); - } - - [Test] - void NotOperator() - { - // The ! operator is only available in the new syntax - Assert::That(42, !Is::Null); - // Inherited syntax - Expect( 42, !Null ); - } - - [Test] - void AndOperator() - { - // The & operator is only available in the new syntax - Assert::That(7, Is::GreaterThan(5) & Is::LessThan(10)); - // Inherited syntax - Expect( 7, GreaterThan(5) & LessThan(10)); - } - - [Test] - void OrOperator() - { - // The | operator is only available in the new syntax - Assert::That(3, Is::LessThan(5) | Is::GreaterThan(10)); - Expect( 3, LessThan(5) | GreaterThan(10)); - } - - [Test] - void ComplexTests() - { - Assert::That(7, Is::Not->Null & Is::Not->LessThan(5) & Is::Not->GreaterThan(10)); - Expect(7, Not->Null & Not->LessThan(5) & Not->GreaterThan(10)); - - Assert::That(7, !Is::Null & !Is::LessThan(5) & !Is::GreaterThan(10)); - Expect(7, !Null & !LessThan(5) & !GreaterThan(10)); - } - - // This method contains assertions that should not compile - // You can check by uncommenting it. - //void WillNotCompile() - //{ - // Assert::That(42, Is::Not); - // Assert::That(42, Is::All); - // Assert::That(42, Is::Null->Not); - // Assert::That(42, Is::Not->Null->GreaterThan(10)); - // Assert::That(42, Is::GreaterThan(10)->LessThan(99)); - - // object[] c = new object[0]; - // Assert::That(c, Is::Null->All); - // Assert::That(c, Is::Not->All); - // Assert::That(c, Is::All->Not); - //} - }; -}
\ No newline at end of file diff --git a/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.vcproj b/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.vcproj deleted file mode 100644 index ff1efe8..0000000 --- a/tools/NUnit/samples/cpp/cpp-cli/syntax/cpp-cli-syntax.vcproj +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="cpp-cli-syntax" - ProjectGUID="{72448C2D-17C9-419E-B28D-3B533E7E0CD5}" - RootNamespace="cppclisyntax" - Keyword="ManagedCProj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - ManagedExtensions="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG" - RuntimeLibrary="3" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(NoInherit)" - LinkIncremental="2" - GenerateDebugInformation="true" - AssemblyDebug="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - ManagedExtensions="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - PreprocessorDefinitions="WIN32;NDEBUG" - RuntimeLibrary="2" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(NoInherit)" - LinkIncremental="1" - GenerateDebugInformation="true" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - <AssemblyReference - RelativePath="System.dll" - AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" - /> - <AssemblyReference - RelativePath="..\..\..\..\solutions\vs2005\NUnitFramework\framework\bin\Debug\nunit.framework.dll" - AssemblyName="nunit.framework, Version=2.5.0.0, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" - /> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\cpp-cli-syntax.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/tools/NUnit/samples/cpp/managed/failures/AssemblyInfo.cpp b/tools/NUnit/samples/cpp/managed/failures/AssemblyInfo.cpp deleted file mode 100644 index e64d6ee..0000000 --- a/tools/NUnit/samples/cpp/managed/failures/AssemblyInfo.cpp +++ /dev/null @@ -1,56 +0,0 @@ -using namespace System::Reflection; -using namespace 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:AssemblyTitleAttribute("")]; -[assembly:AssemblyDescriptionAttribute("")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("")]; -[assembly:AssemblyProductAttribute("")]; -[assembly:AssemblyCopyrightAttribute("")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the value or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly:AssemblyVersionAttribute("2.2.0.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 directory. -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly:AssemblyDelaySignAttribute(false)]; -[assembly:AssemblyKeyFileAttribute("")]; -[assembly:AssemblyKeyNameAttribute("")]; - diff --git a/tools/NUnit/samples/cpp/managed/failures/cpp-managed-failures.build b/tools/NUnit/samples/cpp/managed/failures/cpp-managed-failures.build deleted file mode 100644 index 5bf96a1..0000000 --- a/tools/NUnit/samples/cpp/managed/failures/cpp-managed-failures.build +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<project name="cpp-managed-failures" default="build"> - - <include buildfile="../../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.cpp" /> - <include name="cppsample.cpp" /> - <include name="cppsample.h" /> - </patternset> - - <target name="packagex"> - <copy todir="${package.samples.dir}/cpp/managed/failures"> - <fileset basedir="."> - <include name="cpp-managed-failures.build" /> - <include name="AssemblyInfo.cpp" /> - <include name="cppsample.cpp" /> - <include name="cppsample.h" /> - </fileset> - </copy> - - <copy todir="${package.samples.dir}/cpp/managed/failures" - file="./cpp-managed-failures.vcproj"> - <filterchain> - <replacestring from="$(SolutionDir)..\..\..\src\NUnitFramework\framework\bin\Debug\nunit.framework.dll" - to="..\..\..\..\bin\nunit.framework.dll"/> - </filterchain> - </copy> - </target> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/cpp/managed/failures/cpp-managed-failures.vcproj b/tools/NUnit/samples/cpp/managed/failures/cpp-managed-failures.vcproj deleted file mode 100644 index ec3e599..0000000 --- a/tools/NUnit/samples/cpp/managed/failures/cpp-managed-failures.vcproj +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="7.10" - Name="cpp-managed-failures" - ProjectGUID="{7E5849C7-0469-4AD2-91B9-C87203934254}" - Keyword="ManagedCProj"> - <Platforms> - <Platform - Name="Win32"/> - </Platforms> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" - ConfigurationType="2" - CharacterSet="2" - ManagedExtensions="TRUE" - ReferencesPath=""D:\Dev\NUnit\nunit-2.5\solutions\vs2005\NUnitFramework\framework\bin\Release""> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalUsingDirectories="" - PreprocessorDefinitions="WIN32;_DEBUG" - MinimalRebuild="FALSE" - BasicRuntimeChecks="0" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - OutputFile="$(OutDir)/managed-cpp-failures.dll" - LinkIncremental="2" - GenerateDebugInformation="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="2" - CharacterSet="2" - ManagedExtensions="TRUE" - ReferencesPath=""D:\Dev\NUnit\nunit-2.5\solutions\vs2005\NUnitFramework\framework\bin\Release""> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="1" - AdditionalUsingDirectories="..\..\src\NUnitFramework\framework\bin\Release;..\..\src\NUnitFramework\framework\bin\Debug" - PreprocessorDefinitions="WIN32;NDEBUG" - MinimalRebuild="FALSE" - UsePrecompiledHeader="0" - WarningLevel="3"/> - <Tool - Name="VCCustomBuildTool"/> - <Tool - Name="VCLinkerTool" - OutputFile="$(OutDir)/managed-cpp-failures.dll" - LinkIncremental="1" - GenerateDebugInformation="TRUE"/> - <Tool - Name="VCMIDLTool"/> - <Tool - Name="VCPostBuildEventTool"/> - <Tool - Name="VCPreBuildEventTool"/> - <Tool - Name="VCPreLinkEventTool"/> - <Tool - Name="VCResourceCompilerTool"/> - <Tool - Name="VCWebServiceProxyGeneratorTool"/> - <Tool - Name="VCXMLDataGeneratorTool"/> - <Tool - Name="VCWebDeploymentTool"/> - <Tool - Name="VCManagedWrapperGeneratorTool"/> - <Tool - Name="VCAuxiliaryManagedWrapperGeneratorTool"/> - </Configuration> - </Configurations> - <References> - <AssemblyReference - RelativePath="mscorlib.dll"/> - <AssemblyReference - RelativePath="$(SolutionDir)..\..\bin\nunit.framework.dll"/> - <AssemblyReference - RelativePath="System.dll"/> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm"> - <File - RelativePath="AssemblyInfo.cpp"> - </File> - <File - RelativePath="cppsample.cpp"> - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc"> - <File - RelativePath="cppsample.h"> - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;r"> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/tools/NUnit/samples/cpp/managed/failures/cppsample.cpp b/tools/NUnit/samples/cpp/managed/failures/cppsample.cpp deleted file mode 100644 index dac7156..0000000 --- a/tools/NUnit/samples/cpp/managed/failures/cppsample.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// **************************************************************** -// 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. -// **************************************************************** - -#include "cppsample.h" - -namespace NUnitSamples { - - void SimpleCPPSample::Init() { - fValue1 = 2; - fValue2 = 3; - } - - void SimpleCPPSample::Add() { - int result = fValue1 + fValue2; - Assert::AreEqual(6,result); - } - - void SimpleCPPSample::DivideByZero() - { - int zero= 0; - int result= 8/zero; - } - - void SimpleCPPSample::Equals() { - Assert::AreEqual(12, 12, "Integer"); - Assert::AreEqual(12L, 12L, "Long"); - Assert::AreEqual('a', 'a', "Char"); - - - Assert::AreEqual(12, 13, "Expected Failure (Integer)"); - Assert::AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double)"); - } - - void SimpleCPPSample::IgnoredTest() - { - throw new InvalidCastException(); - } - - void SimpleCPPSample::ExpectAnException() - { - throw new InvalidCastException(); - } - -} - diff --git a/tools/NUnit/samples/cpp/managed/failures/cppsample.h b/tools/NUnit/samples/cpp/managed/failures/cppsample.h deleted file mode 100644 index 4e47439..0000000 --- a/tools/NUnit/samples/cpp/managed/failures/cppsample.h +++ /dev/null @@ -1,28 +0,0 @@ -// **************************************************************** -// 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. -// **************************************************************** - -#pragma once - -using namespace System; -using namespace NUnit::Framework; - -namespace NUnitSamples -{ - [TestFixture] - public __gc class SimpleCPPSample - { - int fValue1; - int fValue2; - public: - [SetUp] void Init(); - - [Test] void Add(); - [Test] void DivideByZero(); - [Test] void Equals(); - [Test] [Ignore("ignored test")] void IgnoredTest(); - [Test] [ExpectedException(__typeof(InvalidOperationException))] void ExpectAnException(); - }; -} diff --git a/tools/NUnit/samples/cpp/managed/managed-cpp.sln b/tools/NUnit/samples/cpp/managed/managed-cpp.sln deleted file mode 100644 index 4462fb0..0000000 --- a/tools/NUnit/samples/cpp/managed/managed-cpp.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-managed-failures", "failures\cpp-managed-failures.vcproj", "{7E5849C7-0469-4AD2-91B9-C87203934254}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {7E5849C7-0469-4AD2-91B9-C87203934254}.Debug.ActiveCfg = Debug|Win32 - {7E5849C7-0469-4AD2-91B9-C87203934254}.Debug.Build.0 = Debug|Win32 - {7E5849C7-0469-4AD2-91B9-C87203934254}.Release.ActiveCfg = Release|Win32 - {7E5849C7-0469-4AD2-91B9-C87203934254}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/tools/NUnit/samples/csharp/CSharp.sln b/tools/NUnit/samples/csharp/CSharp.sln deleted file mode 100644 index ed95f8a..0000000 --- a/tools/NUnit/samples/csharp/CSharp.sln +++ /dev/null @@ -1,37 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cs-failures", "failures\cs-failures.csproj", "{15D66EEE-A852-4A52-89C2-83E74ECF3770}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cs-money", "money\cs-money.csproj", "{11EDF872-A04D-4F75-A1BF-71168DC86AF3}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cs-syntax", "syntax\cs-syntax.csproj", "{06F46FA2-687B-4B46-A912-C1B0B4CC1B20}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {15D66EEE-A852-4A52-89C2-83E74ECF3770}.Debug.ActiveCfg = Debug|.NET - {15D66EEE-A852-4A52-89C2-83E74ECF3770}.Debug.Build.0 = Debug|.NET - {15D66EEE-A852-4A52-89C2-83E74ECF3770}.Release.ActiveCfg = Release|.NET - {15D66EEE-A852-4A52-89C2-83E74ECF3770}.Release.Build.0 = Release|.NET - {11EDF872-A04D-4F75-A1BF-71168DC86AF3}.Debug.ActiveCfg = Debug|.NET - {11EDF872-A04D-4F75-A1BF-71168DC86AF3}.Debug.Build.0 = Debug|.NET - {11EDF872-A04D-4F75-A1BF-71168DC86AF3}.Release.ActiveCfg = Release|.NET - {11EDF872-A04D-4F75-A1BF-71168DC86AF3}.Release.Build.0 = Release|.NET - {06F46FA2-687B-4B46-A912-C1B0B4CC1B20}.Debug.ActiveCfg = Debug|.NET - {06F46FA2-687B-4B46-A912-C1B0B4CC1B20}.Debug.Build.0 = Debug|.NET - {06F46FA2-687B-4B46-A912-C1B0B4CC1B20}.Release.ActiveCfg = Release|.NET - {06F46FA2-687B-4B46-A912-C1B0B4CC1B20}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/tools/NUnit/samples/csharp/failures/AssemblyInfo.cs b/tools/NUnit/samples/csharp/failures/AssemblyInfo.cs deleted file mode 100644 index 67e65b0..0000000 --- a/tools/NUnit/samples/csharp/failures/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -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("csharp.sample.dll")] -[assembly: AssemblyDescription("C# Sample Unit Tests")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("NUnit")] -[assembly: AssemblyProduct("NUnit")] -[assembly: AssemblyCopyright("Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. \nCopyright (C) 2000-2003 Philip Craig.\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.2.0.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/tools/NUnit/samples/csharp/failures/CSharpTest.cs b/tools/NUnit/samples/csharp/failures/CSharpTest.cs deleted file mode 100644 index 0ab0fe6..0000000 --- a/tools/NUnit/samples/csharp/failures/CSharpTest.cs +++ /dev/null @@ -1,85 +0,0 @@ -// **************************************************************** -// 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.Samples -{ - using System; - using NUnit.Framework; - - /// <summary>Some simple Tests.</summary> - /// - [TestFixture] - public class SimpleCSharpTest - { - /// <summary> - /// - /// </summary> - protected int fValue1; - /// <summary> - /// - /// </summary> - protected int fValue2; - - /// <summary> - /// - /// </summary> - [SetUp] public void Init() - { - fValue1= 2; - fValue2= 3; - } - - /// <summary> - /// - /// </summary> - /// - [Test] public void Add() - { - double result= fValue1 + fValue2; - // forced failure result == 5 - Assert.AreEqual(6, result, "Expected Failure."); - } - - /// <summary> - /// - /// </summary> - /// - [Test] public void DivideByZero() - { - int zero= 0; - int result= 8/zero; - } - - /// <summary> - /// - /// </summary> - /// - [Test] public void Equals() - { - Assert.AreEqual(12, 12, "Integer"); - Assert.AreEqual(12L, 12L, "Long"); - Assert.AreEqual('a', 'a', "Char"); - Assert.AreEqual((object)12, (object)12, "Integer Object Cast"); - - Assert.AreEqual(12, 13, "Expected Failure (Integer)"); - Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double)."); - } - - [Test] - [ExpectedException(typeof(InvalidOperationException))] - public void ExpectAnException() - { - throw new InvalidCastException(); - } - - [Test] - [Ignore("ignored test")] - public void IgnoredTest() - { - throw new Exception(); - } - } -}
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/failures/cs-failures.build b/tools/NUnit/samples/csharp/failures/cs-failures.build deleted file mode 100644 index ea71419..0000000 --- a/tools/NUnit/samples/csharp/failures/cs-failures.build +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<project name="cs-failures" default="build"> - - <include buildfile="../../samples.common"/> - - <patternset id="source-files"> - <include name="AssemblyInfo.cs" /> - <include name="CSharpTest.cs" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/failures/cs-failures.csproj b/tools/NUnit/samples/csharp/failures/cs-failures.csproj deleted file mode 100644 index e66e6d4..0000000 --- a/tools/NUnit/samples/csharp/failures/cs-failures.csproj +++ /dev/null @@ -1,20 +0,0 @@ -<VisualStudioProject> - <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{15D66EEE-A852-4A52-89C2-83E74ECF3770}"> - <Build> - <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="cs-failures" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="csharp_sample" 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" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.cs" SubType="Code" BuildAction="Compile" /> - <File RelPath="CSharpTest.cs" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/money/AssemblyInfo.cs b/tools/NUnit/samples/csharp/money/AssemblyInfo.cs deleted file mode 100644 index 72a1771..0000000 --- a/tools/NUnit/samples/csharp/money/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -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("2.2.0.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/tools/NUnit/samples/csharp/money/IMoney.cs b/tools/NUnit/samples/csharp/money/IMoney.cs deleted file mode 100644 index 9b3fd35..0000000 --- a/tools/NUnit/samples/csharp/money/IMoney.cs +++ /dev/null @@ -1,37 +0,0 @@ -// **************************************************************** -// 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.Samples.Money -{ - - /// <summary>The common interface for simple Monies and MoneyBags.</summary> - interface IMoney - { - - /// <summary>Adds a money to this money.</summary> - IMoney Add(IMoney m); - - /// <summary>Adds a simple Money to this money. This is a helper method for - /// implementing double dispatch.</summary> - IMoney AddMoney(Money m); - - /// <summary>Adds a MoneyBag to this money. This is a helper method for - /// implementing double dispatch.</summary> - IMoney AddMoneyBag(MoneyBag s); - - /// <value>True if this money is zero.</value> - bool IsZero { get; } - - /// <summary>Multiplies a money by the given factor.</summary> - IMoney Multiply(int factor); - - /// <summary>Negates this money.</summary> - IMoney Negate(); - - /// <summary>Subtracts a money from this money.</summary> - IMoney Subtract(IMoney m); - } -} diff --git a/tools/NUnit/samples/csharp/money/Money.cs b/tools/NUnit/samples/csharp/money/Money.cs deleted file mode 100644 index 2e2de93..0000000 --- a/tools/NUnit/samples/csharp/money/Money.cs +++ /dev/null @@ -1,103 +0,0 @@ -// **************************************************************** -// 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.Samples.Money -{ - - using System; - using System.Text; - - /// <summary>A simple Money.</summary> - class Money: IMoney - { - - private int fAmount; - private String fCurrency; - - /// <summary>Constructs a money from the given amount and - /// currency.</summary> - public Money(int amount, String currency) - { - fAmount= amount; - fCurrency= currency; - } - - /// <summary>Adds a money to this money. Forwards the request to - /// the AddMoney helper.</summary> - public IMoney Add(IMoney m) - { - return m.AddMoney(this); - } - - public IMoney AddMoney(Money m) - { - if (m.Currency.Equals(Currency) ) - return new Money(Amount+m.Amount, Currency); - return new MoneyBag(this, m); - } - - public IMoney AddMoneyBag(MoneyBag s) - { - return s.AddMoney(this); - } - - public int Amount - { - get { return fAmount; } - } - - public String Currency - { - get { return fCurrency; } - } - - public override bool Equals(Object anObject) - { - if (IsZero) - if (anObject is IMoney) - return ((IMoney)anObject).IsZero; - if (anObject is Money) - { - Money aMoney= (Money)anObject; - return aMoney.Currency.Equals(Currency) - && Amount == aMoney.Amount; - } - return false; - } - - public override int GetHashCode() - { - return fCurrency.GetHashCode()+fAmount; - } - - public bool IsZero - { - get { return Amount == 0; } - } - - public IMoney Multiply(int factor) - { - return new Money(Amount*factor, Currency); - } - - public IMoney Negate() - { - return new Money(-Amount, Currency); - } - - public IMoney Subtract(IMoney m) - { - return Add(m.Negate()); - } - - public override String ToString() - { - StringBuilder buffer = new StringBuilder(); - buffer.Append("["+Amount+" "+Currency+"]"); - return buffer.ToString(); - } - } -} diff --git a/tools/NUnit/samples/csharp/money/MoneyBag.cs b/tools/NUnit/samples/csharp/money/MoneyBag.cs deleted file mode 100644 index 45b9442..0000000 --- a/tools/NUnit/samples/csharp/money/MoneyBag.cs +++ /dev/null @@ -1,174 +0,0 @@ -// **************************************************************** -// 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.Samples.Money -{ - - using System; - using System.Collections; - using System.Text; - - /// <summary>A MoneyBag defers exchange rate conversions.</summary> - /// <remarks>For example adding - /// 12 Swiss Francs to 14 US Dollars is represented as a bag - /// containing the two Monies 12 CHF and 14 USD. Adding another - /// 10 Swiss francs gives a bag with 22 CHF and 14 USD. Due to - /// the deferred exchange rate conversion we can later value a - /// MoneyBag with different exchange rates. - /// - /// A MoneyBag is represented as a list of Monies and provides - /// different constructors to create a MoneyBag.</remarks> - class MoneyBag: IMoney - { - private ArrayList fMonies= new ArrayList(5); - - private MoneyBag() - { - } - public MoneyBag(Money[] bag) - { - for (int i= 0; i < bag.Length; i++) - { - if (!bag[i].IsZero) - AppendMoney(bag[i]); - } - } - public MoneyBag(Money m1, Money m2) - { - AppendMoney(m1); - AppendMoney(m2); - } - public MoneyBag(Money m, MoneyBag bag) - { - AppendMoney(m); - AppendBag(bag); - } - public MoneyBag(MoneyBag m1, MoneyBag m2) - { - AppendBag(m1); - AppendBag(m2); - } - public IMoney Add(IMoney m) - { - return m.AddMoneyBag(this); - } - public IMoney AddMoney(Money m) - { - return (new MoneyBag(m, this)).Simplify(); - } - public IMoney AddMoneyBag(MoneyBag s) - { - return (new MoneyBag(s, this)).Simplify(); - } - private void AppendBag(MoneyBag aBag) - { - foreach (Money m in aBag.fMonies) - AppendMoney(m); - } - private void AppendMoney(Money aMoney) - { - IMoney old= FindMoney(aMoney.Currency); - if (old == null) - { - fMonies.Add(aMoney); - return; - } - fMonies.Remove(old); - IMoney sum= old.Add(aMoney); - if (sum.IsZero) - return; - fMonies.Add(sum); - } - private bool Contains(Money aMoney) - { - Money m= FindMoney(aMoney.Currency); - return m.Amount == aMoney.Amount; - } - public override bool Equals(Object anObject) - { - if (IsZero) - if (anObject is IMoney) - return ((IMoney)anObject).IsZero; - - if (anObject is MoneyBag) - { - MoneyBag aMoneyBag= (MoneyBag)anObject; - if (aMoneyBag.fMonies.Count != fMonies.Count) - return false; - - foreach (Money m in fMonies) - { - if (!aMoneyBag.Contains(m)) - return false; - } - return true; - } - return false; - } - private Money FindMoney(String currency) - { - foreach (Money m in fMonies) - { - if (m.Currency.Equals(currency)) - return m; - } - return null; - } - public override int GetHashCode() - { - int hash= 0; - foreach (Money m in fMonies) - { - hash^= m.GetHashCode(); - } - return hash; - } - public bool IsZero - { - get { return fMonies.Count == 0; } - } - public IMoney Multiply(int factor) - { - MoneyBag result= new MoneyBag(); - if (factor != 0) - { - foreach (Money m in fMonies) - { - result.AppendMoney((Money)m.Multiply(factor)); - } - } - return result; - } - public IMoney Negate() - { - MoneyBag result= new MoneyBag(); - foreach (Money m in fMonies) - { - result.AppendMoney((Money)m.Negate()); - } - return result; - } - private IMoney Simplify() - { - if (fMonies.Count == 1) - return (IMoney)fMonies[0]; - return this; - } - public IMoney Subtract(IMoney m) - { - return Add(m.Negate()); - } - public override String ToString() - { - StringBuilder buffer = new StringBuilder(); - buffer.Append("{"); - foreach (Money m in fMonies) - buffer.Append(m); - buffer.Append("}"); - return buffer.ToString(); - } - } -} diff --git a/tools/NUnit/samples/csharp/money/MoneyTest.cs b/tools/NUnit/samples/csharp/money/MoneyTest.cs deleted file mode 100644 index 603dcf8..0000000 --- a/tools/NUnit/samples/csharp/money/MoneyTest.cs +++ /dev/null @@ -1,321 +0,0 @@ -// **************************************************************** -// 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.Samples.Money -{ - using System; - using NUnit.Framework; - /// <summary> - /// - /// </summary> - /// - [TestFixture] - public class MoneyTest - { - private Money f12CHF; - private Money f14CHF; - private Money f7USD; - private Money f21USD; - - private MoneyBag fMB1; - private MoneyBag fMB2; - - /// <summary> - /// - /// </summary> - /// - [SetUp] - protected void SetUp() - { - f12CHF= new Money(12, "CHF"); - f14CHF= new Money(14, "CHF"); - f7USD= new Money( 7, "USD"); - f21USD= new Money(21, "USD"); - - fMB1= new MoneyBag(f12CHF, f7USD); - fMB2= new MoneyBag(f14CHF, f21USD); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void BagMultiply() - { - // {[12 CHF][7 USD]} *2 == {[24 CHF][14 USD]} - Money[] bag = { new Money(24, "CHF"), new Money(14, "USD") }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, fMB1.Multiply(2)); - Assert.AreEqual(fMB1, fMB1.Multiply(1)); - Assert.IsTrue(fMB1.Multiply(0).IsZero); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void BagNegate() - { - // {[12 CHF][7 USD]} negate == {[-12 CHF][-7 USD]} - Money[] bag= { new Money(-12, "CHF"), new Money(-7, "USD") }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, fMB1.Negate()); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void BagSimpleAdd() - { - // {[12 CHF][7 USD]} + [14 CHF] == {[26 CHF][7 USD]} - Money[] bag= { new Money(26, "CHF"), new Money(7, "USD") }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, fMB1.Add(f14CHF)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void BagSubtract() - { - // {[12 CHF][7 USD]} - {[14 CHF][21 USD] == {[-2 CHF][-14 USD]} - Money[] bag= { new Money(-2, "CHF"), new Money(-14, "USD") }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, fMB1.Subtract(fMB2)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void BagSumAdd() - { - // {[12 CHF][7 USD]} + {[14 CHF][21 USD]} == {[26 CHF][28 USD]} - Money[] bag= { new Money(26, "CHF"), new Money(28, "USD") }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, fMB1.Add(fMB2)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void IsZero() - { - Assert.IsTrue(fMB1.Subtract(fMB1).IsZero); - - Money[] bag = { new Money(0, "CHF"), new Money(0, "USD") }; - Assert.IsTrue(new MoneyBag(bag).IsZero); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void MixedSimpleAdd() - { - // [12 CHF] + [7 USD] == {[12 CHF][7 USD]} - Money[] bag= { f12CHF, f7USD }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, f12CHF.Add(f7USD)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void MoneyBagEquals() - { - //NOTE: Normally we use Assert.AreEqual to test whether two - // objects are equal. But here we are testing the MoneyBag.Equals() - // method itself, so using AreEqual would not serve the purpose. - Assert.IsFalse(fMB1.Equals(null)); - - Assert.IsTrue(fMB1.Equals( fMB1 )); - MoneyBag equal= new MoneyBag(new Money(12, "CHF"), new Money(7, "USD")); - Assert.IsTrue(fMB1.Equals(equal)); - Assert.IsTrue(!fMB1.Equals(f12CHF)); - Assert.IsTrue(!f12CHF.Equals(fMB1)); - Assert.IsTrue(!fMB1.Equals(fMB2)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void MoneyBagHash() - { - MoneyBag equal= new MoneyBag(new Money(12, "CHF"), new Money(7, "USD")); - Assert.AreEqual(fMB1.GetHashCode(), equal.GetHashCode()); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void MoneyEquals() - { - //NOTE: Normally we use Assert.AreEqual to test whether two - // objects are equal. But here we are testing the MoneyBag.Equals() - // method itself, so using AreEqual would not serve the purpose. - Assert.IsFalse(f12CHF.Equals(null)); - Money equalMoney= new Money(12, "CHF"); - Assert.IsTrue(f12CHF.Equals( f12CHF )); - Assert.IsTrue(f12CHF.Equals( equalMoney )); - Assert.IsFalse(f12CHF.Equals(f14CHF)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void MoneyHash() - { - Assert.IsFalse(f12CHF.Equals(null)); - Money equal= new Money(12, "CHF"); - Assert.AreEqual(f12CHF.GetHashCode(), equal.GetHashCode()); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void Normalize() - { - Money[] bag= { new Money(26, "CHF"), new Money(28, "CHF"), new Money(6, "CHF") }; - MoneyBag moneyBag= new MoneyBag(bag); - Money[] expected = { new Money(60, "CHF") }; - // note: expected is still a MoneyBag - MoneyBag expectedBag= new MoneyBag(expected); - Assert.AreEqual(expectedBag, moneyBag); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void Normalize2() - { - // {[12 CHF][7 USD]} - [12 CHF] == [7 USD] - Money expected= new Money(7, "USD"); - Assert.AreEqual(expected, fMB1.Subtract(f12CHF)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void Normalize3() - { - // {[12 CHF][7 USD]} - {[12 CHF][3 USD]} == [4 USD] - Money[] s1 = { new Money(12, "CHF"), new Money(3, "USD") }; - MoneyBag ms1= new MoneyBag(s1); - Money expected= new Money(4, "USD"); - Assert.AreEqual(expected, fMB1.Subtract(ms1)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void Normalize4() - { - // [12 CHF] - {[12 CHF][3 USD]} == [-3 USD] - Money[] s1 = { new Money(12, "CHF"), new Money(3, "USD") }; - MoneyBag ms1= new MoneyBag(s1); - Money expected= new Money(-3, "USD"); - Assert.AreEqual(expected, f12CHF.Subtract(ms1)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void Print() - { - Assert.AreEqual("[12 CHF]", f12CHF.ToString()); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void SimpleAdd() - { - // [12 CHF] + [14 CHF] == [26 CHF] - Money expected= new Money(26, "CHF"); - Assert.AreEqual(expected, f12CHF.Add(f14CHF)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void SimpleBagAdd() - { - // [14 CHF] + {[12 CHF][7 USD]} == {[26 CHF][7 USD]} - Money[] bag= { new Money(26, "CHF"), new Money(7, "USD") }; - MoneyBag expected= new MoneyBag(bag); - Assert.AreEqual(expected, f14CHF.Add(fMB1)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void SimpleMultiply() - { - // [14 CHF] *2 == [28 CHF] - Money expected= new Money(28, "CHF"); - Assert.AreEqual(expected, f14CHF.Multiply(2)); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void SimpleNegate() - { - // [14 CHF] negate == [-14 CHF] - Money expected= new Money(-14, "CHF"); - Assert.AreEqual(expected, f14CHF.Negate()); - } - - /// <summary> - /// - /// </summary> - /// - [Test] - public void SimpleSubtract() - { - // [14 CHF] - [12 CHF] == [2 CHF] - Money expected= new Money(2, "CHF"); - Assert.AreEqual(expected, f14CHF.Subtract(f12CHF)); - } - } -}
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/money/cs-money.build b/tools/NUnit/samples/csharp/money/cs-money.build deleted file mode 100644 index 917d973..0000000 --- a/tools/NUnit/samples/csharp/money/cs-money.build +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<project name="cs-money" default="build"> - - <include buildfile="../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.cs" /> - <include name="IMoney.cs" /> - <include name="Money.cs" /> - <include name="MoneyBag.cs" /> - <include name="MoneyTest.cs" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/money/cs-money.csproj b/tools/NUnit/samples/csharp/money/cs-money.csproj deleted file mode 100644 index 1ccc7c9..0000000 --- a/tools/NUnit/samples/csharp/money/cs-money.csproj +++ /dev/null @@ -1,23 +0,0 @@ -<VisualStudioProject> - <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{11EDF872-A04D-4F75-A1BF-71168DC86AF3}"> - <Build> - <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="cs-money" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="money" 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" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.cs" SubType="Code" BuildAction="Compile" /> - <File RelPath="IMoney.cs" SubType="Code" BuildAction="Compile" /> - <File RelPath="Money.cs" SubType="Code" BuildAction="Compile" /> - <File RelPath="MoneyBag.cs" SubType="Code" BuildAction="Compile" /> - <File RelPath="MoneyTest.cs" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/syntax/AssemblyInfo.cs b/tools/NUnit/samples/csharp/syntax/AssemblyInfo.cs deleted file mode 100644 index 9f89a32..0000000 --- a/tools/NUnit/samples/csharp/syntax/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -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/tools/NUnit/samples/csharp/syntax/AssertSyntaxTests.cs b/tools/NUnit/samples/csharp/syntax/AssertSyntaxTests.cs deleted file mode 100644 index b612580..0000000 --- a/tools/NUnit/samples/csharp/syntax/AssertSyntaxTests.cs +++ /dev/null @@ -1,828 +0,0 @@ -// **************************************************************** -// 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.Tests -{ - /// <summary> - /// This test fixture attempts to exercise all the syntactic - /// variations of Assert without getting into failures, errors - /// or corner cases. Thus, some of the tests may be duplicated - /// in other fixtures. - /// - /// Each test performs the same operations using the classic - /// syntax (if available) and the new syntax in both the - /// helper-based and inherited forms. - /// - /// This Fixture will eventually be duplicated in other - /// supported languages. - /// </summary> - [TestFixture] - public class AssertSyntaxTests : AssertionHelper - { - #region Simple Constraint Tests - [Test] - public void IsNull() - { - object nada = null; - - // Classic syntax - Assert.IsNull(nada); - - // Helper syntax - Assert.That(nada, Is.Null); - - // Inherited syntax - Expect(nada, Null); - } - - [Test] - public void IsNotNull() - { - // Classic syntax - Assert.IsNotNull(42); - - // Helper syntax - Assert.That(42, Is.Not.Null); - - // Inherited syntax - Expect( 42, Not.Null ); - } - - [Test] - public void IsTrue() - { - // Classic syntax - Assert.IsTrue(2+2==4); - - // Helper syntax - Assert.That(2+2==4, Is.True); - Assert.That(2+2==4); - - // Inherited syntax - Expect(2+2==4, True); - Expect(2+2==4); - } - - [Test] - public void IsFalse() - { - // Classic syntax - Assert.IsFalse(2+2==5); - - // Helper syntax - Assert.That(2+2== 5, Is.False); - - // Inherited syntax - Expect(2+2==5, False); - } - - [Test] - public void IsNaN() - { - double d = double.NaN; - float f = float.NaN; - - // Classic syntax - Assert.IsNaN(d); - Assert.IsNaN(f); - - // Helper syntax - Assert.That(d, Is.NaN); - Assert.That(f, Is.NaN); - - // Inherited syntax - Expect(d, NaN); - Expect(f, NaN); - } - - [Test] - public void EmptyStringTests() - { - // Classic syntax - Assert.IsEmpty(""); - Assert.IsNotEmpty("Hello!"); - - // Helper syntax - Assert.That("", Is.Empty); - Assert.That("Hello!", Is.Not.Empty); - - // Inherited syntax - Expect("", Empty); - Expect("Hello!", Not.Empty); - } - - [Test] - public void EmptyCollectionTests() - { - // Classic syntax - Assert.IsEmpty(new bool[0]); - Assert.IsNotEmpty(new int[] { 1, 2, 3 }); - - // Helper syntax - Assert.That(new bool[0], Is.Empty); - Assert.That(new int[] { 1, 2, 3 }, Is.Not.Empty); - - // Inherited syntax - Expect(new bool[0], Empty); - Expect(new int[] { 1, 2, 3 }, Not.Empty); - } - #endregion - - #region TypeConstraint Tests - [Test] - public void ExactTypeTests() - { - // Classic syntax workarounds - Assert.AreEqual(typeof(string), "Hello".GetType()); - Assert.AreEqual("System.String", "Hello".GetType().FullName); - Assert.AreNotEqual(typeof(int), "Hello".GetType()); - Assert.AreNotEqual("System.Int32", "Hello".GetType().FullName); - - // Helper syntax - Assert.That("Hello", Is.TypeOf(typeof(string))); - Assert.That("Hello", Is.Not.TypeOf(typeof(int))); - - // Inherited syntax - Expect( "Hello", TypeOf(typeof(string))); - Expect( "Hello", Not.TypeOf(typeof(int))); - } - - [Test] - public void InstanceOfTypeTests() - { - // Classic syntax - Assert.IsInstanceOf(typeof(string), "Hello"); - Assert.IsNotInstanceOf(typeof(string), 5); - - // Helper syntax - Assert.That("Hello", Is.InstanceOf(typeof(string))); - Assert.That(5, Is.Not.InstanceOf(typeof(string))); - - // Inherited syntax - Expect("Hello", InstanceOf(typeof(string))); - Expect(5, Not.InstanceOf(typeof(string))); - } - - [Test] - public void AssignableFromTypeTests() - { - // Classic syntax - Assert.IsAssignableFrom(typeof(string), "Hello"); - Assert.IsNotAssignableFrom(typeof(string), 5); - - // Helper syntax - Assert.That( "Hello", Is.AssignableFrom(typeof(string))); - Assert.That( 5, Is.Not.AssignableFrom(typeof(string))); - - // Inherited syntax - Expect( "Hello", AssignableFrom(typeof(string))); - Expect( 5, Not.AssignableFrom(typeof(string))); - } - #endregion - - #region StringConstraint Tests - [Test] - public void SubstringTests() - { - string phrase = "Hello World!"; - string[] array = new string[] { "abc", "bad", "dba" }; - - // Classic Syntax - StringAssert.Contains("World", phrase); - - // Helper syntax - Assert.That(phrase, Text.Contains("World")); - // Only available using new syntax - Assert.That(phrase, Text.DoesNotContain("goodbye")); - Assert.That(phrase, Text.Contains("WORLD").IgnoreCase); - Assert.That(phrase, Text.DoesNotContain("BYE").IgnoreCase); - Assert.That(array, Text.All.Contains( "b" ) ); - - // Inherited syntax - Expect(phrase, Contains("World")); - // Only available using new syntax - Expect(phrase, Not.Contains("goodbye")); - Expect(phrase, Contains("WORLD").IgnoreCase); - Expect(phrase, Not.Contains("BYE").IgnoreCase); - Expect(array, All.Contains("b")); - } - - [Test] - public void StartsWithTests() - { - string phrase = "Hello World!"; - string[] greetings = new string[] { "Hello!", "Hi!", "Hola!" }; - - // Classic syntax - StringAssert.StartsWith("Hello", phrase); - - // Helper syntax - Assert.That(phrase, Text.StartsWith("Hello")); - // Only available using new syntax - Assert.That(phrase, Text.DoesNotStartWith("Hi!")); - Assert.That(phrase, Text.StartsWith("HeLLo").IgnoreCase); - Assert.That(phrase, Text.DoesNotStartWith("HI").IgnoreCase); - Assert.That(greetings, Text.All.StartsWith("h").IgnoreCase); - - // Inherited syntax - Expect(phrase, StartsWith("Hello")); - // Only available using new syntax - Expect(phrase, Not.StartsWith("Hi!")); - Expect(phrase, StartsWith("HeLLo").IgnoreCase); - Expect(phrase, Not.StartsWith("HI").IgnoreCase); - Expect(greetings, All.StartsWith("h").IgnoreCase); - } - - [Test] - public void EndsWithTests() - { - string phrase = "Hello World!"; - string[] greetings = new string[] { "Hello!", "Hi!", "Hola!" }; - - // Classic Syntax - StringAssert.EndsWith("!", phrase); - - // Helper syntax - Assert.That(phrase, Text.EndsWith("!")); - // Only available using new syntax - Assert.That(phrase, Text.DoesNotEndWith("?")); - Assert.That(phrase, Text.EndsWith("WORLD!").IgnoreCase); - Assert.That(greetings, Text.All.EndsWith("!")); - - // Inherited syntax - Expect(phrase, EndsWith("!")); - // Only available using new syntax - Expect(phrase, Not.EndsWith("?")); - Expect(phrase, EndsWith("WORLD!").IgnoreCase); - Expect(greetings, All.EndsWith("!") ); - } - - [Test] - public void EqualIgnoringCaseTests() - { - string phrase = "Hello World!"; - - // Classic syntax - StringAssert.AreEqualIgnoringCase("hello world!",phrase); - - // Helper syntax - Assert.That(phrase, Is.EqualTo("hello world!").IgnoreCase); - //Only available using new syntax - Assert.That(phrase, Is.Not.EqualTo("goodbye world!").IgnoreCase); - Assert.That(new string[] { "Hello", "World" }, - Is.EqualTo(new object[] { "HELLO", "WORLD" }).IgnoreCase); - Assert.That(new string[] {"HELLO", "Hello", "hello" }, - Is.All.EqualTo( "hello" ).IgnoreCase); - - // Inherited syntax - Expect(phrase, EqualTo("hello world!").IgnoreCase); - //Only available using new syntax - Expect(phrase, Not.EqualTo("goodbye world!").IgnoreCase); - Expect(new string[] { "Hello", "World" }, - EqualTo(new object[] { "HELLO", "WORLD" }).IgnoreCase); - Expect(new string[] {"HELLO", "Hello", "hello" }, - All.EqualTo( "hello" ).IgnoreCase); - } - - [Test] - public void RegularExpressionTests() - { - string phrase = "Now is the time for all good men to come to the aid of their country."; - string[] quotes = new string[] { "Never say never", "It's never too late", "Nevermore!" }; - - // Classic syntax - StringAssert.IsMatch( "all good men", phrase ); - StringAssert.IsMatch( "Now.*come", phrase ); - - // Helper syntax - Assert.That( phrase, Text.Matches( "all good men" ) ); - Assert.That( phrase, Text.Matches( "Now.*come" ) ); - // Only available using new syntax - Assert.That(phrase, Text.DoesNotMatch("all.*men.*good")); - Assert.That(phrase, Text.Matches("ALL").IgnoreCase); - Assert.That(quotes, Text.All.Matches("never").IgnoreCase); - - // Inherited syntax - Expect( phrase, Matches( "all good men" ) ); - Expect( phrase, Matches( "Now.*come" ) ); - // Only available using new syntax - Expect(phrase, Not.Matches("all.*men.*good")); - Expect(phrase, Matches("ALL").IgnoreCase); - Expect(quotes, All.Matches("never").IgnoreCase); - } - #endregion - - #region Equality Tests - [Test] - public void EqualityTests() - { - int[] i3 = new int[] { 1, 2, 3 }; - double[] d3 = new double[] { 1.0, 2.0, 3.0 }; - int[] iunequal = new int[] { 1, 3, 2 }; - - // Classic Syntax - Assert.AreEqual(4, 2 + 2); - Assert.AreEqual(i3, d3); - Assert.AreNotEqual(5, 2 + 2); - Assert.AreNotEqual(i3, iunequal); - - // Helper syntax - Assert.That(2 + 2, Is.EqualTo(4)); - Assert.That(2 + 2 == 4); - Assert.That(i3, Is.EqualTo(d3)); - Assert.That(2 + 2, Is.Not.EqualTo(5)); - Assert.That(i3, Is.Not.EqualTo(iunequal)); - - // Inherited syntax - Expect(2 + 2, EqualTo(4)); - Expect(2 + 2 == 4); - Expect(i3, EqualTo(d3)); - Expect(2 + 2, Not.EqualTo(5)); - Expect(i3, Not.EqualTo(iunequal)); - } - - [Test] - public void EqualityTestsWithTolerance() - { - // CLassic syntax - Assert.AreEqual(5.0d, 4.99d, 0.05d); - Assert.AreEqual(5.0f, 4.99f, 0.05f); - - // Helper syntax - Assert.That(4.99d, Is.EqualTo(5.0d).Within(0.05d)); - Assert.That(4.0d, Is.Not.EqualTo(5.0d).Within(0.5d)); - Assert.That(4.99f, Is.EqualTo(5.0f).Within(0.05f)); - Assert.That(4.99m, Is.EqualTo(5.0m).Within(0.05m)); - Assert.That(3999999999u, Is.EqualTo(4000000000u).Within(5u)); - Assert.That(499, Is.EqualTo(500).Within(5)); - Assert.That(4999999999L, Is.EqualTo(5000000000L).Within(5L)); - Assert.That(5999999999ul, Is.EqualTo(6000000000ul).Within(5ul)); - - // Inherited syntax - Expect(4.99d, EqualTo(5.0d).Within(0.05d)); - Expect(4.0d, Not.EqualTo(5.0d).Within(0.5d)); - Expect(4.99f, EqualTo(5.0f).Within(0.05f)); - Expect(4.99m, EqualTo(5.0m).Within(0.05m)); - Expect(499u, EqualTo(500u).Within(5u)); - Expect(499, EqualTo(500).Within(5)); - Expect(4999999999L, EqualTo(5000000000L).Within(5L)); - Expect(5999999999ul, EqualTo(6000000000ul).Within(5ul)); - } - - [Test] - public void EqualityTestsWithTolerance_MixedFloatAndDouble() - { - // Bug Fix 1743844 - Assert.That(2.20492d, Is.EqualTo(2.2d).Within(0.01f), - "Double actual, Double expected, Single tolerance"); - Assert.That(2.20492d, Is.EqualTo(2.2f).Within(0.01d), - "Double actual, Single expected, Double tolerance" ); - Assert.That(2.20492d, Is.EqualTo(2.2f).Within(0.01f), - "Double actual, Single expected, Single tolerance" ); - Assert.That(2.20492f, Is.EqualTo(2.2f).Within(0.01d), - "Single actual, Single expected, Double tolerance"); - Assert.That(2.20492f, Is.EqualTo(2.2d).Within(0.01d), - "Single actual, Double expected, Double tolerance"); - Assert.That(2.20492f, Is.EqualTo(2.2d).Within(0.01f), - "Single actual, Double expected, Single tolerance"); - } - - [Test] - public void EqualityTestsWithTolerance_MixingTypesGenerally() - { - // Extending tolerance to all numeric types - Assert.That(202d, Is.EqualTo(200d).Within(2), - "Double actual, Double expected, int tolerance"); - Assert.That( 4.87m, Is.EqualTo(5).Within(.25), - "Decimal actual, int expected, Double tolerance" ); - Assert.That( 4.87m, Is.EqualTo(5ul).Within(1), - "Decimal actual, ulong expected, int tolerance" ); - Assert.That( 487, Is.EqualTo(500).Within(25), - "int actual, int expected, int tolerance" ); - Assert.That( 487u, Is.EqualTo(500).Within(25), - "uint actual, int expected, int tolerance" ); - Assert.That( 487L, Is.EqualTo(500).Within(25), - "long actual, int expected, int tolerance" ); - Assert.That( 487ul, Is.EqualTo(500).Within(25), - "ulong actual, int expected, int tolerance" ); - } - #endregion - - #region Comparison Tests - [Test] - public void ComparisonTests() - { - // Classic Syntax - Assert.Greater(7, 3); - Assert.GreaterOrEqual(7, 3); - Assert.GreaterOrEqual(7, 7); - - // Helper syntax - Assert.That(7, Is.GreaterThan(3)); - Assert.That(7, Is.GreaterThanOrEqualTo(3)); - Assert.That(7, Is.AtLeast(3)); - Assert.That(7, Is.GreaterThanOrEqualTo(7)); - Assert.That(7, Is.AtLeast(7)); - - // Inherited syntax - Expect(7, GreaterThan(3)); - Expect(7, GreaterThanOrEqualTo(3)); - Expect(7, AtLeast(3)); - Expect(7, GreaterThanOrEqualTo(7)); - Expect(7, AtLeast(7)); - - // Classic syntax - Assert.Less(3, 7); - Assert.LessOrEqual(3, 7); - Assert.LessOrEqual(3, 3); - - // Helper syntax - Assert.That(3, Is.LessThan(7)); - Assert.That(3, Is.LessThanOrEqualTo(7)); - Assert.That(3, Is.AtMost(7)); - Assert.That(3, Is.LessThanOrEqualTo(3)); - Assert.That(3, Is.AtMost(3)); - - // Inherited syntax - Expect(3, LessThan(7)); - Expect(3, LessThanOrEqualTo(7)); - Expect(3, AtMost(7)); - Expect(3, LessThanOrEqualTo(3)); - Expect(3, AtMost(3)); - } - #endregion - - #region Collection Tests - [Test] - public void AllItemsTests() - { - object[] ints = new object[] { 1, 2, 3, 4 }; - object[] doubles = new object[] { 0.99, 2.1, 3.0, 4.05 }; - object[] strings = new object[] { "abc", "bad", "cab", "bad", "dad" }; - - // Classic syntax - CollectionAssert.AllItemsAreNotNull(ints); - CollectionAssert.AllItemsAreInstancesOfType(ints, typeof(int)); - CollectionAssert.AllItemsAreInstancesOfType(strings, typeof(string)); - CollectionAssert.AllItemsAreUnique(ints); - - // Helper syntax - Assert.That(ints, Is.All.Not.Null); - Assert.That(ints, Has.None.Null); - Assert.That(ints, Is.All.InstanceOfType(typeof(int))); - Assert.That(ints, Has.All.InstanceOfType(typeof(int))); - Assert.That(strings, Is.All.InstanceOfType(typeof(string))); - Assert.That(strings, Has.All.InstanceOfType(typeof(string))); - Assert.That(ints, Is.Unique); - // Only available using new syntax - Assert.That(strings, Is.Not.Unique); - Assert.That(ints, Is.All.GreaterThan(0)); - Assert.That(ints, Has.All.GreaterThan(0)); - Assert.That(ints, Has.None.LessThanOrEqualTo(0)); - Assert.That(strings, Text.All.Contains( "a" ) ); - Assert.That(strings, Has.All.Contains( "a" ) ); - Assert.That(strings, Has.Some.StartsWith( "ba" ) ); - Assert.That( strings, Has.Some.Property( "Length" ).EqualTo( 3 ) ); - Assert.That( strings, Has.Some.StartsWith( "BA" ).IgnoreCase ); - Assert.That( doubles, Has.Some.EqualTo( 1.0 ).Within( .05 ) ); - - // Inherited syntax - Expect(ints, All.Not.Null); - Expect(ints, None.Null); - Expect(ints, All.InstanceOfType(typeof(int))); - Expect(strings, All.InstanceOfType(typeof(string))); - Expect(ints, Unique); - // Only available using new syntax - Expect(strings, Not.Unique); - Expect(ints, All.GreaterThan(0)); - Expect(ints, None.LessThanOrEqualTo(0)); - Expect(strings, All.Contains( "a" ) ); - Expect(strings, Some.StartsWith( "ba" ) ); - Expect(strings, Some.StartsWith( "BA" ).IgnoreCase ); - Expect(doubles, Some.EqualTo( 1.0 ).Within( .05 ) ); - } - - [Test] - public void SomeItemTests() - { - object[] mixed = new object[] { 1, 2, "3", null, "four", 100 }; - object[] strings = new object[] { "abc", "bad", "cab", "bad", "dad" }; - - // Not available using the classic syntax - - // Helper syntax - Assert.That(mixed, Has.Some.Null); - Assert.That(mixed, Has.Some.InstanceOfType(typeof(int))); - Assert.That(mixed, Has.Some.InstanceOfType(typeof(string))); - Assert.That(strings, Has.Some.StartsWith( "ba" ) ); - Assert.That(strings, Has.Some.Not.StartsWith( "ba" ) ); - - // Inherited syntax - Expect(mixed, Some.Null); - Expect(mixed, Some.InstanceOfType(typeof(int))); - Expect(mixed, Some.InstanceOfType(typeof(string))); - Expect(strings, Some.StartsWith( "ba" ) ); - Expect(strings, Some.Not.StartsWith( "ba" ) ); - } - - [Test] - public void NoItemTests() - { - object[] ints = new object[] { 1, 2, 3, 4, 5 }; - object[] strings = new object[] { "abc", "bad", "cab", "bad", "dad" }; - - // Not available using the classic syntax - - // Helper syntax - Assert.That(ints, Has.None.Null); - Assert.That(ints, Has.None.InstanceOfType(typeof(string))); - Assert.That(ints, Has.None.GreaterThan(99)); - Assert.That(strings, Has.None.StartsWith( "qu" ) ); - - // Inherited syntax - Expect(ints, None.Null); - Expect(ints, None.InstanceOfType(typeof(string))); - Expect(ints, None.GreaterThan(99)); - Expect(strings, None.StartsWith( "qu" ) ); - } - - [Test] - public void CollectionContainsTests() - { - int[] iarray = new int[] { 1, 2, 3 }; - string[] sarray = new string[] { "a", "b", "c" }; - - // Classic syntax - Assert.Contains(3, iarray); - Assert.Contains("b", sarray); - CollectionAssert.Contains(iarray, 3); - CollectionAssert.Contains(sarray, "b"); - CollectionAssert.DoesNotContain(sarray, "x"); - // Showing that Contains uses NUnit equality - CollectionAssert.Contains( iarray, 1.0d ); - - // Helper syntax - Assert.That(iarray, Has.Member(3)); - Assert.That(sarray, Has.Member("b")); - Assert.That(sarray, Has.No.Member("x")); - // Showing that Contains uses NUnit equality - Assert.That(iarray, Has.Member( 1.0d )); - - // Only available using the new syntax - // Note that EqualTo and SameAs do NOT give - // identical results to Contains because - // Contains uses Object.Equals() - Assert.That(iarray, Has.Some.EqualTo(3)); - Assert.That(iarray, Has.Member(3)); - Assert.That(sarray, Has.Some.EqualTo("b")); - Assert.That(sarray, Has.None.EqualTo("x")); - Assert.That(iarray, Has.None.SameAs( 1.0d )); - Assert.That(iarray, Has.All.LessThan(10)); - Assert.That(sarray, Has.All.Length.EqualTo(1)); - Assert.That(sarray, Has.None.Property("Length").GreaterThan(3)); - - // Inherited syntax - Expect(iarray, Contains(3)); - Expect(sarray, Contains("b")); - Expect(sarray, Not.Contains("x")); - - // Only available using new syntax - // Note that EqualTo and SameAs do NOT give - // identical results to Contains because - // Contains uses Object.Equals() - Expect(iarray, Some.EqualTo(3)); - Expect(sarray, Some.EqualTo("b")); - Expect(sarray, None.EqualTo("x")); - Expect(iarray, All.LessThan(10)); - Expect(sarray, All.Length.EqualTo(1)); - Expect(sarray, None.Property("Length").GreaterThan(3)); - } - - [Test] - public void CollectionEquivalenceTests() - { - int[] ints1to5 = new int[] { 1, 2, 3, 4, 5 }; - int[] twothrees = new int[] { 1, 2, 3, 3, 4, 5 }; - int[] twofours = new int[] { 1, 2, 3, 4, 4, 5 }; - - // Classic syntax - CollectionAssert.AreEquivalent(new int[] { 2, 1, 4, 3, 5 }, ints1to5); - CollectionAssert.AreNotEquivalent(new int[] { 2, 2, 4, 3, 5 }, ints1to5); - CollectionAssert.AreNotEquivalent(new int[] { 2, 4, 3, 5 }, ints1to5); - CollectionAssert.AreNotEquivalent(new int[] { 2, 2, 1, 1, 4, 3, 5 }, ints1to5); - CollectionAssert.AreNotEquivalent(twothrees, twofours); - - // Helper syntax - Assert.That(new int[] { 2, 1, 4, 3, 5 }, Is.EquivalentTo(ints1to5)); - Assert.That(new int[] { 2, 2, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5)); - Assert.That(new int[] { 2, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5)); - Assert.That(new int[] { 2, 2, 1, 1, 4, 3, 5 }, Is.Not.EquivalentTo(ints1to5)); - - // Inherited syntax - Expect(new int[] { 2, 1, 4, 3, 5 }, EquivalentTo(ints1to5)); - Expect(new int[] { 2, 2, 4, 3, 5 }, Not.EquivalentTo(ints1to5)); - Expect(new int[] { 2, 4, 3, 5 }, Not.EquivalentTo(ints1to5)); - Expect(new int[] { 2, 2, 1, 1, 4, 3, 5 }, Not.EquivalentTo(ints1to5)); - } - - [Test] - public void SubsetTests() - { - int[] ints1to5 = new int[] { 1, 2, 3, 4, 5 }; - - // Classic syntax - CollectionAssert.IsSubsetOf(new int[] { 1, 3, 5 }, ints1to5); - CollectionAssert.IsSubsetOf(new int[] { 1, 2, 3, 4, 5 }, ints1to5); - CollectionAssert.IsNotSubsetOf(new int[] { 2, 4, 6 }, ints1to5); - CollectionAssert.IsNotSubsetOf(new int[] { 1, 2, 2, 2, 5 }, ints1to5); - - // Helper syntax - Assert.That(new int[] { 1, 3, 5 }, Is.SubsetOf(ints1to5)); - Assert.That(new int[] { 1, 2, 3, 4, 5 }, Is.SubsetOf(ints1to5)); - Assert.That(new int[] { 2, 4, 6 }, Is.Not.SubsetOf(ints1to5)); - - // Inherited syntax - Expect(new int[] { 1, 3, 5 }, SubsetOf(ints1to5)); - Expect(new int[] { 1, 2, 3, 4, 5 }, SubsetOf(ints1to5)); - Expect(new int[] { 2, 4, 6 }, Not.SubsetOf(ints1to5)); - } - #endregion - - #region Property Tests - [Test] - public void PropertyTests() - { - string[] array = { "abc", "bca", "xyz", "qrs" }; - string[] array2 = { "a", "ab", "abc" }; - ArrayList list = new ArrayList( array ); - - // Not available using the classic syntax - - // Helper syntax - Assert.That( list, Has.Property( "Count" ) ); - Assert.That( list, Has.No.Property( "Length" ) ); - - Assert.That( "Hello", Has.Length.EqualTo( 5 ) ); - Assert.That( "Hello", Has.Length.LessThan( 10 ) ); - Assert.That( "Hello", Has.Property("Length").EqualTo(5) ); - Assert.That( "Hello", Has.Property("Length").GreaterThan(3) ); - - Assert.That( array, Has.Property( "Length" ).EqualTo( 4 ) ); - Assert.That( array, Has.Length.EqualTo( 4 ) ); - Assert.That( array, Has.Property( "Length" ).LessThan( 10 ) ); - - Assert.That( array, Has.All.Property("Length").EqualTo(3) ); - Assert.That( array, Has.All.Length.EqualTo( 3 ) ); - Assert.That( array, Is.All.Length.EqualTo( 3 ) ); - Assert.That( array, Has.All.Property("Length").EqualTo(3) ); - Assert.That( array, Is.All.Property("Length").EqualTo(3) ); - - Assert.That( array2, Has.Some.Property("Length").EqualTo(2) ); - Assert.That( array2, Has.Some.Length.EqualTo(2) ); - Assert.That( array2, Has.Some.Property("Length").GreaterThan(2) ); - - Assert.That( array2, Is.Not.Property("Length").EqualTo(4) ); - Assert.That( array2, Is.Not.Length.EqualTo( 4 ) ); - Assert.That( array2, Has.No.Property("Length").GreaterThan(3) ); - - Assert.That( List.Map( array2 ).Property("Length"), Is.EqualTo( new int[] { 1, 2, 3 } ) ); - Assert.That( List.Map( array2 ).Property("Length"), Is.EquivalentTo( new int[] { 3, 2, 1 } ) ); - Assert.That( List.Map( array2 ).Property("Length"), Is.SubsetOf( new int[] { 1, 2, 3, 4, 5 } ) ); - Assert.That( List.Map( array2 ).Property("Length"), Is.Unique ); - - Assert.That( list, Has.Count.EqualTo( 4 ) ); - - // Inherited syntax - Expect( list, Property( "Count" ) ); - Expect( list, Not.Property( "Nada" ) ); - - Expect( "Hello", Length.EqualTo( 5 ) ); - Expect( "Hello", Property("Length").EqualTo(5) ); - Expect( "Hello", Property("Length").GreaterThan(0) ); - - Expect( array, Property("Length").EqualTo(4) ); - Expect( array, Length.EqualTo(4) ); - Expect( array, Property("Length").LessThan(10)); - - Expect( array, All.Length.EqualTo( 3 ) ); - Expect( array, All.Property("Length").EqualTo(3)); - - Expect( array2, Some.Property("Length").EqualTo(2) ); - Expect( array2, Some.Length.EqualTo( 2 ) ); - Expect( array2, Some.Property("Length").GreaterThan(2)); - - Expect( array2, None.Property("Length").EqualTo(4) ); - Expect( array2, None.Length.EqualTo( 4 ) ); - Expect( array2, None.Property("Length").GreaterThan(3)); - - Expect( Map( array2 ).Property("Length"), EqualTo( new int[] { 1, 2, 3 } ) ); - Expect( Map( array2 ).Property("Length"), EquivalentTo( new int[] { 3, 2, 1 } ) ); - Expect( Map( array2 ).Property("Length"), SubsetOf( new int[] { 1, 2, 3, 4, 5 } ) ); - Expect( Map( array2 ).Property("Length"), Unique ); - - Expect( list, Count.EqualTo( 4 ) ); - - } - #endregion - - #region Not Tests - [Test] - public void NotTests() - { - // Not available using the classic syntax - - // Helper syntax - Assert.That(42, Is.Not.Null); - Assert.That(42, Is.Not.True); - Assert.That(42, Is.Not.False); - Assert.That(2.5, Is.Not.NaN); - Assert.That(2 + 2, Is.Not.EqualTo(3)); - Assert.That(2 + 2, Is.Not.Not.EqualTo(4)); - Assert.That(2 + 2, Is.Not.Not.Not.EqualTo(5)); - - // Inherited syntax - Expect(42, Not.Null); - Expect(42, Not.True); - Expect(42, Not.False); - Expect(2.5, Not.NaN); - Expect(2 + 2, Not.EqualTo(3)); - Expect(2 + 2, Not.Not.EqualTo(4)); - Expect(2 + 2, Not.Not.Not.EqualTo(5)); - } - #endregion - - #region Operator Tests - [Test] - public void NotOperator() - { - // The ! operator is only available in the new syntax - Assert.That(42, !Is.Null); - // Inherited syntax - Expect( 42, !Null ); - } - - [Test] - public void AndOperator() - { - // The & operator is only available in the new syntax - Assert.That(7, Is.GreaterThan(5) & Is.LessThan(10)); - // Inherited syntax - Expect( 7, GreaterThan(5) & LessThan(10)); - } - - [Test] - public void OrOperator() - { - // The | operator is only available in the new syntax - Assert.That(3, Is.LessThan(5) | Is.GreaterThan(10)); - Expect( 3, LessThan(5) | GreaterThan(10)); - } - - [Test] - public void ComplexTests() - { - Assert.That(7, Is.Not.Null & Is.Not.LessThan(5) & Is.Not.GreaterThan(10)); - Expect(7, Not.Null & Not.LessThan(5) & Not.GreaterThan(10)); - - Assert.That(7, !Is.Null & !Is.LessThan(5) & !Is.GreaterThan(10)); - Expect(7, !Null & !LessThan(5) & !GreaterThan(10)); - - // TODO: Remove #if when mono compiler can handle null -#if MONO - Constraint x = null; - Assert.That(7, !x & !Is.LessThan(5) & !Is.GreaterThan(10)); - Expect(7, !x & !LessThan(5) & !GreaterThan(10)); -#else - Assert.That(7, !(Constraint)null & !Is.LessThan(5) & !Is.GreaterThan(10)); - Expect(7, !(Constraint)null & !LessThan(5) & !GreaterThan(10)); -#endif - } - #endregion - - #region Invalid Code Tests - // This method contains assertions that should not compile - // You can check by uncommenting it. - //public void WillNotCompile() - //{ - // Assert.That(42, Is.Not); - // Assert.That(42, Is.All); - // Assert.That(42, Is.Null.Not); - // Assert.That(42, Is.Not.Null.GreaterThan(10)); - // Assert.That(42, Is.GreaterThan(10).LessThan(99)); - - // object[] c = new object[0]; - // Assert.That(c, Is.Null.All); - // Assert.That(c, Is.Not.All); - // Assert.That(c, Is.All.Not); - //} - #endregion - } - -} diff --git a/tools/NUnit/samples/csharp/syntax/cs-syntax.build b/tools/NUnit/samples/csharp/syntax/cs-syntax.build deleted file mode 100644 index c144588..0000000 --- a/tools/NUnit/samples/csharp/syntax/cs-syntax.build +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<project name="cs-syntax" default="build"> - - <include buildfile="../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.cs" /> - <include name="AssertSyntaxTests.cs" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/csharp/syntax/cs-syntax.csproj b/tools/NUnit/samples/csharp/syntax/cs-syntax.csproj deleted file mode 100644 index b3970c7..0000000 --- a/tools/NUnit/samples/csharp/syntax/cs-syntax.csproj +++ /dev/null @@ -1,20 +0,0 @@ -<VisualStudioProject> - <CSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{06F46FA2-687B-4B46-A912-C1B0B4CC1B20}"> - <Build> - <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="cs-syntax" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="cs_syntax" 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" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.cs" SubType="Code" BuildAction="Compile" /> - <File RelPath="AssertSyntaxTests.cs" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </CSHARP> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/jsharp/failures/AssemblyInfo.jsl b/tools/NUnit/samples/jsharp/failures/AssemblyInfo.jsl deleted file mode 100644 index 5e4d026..0000000 --- a/tools/NUnit/samples/jsharp/failures/AssemblyInfo.jsl +++ /dev/null @@ -1,58 +0,0 @@ -import System.Reflection.*; -import 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("2.2.0.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 directory. For example, if your KeyFile is -// located in the project directory itself, 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/tools/NUnit/samples/jsharp/failures/JSharpTest.jsl b/tools/NUnit/samples/jsharp/failures/JSharpTest.jsl deleted file mode 100644 index 5ae1c47..0000000 --- a/tools/NUnit/samples/jsharp/failures/JSharpTest.jsl +++ /dev/null @@ -1,65 +0,0 @@ -// **************************************************************** -// 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. -// **************************************************************** - -package NUnit.Samples; - -import System.*; -import NUnit.Framework.Assert; - -/** @attribute NUnit.Framework.TestFixture() */ -public class SimpleJSharpTest -{ - protected int fValue1; - protected int fValue2; - - /** @attribute NUnit.Framework.SetUp() */ - public void Init() - { - fValue1 = 2; - fValue2 = 3; - } - - /** @attribute NUnit.Framework.Test() */ - public void Add() - { - int result= fValue1 + fValue2; - Assert.AreEqual(6,result, "Expected Failure"); - } - - /** @attribute NUnit.Framework.Test() */ - public void DivideByZero() - { - int zero= 0; - int result = 8/zero; - KeepCompilerFromWarning(result); // never executed, here to avoid compiler warning that result is unused. - } - - /** @attribute NUnit.Framework.Test() */ - public void Equals() - { - Assert.AreEqual(12, 12, "Integer"); - Assert.AreEqual(new Long(12), new Long(13), "Long"); - Assert.AreEqual('a', 'a', "Char"); - Assert.AreEqual(new Integer(12), new Integer(12), "Integer Object Cast"); - - Assert.AreEqual(12, 13, "Expected Failure (Integer)"); - Assert.AreEqual(12.0, 11.99, 0.0, "Expected Failure (Double)."); - } - - /** @attribute NUnit.Framework.Test() */ - /** @attribute NUnit.Framework.Ignore("ignored test") */ - public void IgnoredTest() - { - throw new InvalidCastException(); - } - - // A useless function, designed to avoid a compiler warning in the the DivideByZero test. - private int KeepCompilerFromWarning(int dummy) - { - return dummy; - } - -}
\ No newline at end of file diff --git a/tools/NUnit/samples/jsharp/failures/jsharp-failures.build b/tools/NUnit/samples/jsharp/failures/jsharp-failures.build deleted file mode 100644 index 51f20da..0000000 --- a/tools/NUnit/samples/jsharp/failures/jsharp-failures.build +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<project name="jsharp-failures" default="build"> - - <include buildfile="../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.jsl" /> - <include name="JSharpTest.jsl" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/jsharp/failures/jsharp-failures.vjsproj b/tools/NUnit/samples/jsharp/failures/jsharp-failures.vjsproj deleted file mode 100644 index e12f5c4..0000000 --- a/tools/NUnit/samples/jsharp/failures/jsharp-failures.vjsproj +++ /dev/null @@ -1,21 +0,0 @@ -<VisualStudioProject> - <VISUALJSHARP ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{B55A6E53-57A9-4205-B396-C9983B3AF46A}"> - <Build> - <Settings AssemblyKeyContainerName="" AssemblyName="jsharp-failures" AssemblyOriginatorKeyFile="" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" OutputType="Library" PreBuildEvent="" PostBuildEvent="" RootNamespace="jsharp" RunPostBuildEvent="OnBuildSuccess" StartupObject=""> - <Config Name="Debug" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="DEBUG;TRACE" DebugSymbols="true" NoWarn="" Optimize="false" OutputPath="bin\Debug\" RegisterForComInterop="false" TreatWarningsAsErrors="false" WarningLevel="4" AdditionalOptions="" /> - <Config Name="Release" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="TRACE" DebugSymbols="false" NoWarn="" Optimize="true" OutputPath="bin\Release\" RegisterForComInterop="false" TreatWarningsAsErrors="false" WarningLevel="4" AdditionalOptions="" /> - </Settings> - <References> - <Reference Name="vjslib" AssemblyName="vjslib" /> - <Reference Name="System" AssemblyName="System" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.jsl" SubType="Code" BuildAction="Compile" /> - <File RelPath="JSharpTest.jsl" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </VISUALJSHARP> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/jsharp/jsharp.sln b/tools/NUnit/samples/jsharp/jsharp.sln deleted file mode 100644 index 507fcc8..0000000 --- a/tools/NUnit/samples/jsharp/jsharp.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}") = "jsharp-failures", "failures\jsharp-failures.vjsproj", "{B55A6E53-57A9-4205-B396-C9983B3AF46A}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {B55A6E53-57A9-4205-B396-C9983B3AF46A}.Debug.ActiveCfg = Debug|.NET - {B55A6E53-57A9-4205-B396-C9983B3AF46A}.Debug.Build.0 = Debug|.NET - {B55A6E53-57A9-4205-B396-C9983B3AF46A}.Release.ActiveCfg = Release|.NET - {B55A6E53-57A9-4205-B396-C9983B3AF46A}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/tools/NUnit/samples/samples.common b/tools/NUnit/samples/samples.common deleted file mode 100644 index c6cbdb1..0000000 --- a/tools/NUnit/samples/samples.common +++ /dev/null @@ -1,308 +0,0 @@ -<?xml version="1.0"?> -<project> - - <property name="project.base" value="${project::get-base-directory()}" /> - - <property name="samples.base" value="${path::get-full-path('../..')}" /> - <!-- Duplicate the following if more levels are added -->te - <property name="samples.base" value="${path::get-full-path('../../..')}" - unless="${path::get-file-name(samples.base)=='samples'}" /> - - <property name="output.dir" value="${samples.base}/bin" /> - - <property name="nunit.bin.dir" - value="${path::combine(path::get-directory-name(samples.base), 'bin')}" /> - <property name="nunit.framework.dll" - value="${path::combine(nunit.bin.dir,'net-1.1/framework/nunit.framework.dll')}" /> - <property name="nunit.core.dll" - value="${path::combine(nunit.bin.dir,'net-1.1/nunit.core.dll')}" /> - <property name="nunit.core.interfaces.dll" - value="${path::combine(nunit.bin.dir,'net-1.1/nunit.core.interfaces.dll')}" /> - - <property name="sample" value="${project::get-name()}" - unless="${property::exists('sample')}"/> - <property name="sample.dll" value="${sample}.dll" /> - - <property name="sample.type" - value="${path::get-file-name(path::get-directory-name(project.base))}" /> - <property name="sample.type" value="addin" if="${sample.type=='Core'}" /> - - <if test="${directory::exists(path::combine(project.base, 'Tests'))}" > - <property name="tests" value="${sample}Tests" - unless="${property::exists('tests')}" /> - <property name="test.dll" value="${tests}.dll" /> - </if> - - <property name="nunit.build" value="false" - unless="${property::exists('project.package.dir')}"/> - <property name="nunit.build" value="true" - if="${property::exists('project.package.dir')}"/> - - <property name="build.debug" value="true" - unless="${property::exists('build.debug')}" /> - <property name="build.config" value="Debug" - if="${build.debug}" /> - <property name="build.config" value="Release" - unless="${build.debug}" /> - - - <target name="clean" description="Remove files created by build"> - - <delete file="${output.dir}/${sample.dll}" /> - <delete file="${output.dir}/${sample}.pdb" /> - - <if test="${property::exists('test.dll')}"> - <delete file="${output.dir}/${test.dll}" /> - <delete file="${output.dir}/${path::change-extension(test.dll, '.pdb')}" /> - </if> - - </target> - - <target name="init"> - - <mkdir dir="${output.dir}" unless="${directory::exists(output.dir)}" /> - - <copy file="${nunit.framework.dll}" todir="${output.dir}" - if="${not nunit.build and file::exists(nunit.framework.dll)}" /> - - </target> - - <target name="init-addin"> - - <mkdir dir="${output.dir}" unless="${directory::exists(output.dir)}" /> - - <copy file="${nunit.core.dll}" todir="${output.dir}" - if="${not nunit.build and file::exists(nunit.core.dll)}" /> - <copy file="${nunit.core.interfaces.dll}" todir="${output.dir}" - if="${not nunit.build and file::exists(nunit.core.interfaces.dll)}" /> - - </target> - - <target name="build" Description="Build the sample"> - <call target="build-${sample.type}"/> - </target> - - <target name="build-csharp" depends="init"> - - <csc target="library" output="${output.dir}/${sample.dll}" debug="${build.debug}"> - <sources> - <patternset refid="source-files"/> - </sources> - <references basedir="${output.dir}"> - <include name="nunit.framework.dll" /> - </references> - </csc> - - </target> - - <target name="build-addin" depends="init-addin"> - - <csc target="library" output="${output.dir}/${sample}.dll" debug="${build.debug}"> - <sources> - <patternset refid="source-files"/> - </sources> - <references basedir="${output.dir}"> - <include name="nunit.core.interfaces.dll" /> - <include name="nunit.core.dll" /> - </references> - </csc> - - <call target="build-addin-test" if="${property::exists('test.dll')}" /> - - </target> - - <target name="build-addin-test"> - - <csc target="library" output="${output.dir}/${test.dll}" debug="${build.debug}"> - <sources basedir="Tests"> - <patternset refid="test-files"/> - </sources> - <references basedir="${output.dir}"> - <include name="nunit.framework.dll" /> - <include name="${sample}.dll" /> - </references> - </csc> - - </target> - - <target name="build-vb" depends="init"> - - <vbc target="library" - output="${output.dir}/${sample.dll}" debug="${build.debug}"> - <imports> - <import namespace="System"/> - <import namespace="System.Collections"/> - </imports> - <sources> - <patternset refid="source-files"/> - </sources> - <references basedir="${output.dir}"> - <include name="System.dll" /> - <include name="nunit.framework.dll" /> - </references> - </vbc> - - </target> - - <target name="build-jsharp" depends="init"> - - <vjc target="library" output="${output.dir}/${sample.dll}" debug="${build.debug}"> - <sources> - <patternset refid="source-files"/> - </sources> - <references basedir="${output.dir}"> - <include name="nunit.framework.dll" /> - </references> - </vjc> - - </target> - - <target name="build-managed" depends="init"> - - <readregistry property="vs.2003.path" - key="Software\Microsoft\VisualStudio\7.1\InstallDir" - hive="LocalMachine" failonerror="false" - unless="${property::exists( 'vs.2003.path' )}"/> - - <fail message="VS 2003 must be installed to build this sample" - unless="${property::exists( 'vs.2003.path' )}"/> - - <exec program="devenv.exe" basedir="${vs.2003.path}" workingdir="." - commandline="${sample}.vcproj /build ${build.config} /out ${output.dir}/${sample.dll}" /> - - </target> - - <target name="build-cpp-cli" depends="init"> - - <readregistry property="vs.2005.path" - key="Software\Microsoft\VisualStudio\8.0\InstallDir" - hive="LocalMachine" failonerror="false" - unless="${property::exists( 'vs.2005.path' )}"/> - - <fail message="VS 2005 must be installed to build this sample" - unless="${property::exists( 'vs.2005.path' )}"/> - - <exec program="devenv.exe" - basedir="${vs.2005.path}" workingdir="." - commandline="${sample}.vcproj /build ${build.config} /out ${output.dir}/${sample.dll}"/> - - </target> - - <!-- ************************************************************* --> - <!-- Package targets are only used by the NUnit build script in --> - <!-- order to package the samples for distribution. --> - <!-- ************************************************************* --> - - <target name="package"> - - <fail message="Can't use package target directly - it must be called from the NUnit build script." - unless="${nunit.build}"/> - - <property name="sample.path" - value="${string::replace(project.base, samples.base, package.samples.dir)}" /> - - <call target="package-${sample.type}" /> - - </target> - - <target name="package-csharp"> - - <property name="sample.proj" value="${sample}.csproj" /> - - <call target="copy-source-files" /> - <call target="update-framework-ref" /> - - </target> - - <target name="package-jsharp"> - - <property name="sample.proj" value="${sample}.vjsproj" /> - - <call target="copy-source-files" /> - <call target="update-framework-ref" /> - - </target> - - <target name="update-framework-ref"> - - <xmlpoke - file="${sample.path}/${sample.proj}" - xpath="/VisualStudioProject/*/Build/References/Reference[@Name='nunit.framework']/@HintPath" - value="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - - </target> - - <target name="package-vb"> - - <property name="sample.proj" value="${sample}.vbproj" /> - - <call target="copy-source-files" /> - <call target="update-framework-ref" /> - - </target> - - <target name="package-managed"> - - <property name="sample.proj" value="${sample}.vcproj" /> - - <call target="copy-source-files" /> - - <copy todir="${package.samples.dir}/cpp/managed/failures" - file="./cpp-managed-failures.vcproj"> - <filterchain> - <replacestring from="$(SolutionDir)..\..\..\src\NUnitFramework\framework\bin\Debug\nunit.framework.dll" - to="..\..\..\..\bin\nunit.framework.dll"/> - </filterchain> - </copy> - - </target> - - <target name="package-cpp-cli"> - - <property name="sample.proj" value="${sample}.vcproj" /> - - <call target="copy-source-files" /> - - <xmlpoke - file="${sample.path}/${sample.proj}" - xpath="/VisualStudioProject/References/AssemblyReference[@AssemblyName='nunit.framework']/@RelativePath" - value="..\..\..\..\bin\net-2.0\framework\nunit.framework.dll" /> - - </target> - - <target name="package-addin"> - - <property name="sample.proj" value="${sample}.csproj" /> - - <call target="copy-source-files" /> - <call target="copy-test-files" - if="${property::exists('test.dll')}"/> - - </target> - - <target name="copy-source-files"> - - <copy todir="${sample.path}" includeemptydirs="false"> - <fileset basedir="."> - <include name="${sample.proj}" /> - <include name="${sample}.build" /> - <include name="Readme.txt" /> - <patternset refid="source-files" /> - </fileset> - </copy> - - </target> - - <target name="copy-test-files"> - - <copy todir="${sample.path}/Tests" includeemptydirs="false"> - <fileset basedir="Tests"> - <include name="${sample}Tests.csproj" /> - <include name="${sample}Tests.build" /> - <patternset refid="test-files" /> - </fileset> - </copy> - - </target> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/failures/AssemblyInfo.vb b/tools/NUnit/samples/vb/failures/AssemblyInfo.vb deleted file mode 100644 index 3e9a34c..0000000 --- a/tools/NUnit/samples/vb/failures/AssemblyInfo.vb +++ /dev/null @@ -1,32 +0,0 @@ -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - -<Assembly: AssemblyTitle("")> -<Assembly: AssemblyDescription("")> -<Assembly: AssemblyCompany("")> -<Assembly: AssemblyProduct("")> -<Assembly: AssemblyCopyright("")> -<Assembly: AssemblyTrademark("")> -<Assembly: CLSCompliant(True)> - -'The following GUID is for the ID of the typelib if this project is exposed to COM -<Assembly: Guid("592E12A6-DA65-4E00-BCE6-4AB403604F41")> - -' 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 Build and Revision Numbers -' by using the '*' as shown below: - -<Assembly: AssemblyVersion("2.2.0.0")> - diff --git a/tools/NUnit/samples/vb/failures/SimpleVBTest.vb b/tools/NUnit/samples/vb/failures/SimpleVBTest.vb deleted file mode 100644 index 14b49a2..0000000 --- a/tools/NUnit/samples/vb/failures/SimpleVBTest.vb +++ /dev/null @@ -1,60 +0,0 @@ -' **************************************************************** -' 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. -' **************************************************************** - -Option Explicit On -Imports System -Imports NUnit.Framework - -Namespace NUnit.Samples - - <TestFixture()> Public Class SimpleVBTest - - Private fValue1 As Integer - Private fValue2 As Integer - - Public Sub New() - MyBase.New() - End Sub - - <SetUp()> Public Sub Init() - fValue1 = 2 - fValue2 = 3 - End Sub - - <Test()> Public Sub Add() - Dim result As Double - - result = fValue1 + fValue2 - Assert.AreEqual(6, result) - End Sub - - <Test()> Public Sub DivideByZero() - Dim zero As Integer - Dim result As Integer - - zero = 0 - result = 8 / zero - End Sub - - <Test()> Public Sub TestEquals() - Assert.AreEqual(12, 12) - Assert.AreEqual(CLng(12), CLng(12)) - - Assert.AreEqual(12, 13, "Size") - Assert.AreEqual(12, 11.99, 0, "Capacity") - End Sub - - <Test(), ExpectedException(GetType(Exception))> Public Sub ExpectAnException() - Throw New InvalidCastException() - End Sub - - <Test(), Ignore("sample ignore")> Public Sub IgnoredTest() - ' does not matter what we type the test is not run - Throw New ArgumentException() - End Sub - - End Class -End Namespace
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/failures/vb-failures.build b/tools/NUnit/samples/vb/failures/vb-failures.build deleted file mode 100644 index 1d89264..0000000 --- a/tools/NUnit/samples/vb/failures/vb-failures.build +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<project name="vb-failures" default="build"> - - <include buildfile="../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.vb" /> - <include name="SimpleVBTest.vb" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/failures/vb-failures.vbproj b/tools/NUnit/samples/vb/failures/vb-failures.vbproj deleted file mode 100644 index 329376f..0000000 --- a/tools/NUnit/samples/vb/failures/vb-failures.vbproj +++ /dev/null @@ -1,24 +0,0 @@ -<VisualStudioProject> - <VisualBasic ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{F199991B-6C8E-4AB0-9AAA-703CD4897700}"> - <Build> - <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="vb-failures" AssemblyOriginatorKeyFile="" AssemblyOriginatorKeyMode="None" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" OptionCompare="Binary" OptionExplicit="On" OptionStrict="Off" RootNamespace="vb_failures" StartupObject="vb_failures.(None)"> - <Config Name="Debug" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="" DefineDebug="true" DefineTrace="true" DebugSymbols="true" IncrementalBuild="true" Optimize="false" OutputPath="bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="1" /> - <Config Name="Release" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="" DefineDebug="false" DefineTrace="true" DebugSymbols="false" IncrementalBuild="false" Optimize="true" OutputPath="bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="1" /> - </Settings> - <References> - <Reference Name="System" AssemblyName="System" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - <Imports> - <Import Namespace="Microsoft.VisualBasic" /> - <Import Namespace="System" /> - </Imports> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.vb" SubType="Code" BuildAction="Compile" /> - <File RelPath="SimpleVBTest.vb" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </VisualBasic> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/money/AssemblyInfo.vb b/tools/NUnit/samples/vb/money/AssemblyInfo.vb deleted file mode 100644 index f929cbc..0000000 --- a/tools/NUnit/samples/vb/money/AssemblyInfo.vb +++ /dev/null @@ -1,32 +0,0 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - -<Assembly: AssemblyTitle("")> -<Assembly: AssemblyDescription("")> -<Assembly: AssemblyCompany("")> -<Assembly: AssemblyProduct("")> -<Assembly: AssemblyCopyright("")> -<Assembly: AssemblyTrademark("")> -<Assembly: CLSCompliant(True)> - -'The following GUID is for the ID of the typelib if this project is exposed to COM -<Assembly: Guid("F21BB3B6-0C5E-4AE5-ABC7-4D25FC3F98DB")> - -' 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 Build and Revision Numbers -' by using the '*' as shown below: - -<Assembly: AssemblyVersion("1.0.*")> diff --git a/tools/NUnit/samples/vb/money/IMoney.vb b/tools/NUnit/samples/vb/money/IMoney.vb deleted file mode 100644 index ddc8ae6..0000000 --- a/tools/NUnit/samples/vb/money/IMoney.vb +++ /dev/null @@ -1,37 +0,0 @@ -' **************************************************************** -' 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.Samples - - 'The common interface for simple Monies and MoneyBags. - Public Interface IMoney - - 'Adds a money to this money - Function Add(ByVal m As IMoney) As IMoney - - 'Adds a simple Money to this money. This is a helper method for - 'implementing double dispatch. - Function AddMoney(ByVal m As Money) As IMoney - - 'Adds a MoneyBag to this money. This is a helper method for - 'implementing double dispatch. - Function AddMoneyBag(ByVal s As MoneyBag) As IMoney - - 'True if this money is zero. - ReadOnly Property IsZero() As Boolean - - 'Multiplies a money by the given factor. - Function Multiply(ByVal factor As Int32) As IMoney - - 'Negates this money. - Function Negate() As IMoney - - 'Subtracts a money from this money. - Function Subtract(ByVal m As IMoney) As IMoney - - End Interface - -End Namespace diff --git a/tools/NUnit/samples/vb/money/Money.vb b/tools/NUnit/samples/vb/money/Money.vb deleted file mode 100644 index f7699a8..0000000 --- a/tools/NUnit/samples/vb/money/Money.vb +++ /dev/null @@ -1,109 +0,0 @@ -' **************************************************************** -' 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. -' **************************************************************** - -Option Explicit On - -Namespace NUnit.Samples - - ' A Simple Money. - Public Class Money - Implements IMoney - - Private fAmount As Int32 - Private fCurrency As String - - ' Constructs a money from a given amount and currency. - Public Sub New(ByVal amount As Int32, ByVal currency As String) - Me.fAmount = amount - Me.fCurrency = currency - End Sub - - - ' Adds a money to this money. Forwards the request - ' to the AddMoney helper. - Public Overloads Function Add(ByVal m As IMoney) As IMoney Implements IMoney.Add - Return m.AddMoney(Me) - End Function - - Public Overloads Function AddMoney(ByVal m As Money) As IMoney Implements IMoney.AddMoney - If m.Currency.Equals(Currency) Then - Return New Money(Amount + m.Amount, Currency) - End If - - Return New MoneyBag(Me, m) - End Function - - Public Function AddMoneyBag(ByVal s As MoneyBag) As IMoney Implements IMoney.AddMoneyBag - Return s.AddMoney(Me) - End Function - - Public ReadOnly Property Amount() As Integer - Get - Return fAmount - End Get - End Property - - Public ReadOnly Property Currency() As String - Get - Return fCurrency - End Get - End Property - - Public Overloads Overrides Function Equals(ByVal anObject As Object) As Boolean - If IsZero And TypeOf anObject Is IMoney Then - Dim aMoney As IMoney = anObject - Return aMoney.IsZero - End If - - If TypeOf anObject Is Money Then - Dim aMoney As Money = anObject - If (IsZero) Then - Return aMoney.IsZero - End If - - Return Currency.Equals(aMoney.Currency) And Amount.Equals(aMoney.Amount) - End If - - Return False - End Function - - Public Overrides Function GetHashCode() As Int32 - Return fCurrency.GetHashCode() + fAmount - End Function - - Public ReadOnly Property IsZero() As Boolean Implements IMoney.IsZero - Get - Return Amount.Equals(0) - End Get - End Property - - Public Function Multiply(ByVal factor As Integer) As IMoney Implements IMoney.Multiply - - Return New Money(Amount * factor, Currency) - - End Function - - Public Function Negate() As IMoney Implements IMoney.Negate - - Return New Money(-Amount, Currency) - - End Function - - Public Function Subtract(ByVal m As IMoney) As IMoney Implements IMoney.Subtract - - Return Add(m.Negate()) - - End Function - - Public Overrides Function ToString() As String - - Return String.Format("[{0} {1}]", Amount, Currency) - - End Function - - End Class - -End Namespace diff --git a/tools/NUnit/samples/vb/money/MoneyBag.vb b/tools/NUnit/samples/vb/money/MoneyBag.vb deleted file mode 100644 index 409c1a1..0000000 --- a/tools/NUnit/samples/vb/money/MoneyBag.vb +++ /dev/null @@ -1,164 +0,0 @@ -' **************************************************************** -' 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. -' **************************************************************** - -Option Explicit On - -Namespace NUnit.Samples - - Public Class MoneyBag - Implements IMoney - - Private fmonies As ArrayList = New ArrayList(5) - - Private Sub New() - - End Sub - - Public Sub New(ByVal bag As Money()) - For Each m As Money In bag - If Not m.IsZero Then - AppendMoney(m) - End If - Next - End Sub - - Public Sub New(ByVal m1 As Money, ByVal m2 As Money) - - AppendMoney(m1) - AppendMoney(m2) - - End Sub - - Public Sub New(ByVal m As Money, ByVal bag As MoneyBag) - AppendMoney(m) - AppendBag(bag) - End Sub - - Public Sub New(ByVal m1 As MoneyBag, ByVal m2 As MoneyBag) - AppendBag(m1) - AppendBag(m2) - End Sub - - Public Function Add(ByVal m As IMoney) As IMoney Implements IMoney.Add - Return m.AddMoneyBag(Me) - End Function - - Public Function AddMoney(ByVal m As Money) As IMoney Implements IMoney.AddMoney - Return New MoneyBag(m, Me).Simplify - End Function - - Public Function AddMoneyBag(ByVal s As MoneyBag) As IMoney Implements IMoney.AddMoneyBag - Return New MoneyBag(s, Me).Simplify() - End Function - - Private Sub AppendBag(ByVal aBag As MoneyBag) - For Each m As Money In aBag.fmonies - AppendMoney(m) - Next - End Sub - - Private Sub AppendMoney(ByVal aMoney As Money) - - Dim old As Money = FindMoney(aMoney.Currency) - If old Is Nothing Then - fmonies.Add(aMoney) - Return - End If - fmonies.Remove(old) - Dim sum As IMoney = old.Add(aMoney) - If (sum.IsZero) Then - Return - End If - fmonies.Add(sum) - End Sub - - Private Function Contains(ByVal aMoney As Money) As Boolean - Dim m As Money = FindMoney(aMoney.Currency) - Return m.Amount.Equals(aMoney.Amount) - End Function - - Public Overloads Overrides Function Equals(ByVal anObject As Object) As Boolean - If IsZero Then - If TypeOf anObject Is IMoney Then - Dim aMoney As IMoney = anObject - Return aMoney.IsZero - End If - End If - - If TypeOf anObject Is MoneyBag Then - Dim aMoneyBag As MoneyBag = anObject - If Not aMoneyBag.fmonies.Count.Equals(fmonies.Count) Then - Return False - End If - - For Each m As Money In fmonies - If Not aMoneyBag.Contains(m) Then - Return False - End If - - Return True - Next - End If - - Return False - End Function - - Private Function FindMoney(ByVal currency As String) As Money - For Each m As Money In fmonies - If m.Currency.Equals(currency) Then - Return m - End If - Next - - Return Nothing - End Function - - Public Overrides Function GetHashCode() As Int32 - Dim hash As Int32 = 0 - For Each m As Money In fmonies - hash += m.GetHashCode() - Next - Return hash - End Function - - Public ReadOnly Property IsZero() As Boolean Implements IMoney.IsZero - Get - Return fmonies.Count.Equals(0) - End Get - End Property - - Public Function Multiply(ByVal factor As Integer) As IMoney Implements IMoney.Multiply - Dim result As New MoneyBag - If Not factor.Equals(0) Then - For Each m As Money In fmonies - result.AppendMoney(m.Multiply(factor)) - Next - End If - Return result - End Function - - Public Function Negate() As IMoney Implements IMoney.Negate - Dim result As New MoneyBag - For Each m As Money In fmonies - result.AppendMoney(m.Negate()) - Next - Return result - End Function - - Private Function Simplify() As IMoney - If fmonies.Count.Equals(1) Then - Return fmonies(0) - End If - Return Me - End Function - - - Public Function Subtract(ByVal m As IMoney) As IMoney Implements IMoney.Subtract - Return Add(m.Negate()) - End Function - End Class - -End Namespace diff --git a/tools/NUnit/samples/vb/money/MoneyTest.vb b/tools/NUnit/samples/vb/money/MoneyTest.vb deleted file mode 100644 index acb2c42..0000000 --- a/tools/NUnit/samples/vb/money/MoneyTest.vb +++ /dev/null @@ -1,216 +0,0 @@ -' **************************************************************** -' 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. -' **************************************************************** - -Option Explicit On - -Imports System -Imports NUnit.Framework - -Namespace NUnit.Samples - - <TestFixture()> _ - Public Class MoneyTest - - Private f12CHF As Money - Private f14CHF As Money - Private f7USD As Money - Private f21USD As Money - - Private fMB1 As MoneyBag - Private fMB2 As MoneyBag - - <SetUp()> _ - Protected Sub SetUp() - - f12CHF = New Money(12, "CHF") - f14CHF = New Money(14, "CHF") - f7USD = New Money(7, "USD") - f21USD = New Money(21, "USD") - - fMB1 = New MoneyBag(f12CHF, f7USD) - fMB2 = New MoneyBag(f14CHF, f21USD) - - End Sub - - <Test()> _ - Public Sub BagMultiply() - ' {[12 CHF][7 USD]} *2 == {[24 CHF][14 USD]} - Dim bag() As Money = New Money() {New Money(24, "CHF"), New Money(14, "USD")} - Dim expected As New MoneyBag(bag) - Assert.AreEqual(expected, fMB1.Multiply(2)) - Assert.AreEqual(fMB1, fMB1.Multiply(1)) - Assert.IsTrue(fMB1.Multiply(0).IsZero) - End Sub - - <Test()> _ - Public Sub BagNegate() - ' {[12 CHF][7 USD]} negate == {[-12 CHF][-7 USD]} - Dim bag() As Money = New Money() {New Money(-12, "CHF"), New Money(-7, "USD")} - Dim expected As New MoneyBag(bag) - Assert.AreEqual(expected, fMB1.Negate()) - End Sub - - <Test()> _ - Public Sub BagSimpleAdd() - - ' {[12 CHF][7 USD]} + [14 CHF] == {[26 CHF][7 USD]} - Dim bag() As Money = New Money() {New Money(26, "CHF"), New Money(7, "USD")} - Dim expected As New MoneyBag(bag) - Assert.AreEqual(expected, fMB1.Add(f14CHF)) - - End Sub - - <Test()> _ - Public Sub BagSubtract() - ' {[12 CHF][7 USD]} - {[14 CHF][21 USD] == {[-2 CHF][-14 USD]} - Dim bag() As Money = New Money() {New Money(-2, "CHF"), New Money(-14, "USD")} - Dim expected As New MoneyBag(bag) - Assert.AreEqual(expected, fMB1.Subtract(fMB2)) - End Sub - - <Test()> _ - Public Sub BagSumAdd() - ' {[12 CHF][7 USD]} + {[14 CHF][21 USD]} == {[26 CHF][28 USD]} - Dim bag() As Money = New Money() {New Money(26, "CHF"), New Money(28, "USD")} - Dim expected As New MoneyBag(bag) - Assert.AreEqual(expected, fMB1.Add(fMB2)) - End Sub - - <Test()> _ - Public Sub IsZero() - Assert.IsTrue(fMB1.Subtract(fMB1).IsZero) - - Dim bag() As Money = New Money() {New Money(0, "CHF"), New Money(0, "USD")} - Assert.IsTrue(New MoneyBag(bag).IsZero) - End Sub - - <Test()> _ - Public Sub MixedSimpleAdd() - ' [12 CHF] + [7 USD] == {[12 CHF][7 USD]} - Dim bag() As Money = New Money() {f12CHF, f7USD} - Dim expected As New MoneyBag(bag) - Assert.AreEqual(expected, f12CHF.Add(f7USD)) - End Sub - - <Test()> _ - Public Sub MoneyBagEquals() - ' NOTE: Normally we use Assert.AreEqual to test whether two - ' objects are equal. But here we are testing the MoneyBag.Equals() - ' method itself, so using AreEqual would not serve the purpose. - Assert.IsFalse(fMB1.Equals(Nothing)) - - Assert.IsTrue(fMB1.Equals(fMB1)) - Dim equal As MoneyBag = New MoneyBag(New Money(12, "CHF"), New Money(7, "USD")) - Assert.IsTrue(fMB1.Equals(equal)) - Assert.IsFalse(fMB1.Equals(f12CHF)) - Assert.IsFalse(f12CHF.Equals(fMB1)) - Assert.IsFalse(fMB1.Equals(fMB2)) - End Sub - - <Test()> _ - Public Sub MoneyBagHash() - Dim equal As MoneyBag = New MoneyBag(New Money(12, "CHF"), New Money(7, "USD")) - Assert.AreEqual(fMB1.GetHashCode(), equal.GetHashCode()) - End Sub - - <Test()> _ - Public Sub MoneyEquals() - ' NOTE: Normally we use Assert.AreEqual to test whether two - ' objects are equal. But here we are testing the MoneyBag.Equals() - ' method itself, so using AreEqual would not serve the purpose. - Assert.IsFalse(f12CHF.Equals(Nothing)) - Dim equalMoney As Money = New Money(12, "CHF") - Assert.IsTrue(f12CHF.Equals(f12CHF)) - Assert.IsTrue(f12CHF.Equals(equalMoney)) - Assert.IsFalse(f12CHF.Equals(f14CHF)) - End Sub - - <Test()> _ - Public Sub MoneyHash() - Assert.IsFalse(f12CHF.Equals(Nothing)) - Dim equal As Money = New Money(12, "CHF") - Assert.AreEqual(f12CHF.GetHashCode(), equal.GetHashCode()) - End Sub - - <Test()> _ - Public Sub Normalize() - Dim bag() As Money = New Money() {New Money(26, "CHF"), New Money(28, "CHF"), New Money(6, "CHF")} - Dim moneyBag As New MoneyBag(bag) - Dim expected() As Money = New Money() {New Money(60, "CHF")} - ' // note: expected is still a MoneyBag - Dim expectedBag As New MoneyBag(expected) - Assert.AreEqual(expectedBag, moneyBag) - End Sub - - <Test()> _ - Public Sub Normalize2() - ' {[12 CHF][7 USD]} - [12 CHF] == [7 USD] - Dim expected As Money = New Money(7, "USD") - Assert.AreEqual(expected, fMB1.Subtract(f12CHF)) - End Sub - - <Test()> _ - Public Sub Normalize3() - ' {[12 CHF][7 USD]} - {[12 CHF][3 USD]} == [4 USD] - Dim s1() As Money = New Money() {New Money(12, "CHF"), New Money(3, "USD")} - Dim ms1 As New MoneyBag(s1) - Dim expected As New Money(4, "USD") - Assert.AreEqual(expected, fMB1.Subtract(ms1)) - End Sub - - <Test()> _ - Public Sub Normalize4() - ' [12 CHF] - {[12 CHF][3 USD]} == [-3 USD] - Dim s1() As Money = New Money() {New Money(12, "CHF"), New Money(3, "USD")} - Dim ms1 As New MoneyBag(s1) - Dim expected As New Money(-3, "USD") - Assert.AreEqual(expected, f12CHF.Subtract(ms1)) - End Sub - - <Test()> _ - Public Sub Print() - Assert.AreEqual("[12 CHF]", f12CHF.ToString()) - End Sub - - <Test()> _ - Public Sub SimpleAdd() - - ' [12 CHF] + [14 CHF] == [26 CHF] - Dim expected As Money = New Money(26, "CHF") - Assert.AreEqual(expected, f12CHF.Add(f14CHF)) - - End Sub - - <Test()> _ - Public Sub SimpleNegate() - - ' [14 CHF] negate == [-14 CHF] - Dim expected As New Money(-14, "CHF") - Assert.AreEqual(expected, f14CHF.Negate()) - - End Sub - - <Test()> _ - Public Sub SimpleSubtract() - - ' [14 CHF] - [12 CHF] == [2 CHF] - Dim expected As New Money(2, "CHF") - Assert.AreEqual(expected, f14CHF.Subtract(f12CHF)) - - End Sub - - <Test()> _ - Public Sub SimpleMultiply() - - ' [14 CHF] *2 == [28 CHF] - Dim expected As New Money(28, "CHF") - Assert.AreEqual(expected, f14CHF.Multiply(2)) - - End Sub - - End Class - -End Namespace diff --git a/tools/NUnit/samples/vb/money/vb-money.build b/tools/NUnit/samples/vb/money/vb-money.build deleted file mode 100644 index 0d3cc04..0000000 --- a/tools/NUnit/samples/vb/money/vb-money.build +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<project name="vb-money" default="build"> - - <include buildfile="../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.vb" /> - <include name="IMoney.vb" /> - <include name="Money.vb" /> - <include name="MoneyBag.vb" /> - <include name="MoneyTest.vb" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/money/vb-money.vbproj b/tools/NUnit/samples/vb/money/vb-money.vbproj deleted file mode 100644 index b5579af..0000000 --- a/tools/NUnit/samples/vb/money/vb-money.vbproj +++ /dev/null @@ -1,28 +0,0 @@ -<VisualStudioProject> - <VisualBasic ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{95394B96-A794-48EA-9879-0E4EC79C5724}"> - <Build> - <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="vb-money" AssemblyOriginatorKeyFile="" AssemblyOriginatorKeyMode="None" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" OptionCompare="Binary" OptionExplicit="On" OptionStrict="Off" RootNamespace="Money" StartupObject=""> - <Config Name="Debug" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="" DefineDebug="true" DefineTrace="true" DebugSymbols="true" IncrementalBuild="true" Optimize="false" OutputPath="bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="1" /> - <Config Name="Release" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="" DefineDebug="false" DefineTrace="true" DebugSymbols="false" IncrementalBuild="false" Optimize="true" OutputPath="bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="1" /> - </Settings> - <References> - <Reference Name="System" AssemblyName="System" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - <Imports> - <Import Namespace="Microsoft.VisualBasic" /> - <Import Namespace="System" /> - <Import Namespace="System.Collections" /> - </Imports> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.vb" SubType="Code" BuildAction="Compile" /> - <File RelPath="IMoney.vb" SubType="Code" BuildAction="Compile" /> - <File RelPath="Money.vb" SubType="Code" BuildAction="Compile" /> - <File RelPath="MoneyBag.vb" SubType="Code" BuildAction="Compile" /> - <File RelPath="MoneyTest.vb" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </VisualBasic> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/syntax/AssemblyInfo.vb b/tools/NUnit/samples/vb/syntax/AssemblyInfo.vb deleted file mode 100644 index e29c3d4..0000000 --- a/tools/NUnit/samples/vb/syntax/AssemblyInfo.vb +++ /dev/null @@ -1,32 +0,0 @@ -Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices - -' 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. - -' Review the values of the assembly attributes - -<Assembly: AssemblyTitle("")> -<Assembly: AssemblyDescription("")> -<Assembly: AssemblyCompany("")> -<Assembly: AssemblyProduct("")> -<Assembly: AssemblyCopyright("")> -<Assembly: AssemblyTrademark("")> -<Assembly: CLSCompliant(True)> - -'The following GUID is for the ID of the typelib if this project is exposed to COM -<Assembly: Guid("966C964A-3C92-4834-AC3A-9A47BA0A728B")> - -' 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 Build and Revision Numbers -' by using the '*' as shown below: - -<Assembly: AssemblyVersion("1.0.*")> diff --git a/tools/NUnit/samples/vb/syntax/AssertSyntaxTests.vb b/tools/NUnit/samples/vb/syntax/AssertSyntaxTests.vb deleted file mode 100644 index bec1e0b..0000000 --- a/tools/NUnit/samples/vb/syntax/AssertSyntaxTests.vb +++ /dev/null @@ -1,705 +0,0 @@ -' **************************************************************** -' 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 -' **************************************************************** - -Option Explicit On - -Imports System -Imports NUnit.Framework -Imports NUnit.Framework.Constraints -Imports Text = NUnit.Framework.Text - -Namespace NUnit.Samples - - ' This test fixture attempts to exercise all the syntactic - ' variations of Assert without getting into failures, errors - ' or corner cases. Thus, some of the tests may be duplicated - ' in other fixtures. - ' - ' Each test performs the same operations using the classic - ' syntax (if available) and the new syntax in both the - ' helper-based and inherited forms. - ' - ' This Fixture will eventually be duplicated in other - ' supported languages. - - <TestFixture()> _ - Public Class AssertSyntaxTests - Inherits AssertionHelper - -#Region "Simple Constraint Tests" - <Test()> _ - Public Sub IsNull() - Dim nada As Object = Nothing - - ' Classic syntax - Assert.IsNull(nada) - - ' Helper syntax - Assert.That(nada, Iz.Null) - - ' Inherited syntax - Expect(nada, Null) - End Sub - - - <Test()> _ - Public Sub IsNotNull() - ' Classic syntax - Assert.IsNotNull(42) - - ' Helper syntax - Assert.That(42, Iz.Not.Null) - - ' Inherited syntax - Expect(42, Iz.Not.Null) - End Sub - - <Test()> _ - Public Sub IsTrue() - ' Classic syntax - Assert.IsTrue(2 + 2 = 4) - - ' Helper syntax - Assert.That(2 + 2 = 4, Iz.True) - Assert.That(2 + 2 = 4) - - ' Inherited syntax - Expect(2 + 2 = 4, Iz.True) - Expect(2 + 2 = 4) - End Sub - - <Test()> _ - Public Sub IsFalse() - ' Classic syntax - Assert.IsFalse(2 + 2 = 5) - - ' Helper syntax - Assert.That(2 + 2 = 5, Iz.False) - - ' Inherited syntax - Expect(2 + 2 = 5, Iz.False) - End Sub - - <Test()> _ - Public Sub IsNaN() - Dim d As Double = Double.NaN - Dim f As Single = Single.NaN - - ' Classic syntax - Assert.IsNaN(d) - Assert.IsNaN(f) - - ' Helper syntax - Assert.That(d, Iz.NaN) - Assert.That(f, Iz.NaN) - - ' Inherited syntax - Expect(d, NaN) - Expect(f, NaN) - End Sub - - <Test()> _ - Public Sub EmptyStringTests() - ' Classic syntax - Assert.IsEmpty("") - Assert.IsNotEmpty("Hello!") - - ' Helper syntax - Assert.That("", Iz.Empty) - Assert.That("Hello!", Iz.Not.Empty) - - ' Inherited syntax - Expect("", Empty) - Expect("Hello!", Iz.Not.Empty) - End Sub - - <Test()> _ - Public Sub EmptyCollectionTests() - - Dim boolArray As Boolean() = New Boolean() {} - Dim nonEmpty As Integer() = New Integer() {1, 2, 3} - - ' Classic syntax - Assert.IsEmpty(boolArray) - Assert.IsNotEmpty(nonEmpty) - - ' Helper syntax - Assert.That(boolArray, Iz.Empty) - Assert.That(nonEmpty, Iz.Not.Empty) - - ' Inherited syntax - Expect(boolArray, Iz.Empty) - Expect(nonEmpty, Iz.Not.Empty) - End Sub -#End Region - -#Region "TypeConstraint Tests" - <Test()> _ - Public Sub ExactTypeTests() - ' Classic syntax workarounds - Assert.AreEqual(GetType(String), "Hello".GetType()) - Assert.AreEqual("System.String", "Hello".GetType().FullName) - Assert.AreNotEqual(GetType(Integer), "Hello".GetType()) - Assert.AreNotEqual("System.Int32", "Hello".GetType().FullName) - - ' Helper syntax - Assert.That("Hello", Iz.TypeOf(GetType(String))) - Assert.That("Hello", Iz.Not.TypeOf(GetType(Integer))) - - ' Inherited syntax - Expect("Hello", Iz.TypeOf(GetType(String))) - Expect("Hello", Iz.Not.TypeOf(GetType(Integer))) - End Sub - - <Test()> _ - Public Sub InstanceOfTypeTests() - ' Classic syntax - Assert.IsInstanceOf(GetType(String), "Hello") - Assert.IsNotInstanceOf(GetType(String), 5) - - ' Helper syntax - Assert.That("Hello", Iz.InstanceOf(GetType(String))) - Assert.That(5, Iz.Not.InstanceOf(GetType(String))) - - ' Inherited syntax - Expect("Hello", InstanceOf(GetType(String))) - Expect(5, Iz.Not.InstanceOf(GetType(String))) - End Sub - - <Test()> _ - Public Sub AssignableFromTypeTests() - ' Classic syntax - Assert.IsAssignableFrom(GetType(String), "Hello") - Assert.IsNotAssignableFrom(GetType(String), 5) - - ' Helper syntax - Assert.That("Hello", Iz.AssignableFrom(GetType(String))) - Assert.That(5, Iz.Not.AssignableFrom(GetType(String))) - - ' Inherited syntax - Expect("Hello", AssignableFrom(GetType(String))) - Expect(5, Iz.Not.AssignableFrom(GetType(String))) - End Sub -#End Region - -#Region "StringConstraintTests" - <Test()> _ - Public Sub SubstringTests() - Dim phrase As String = "Hello World!" - Dim array As String() = New String() {"abc", "bad", "dba"} - - ' Classic Syntax - StringAssert.Contains("World", phrase) - - ' Helper syntax - Assert.That(phrase, Text.Contains("World")) - ' Only available using new syntax - Assert.That(phrase, Text.DoesNotContain("goodbye")) - Assert.That(phrase, Text.Contains("WORLD").IgnoreCase) - Assert.That(phrase, Text.DoesNotContain("BYE").IgnoreCase) - Assert.That(array, Text.All.Contains("b")) - - ' Inherited syntax - Expect(phrase, Contains("World")) - ' Only available using new syntax - Expect(phrase, Text.DoesNotContain("goodbye")) - Expect(phrase, Contains("WORLD").IgnoreCase) - Expect(phrase, Text.DoesNotContain("BYE").IgnoreCase) - Expect(array, All.Contains("b")) - End Sub - - <Test()> _ - Public Sub StartsWithTests() - Dim phrase As String = "Hello World!" - Dim greetings As String() = New String() {"Hello!", "Hi!", "Hola!"} - - ' Classic syntax - StringAssert.StartsWith("Hello", phrase) - - ' Helper syntax - Assert.That(phrase, Text.StartsWith("Hello")) - ' Only available using new syntax - Assert.That(phrase, Text.DoesNotStartWith("Hi!")) - Assert.That(phrase, Text.StartsWith("HeLLo").IgnoreCase) - Assert.That(phrase, Text.DoesNotStartWith("HI").IgnoreCase) - Assert.That(greetings, Text.All.StartsWith("h").IgnoreCase) - - ' Inherited syntax - Expect(phrase, StartsWith("Hello")) - ' Only available using new syntax - Expect(phrase, Text.DoesNotStartWith("Hi!")) - Expect(phrase, StartsWith("HeLLo").IgnoreCase) - Expect(phrase, Text.DoesNotStartWith("HI").IgnoreCase) - Expect(greetings, All.StartsWith("h").IgnoreCase) - End Sub - - <Test()> _ - Public Sub EndsWithTests() - Dim phrase As String = "Hello World!" - Dim greetings As String() = New String() {"Hello!", "Hi!", "Hola!"} - - ' Classic Syntax - StringAssert.EndsWith("!", phrase) - - ' Helper syntax - Assert.That(phrase, Text.EndsWith("!")) - ' Only available using new syntax - Assert.That(phrase, Text.DoesNotEndWith("?")) - Assert.That(phrase, Text.EndsWith("WORLD!").IgnoreCase) - Assert.That(greetings, Text.All.EndsWith("!")) - - ' Inherited syntax - Expect(phrase, EndsWith("!")) - ' Only available using new syntax - Expect(phrase, Text.DoesNotEndWith("?")) - Expect(phrase, EndsWith("WORLD!").IgnoreCase) - Expect(greetings, All.EndsWith("!")) - End Sub - - <Test()> _ - Public Sub EqualIgnoringCaseTests() - - Dim phrase As String = "Hello World!" - Dim array1 As String() = New String() {"Hello", "World"} - Dim array2 As String() = New String() {"HELLO", "WORLD"} - Dim array3 As String() = New String() {"HELLO", "Hello", "hello"} - - ' Classic syntax - StringAssert.AreEqualIgnoringCase("hello world!", phrase) - - ' Helper syntax - Assert.That(phrase, Iz.EqualTo("hello world!").IgnoreCase) - 'Only available using new syntax - Assert.That(phrase, Iz.Not.EqualTo("goodbye world!").IgnoreCase) - Assert.That(array1, Iz.EqualTo(array2).IgnoreCase) - Assert.That(array3, Iz.All.EqualTo("hello").IgnoreCase) - - ' Inherited syntax - Expect(phrase, EqualTo("hello world!").IgnoreCase) - 'Only available using new syntax - Expect(phrase, Iz.Not.EqualTo("goodbye world!").IgnoreCase) - Expect(array1, EqualTo(array2).IgnoreCase) - Expect(array3, All.EqualTo("hello").IgnoreCase) - End Sub - - <Test()> _ - Public Sub RegularExpressionTests() - Dim phrase As String = "Now is the time for all good men to come to the aid of their country." - Dim quotes As String() = New String() {"Never say never", "It's never too late", "Nevermore!"} - - ' Classic syntax - StringAssert.IsMatch("all good men", phrase) - StringAssert.IsMatch("Now.*come", phrase) - - ' Helper syntax - Assert.That(phrase, Text.Matches("all good men")) - Assert.That(phrase, Text.Matches("Now.*come")) - ' Only available using new syntax - Assert.That(phrase, Text.DoesNotMatch("all.*men.*good")) - Assert.That(phrase, Text.Matches("ALL").IgnoreCase) - Assert.That(quotes, Text.All.Matches("never").IgnoreCase) - - ' Inherited syntax - Expect(phrase, Matches("all good men")) - Expect(phrase, Matches("Now.*come")) - ' Only available using new syntax - Expect(phrase, Text.DoesNotMatch("all.*men.*good")) - Expect(phrase, Matches("ALL").IgnoreCase) - Expect(quotes, All.Matches("never").IgnoreCase) - End Sub -#End Region - -#Region "Equality Tests" - <Test()> _ - Public Sub EqualityTests() - - Dim i3 As Integer() = {1, 2, 3} - Dim d3 As Double() = {1.0, 2.0, 3.0} - Dim iunequal As Integer() = {1, 3, 2} - - ' Classic Syntax - Assert.AreEqual(4, 2 + 2) - Assert.AreEqual(i3, d3) - Assert.AreNotEqual(5, 2 + 2) - Assert.AreNotEqual(i3, iunequal) - - ' Helper syntax - Assert.That(2 + 2, Iz.EqualTo(4)) - Assert.That(2 + 2 = 4) - Assert.That(i3, Iz.EqualTo(d3)) - Assert.That(2 + 2, Iz.Not.EqualTo(5)) - Assert.That(i3, Iz.Not.EqualTo(iunequal)) - - ' Inherited syntax - Expect(2 + 2, EqualTo(4)) - Expect(2 + 2 = 4) - Expect(i3, EqualTo(d3)) - Expect(2 + 2, Iz.Not.EqualTo(5)) - Expect(i3, Iz.Not.EqualTo(iunequal)) - End Sub - - <Test()> _ - Public Sub EqualityTestsWithTolerance() - ' CLassic syntax - Assert.AreEqual(5.0R, 4.99R, 0.05R) - Assert.AreEqual(5.0F, 4.99F, 0.05F) - - ' Helper syntax - Assert.That(4.99R, Iz.EqualTo(5.0R).Within(0.05R)) - Assert.That(4D, Iz.Not.EqualTo(5D).Within(0.5D)) - Assert.That(4.99F, Iz.EqualTo(5.0F).Within(0.05F)) - Assert.That(4.99D, Iz.EqualTo(5D).Within(0.05D)) - Assert.That(499, Iz.EqualTo(500).Within(5)) - Assert.That(4999999999L, Iz.EqualTo(5000000000L).Within(5L)) - - ' Inherited syntax - Expect(4.99R, EqualTo(5.0R).Within(0.05R)) - Expect(4D, Iz.Not.EqualTo(5D).Within(0.5D)) - Expect(4.99F, EqualTo(5.0F).Within(0.05F)) - Expect(4.99D, EqualTo(5D).Within(0.05D)) - Expect(499, EqualTo(500).Within(5)) - Expect(4999999999L, EqualTo(5000000000L).Within(5L)) - End Sub - - <Test()> _ - Public Sub EqualityTestsWithTolerance_MixedFloatAndDouble() - ' Bug Fix 1743844 - Assert.That(2.20492R, Iz.EqualTo(2.2R).Within(0.01F), _ - "Double actual, Double expected, Single tolerance") - Assert.That(2.20492R, Iz.EqualTo(2.2F).Within(0.01R), _ - "Double actual, Single expected, Double tolerance") - Assert.That(2.20492R, Iz.EqualTo(2.2F).Within(0.01F), _ - "Double actual, Single expected, Single tolerance") - Assert.That(2.20492F, Iz.EqualTo(2.2F).Within(0.01R), _ - "Single actual, Single expected, Double tolerance") - Assert.That(2.20492F, Iz.EqualTo(2.2R).Within(0.01R), _ - "Single actual, Double expected, Double tolerance") - Assert.That(2.20492F, Iz.EqualTo(2.2R).Within(0.01F), _ - "Single actual, Double expected, Single tolerance") - End Sub - - <Test()> _ - Public Sub EqualityTestsWithTolerance_MixingTypesGenerally() - ' Extending tolerance to all numeric types - Assert.That(202.0R, Iz.EqualTo(200.0R).Within(2), _ - "Double actual, Double expected, int tolerance") - Assert.That(4.87D, Iz.EqualTo(5).Within(0.25R), _ - "Decimal actual, int expected, Double tolerance") - Assert.That(4.87D, Iz.EqualTo(5L).Within(1), _ - "Decimal actual, long expected, int tolerance") - Assert.That(487, Iz.EqualTo(500).Within(25), _ - "int actual, int expected, int tolerance") - Assert.That(487L, Iz.EqualTo(500).Within(25), _ - "long actual, int expected, int tolerance") - End Sub -#End Region - -#Region "Comparison Tests" - <Test()> _ - Public Sub ComparisonTests() - ' Classic Syntax - Assert.Greater(7, 3) - Assert.GreaterOrEqual(7, 3) - Assert.GreaterOrEqual(7, 7) - - ' Helper syntax - Assert.That(7, Iz.GreaterThan(3)) - Assert.That(7, Iz.GreaterThanOrEqualTo(3)) - Assert.That(7, Iz.AtLeast(3)) - Assert.That(7, Iz.GreaterThanOrEqualTo(7)) - Assert.That(7, Iz.AtLeast(7)) - - ' Inherited syntax - Expect(7, GreaterThan(3)) - Expect(7, GreaterThanOrEqualTo(3)) - Expect(7, AtLeast(3)) - Expect(7, GreaterThanOrEqualTo(7)) - Expect(7, AtLeast(7)) - - ' Classic syntax - Assert.Less(3, 7) - Assert.LessOrEqual(3, 7) - Assert.LessOrEqual(3, 3) - - ' Helper syntax - Assert.That(3, Iz.LessThan(7)) - Assert.That(3, Iz.LessThanOrEqualTo(7)) - Assert.That(3, Iz.AtMost(7)) - Assert.That(3, Iz.LessThanOrEqualTo(3)) - Assert.That(3, Iz.AtMost(3)) - - ' Inherited syntax - Expect(3, LessThan(7)) - Expect(3, LessThanOrEqualTo(7)) - Expect(3, AtMost(7)) - Expect(3, LessThanOrEqualTo(3)) - Expect(3, AtMost(3)) - End Sub -#End Region - -#Region "Collection Tests" - <Test()> _ - Public Sub AllItemsTests() - - Dim ints As Object() = {1, 2, 3, 4} - Dim doubles As Object() = {0.99, 2.1, 3.0, 4.05} - Dim strings As Object() = {"abc", "bad", "cab", "bad", "dad"} - - ' Classic syntax - CollectionAssert.AllItemsAreNotNull(ints) - CollectionAssert.AllItemsAreInstancesOfType(ints, GetType(Integer)) - CollectionAssert.AllItemsAreInstancesOfType(strings, GetType(String)) - CollectionAssert.AllItemsAreUnique(ints) - - ' Helper syntax - Assert.That(ints, Iz.All.Not.Null) - Assert.That(ints, Has.None.Null) - Assert.That(ints, Iz.All.InstanceOfType(GetType(Integer))) - Assert.That(ints, Has.All.InstanceOfType(GetType(Integer))) - Assert.That(strings, Iz.All.InstanceOfType(GetType(String))) - Assert.That(strings, Has.All.InstanceOfType(GetType(String))) - Assert.That(ints, Iz.Unique) - ' Only available using new syntax - Assert.That(strings, Iz.Not.Unique) - Assert.That(ints, Iz.All.GreaterThan(0)) - Assert.That(ints, Has.All.GreaterThan(0)) - Assert.That(ints, Has.None.LessThanOrEqualTo(0)) - Assert.That(strings, Text.All.Contains("a")) - Assert.That(strings, Has.All.Contains("a")) - Assert.That(strings, Has.Some.StartsWith("ba")) - Assert.That(strings, Has.Some.Property("Length").EqualTo(3)) - Assert.That(strings, Has.Some.StartsWith("BA").IgnoreCase) - Assert.That(doubles, Has.Some.EqualTo(1.0).Within(0.05)) - - ' Inherited syntax - Expect(ints, All.Not.Null) - Expect(ints, None.Null) - Expect(ints, All.InstanceOfType(GetType(Integer))) - Expect(strings, All.InstanceOfType(GetType(String))) - Expect(ints, Unique) - ' Only available using new syntax - Expect(strings, Iz.Not.Unique) - Expect(ints, All.GreaterThan(0)) - Expect(strings, All.Contains("a")) - Expect(strings, Some.StartsWith("ba")) - Expect(strings, Some.StartsWith("BA").IgnoreCase) - Expect(doubles, Some.EqualTo(1.0).Within(0.05)) - End Sub - - <Test()> _ - Public Sub SomeItemsTests() - - Dim mixed As Object() = {1, 2, "3", Nothing, "four", 100} - Dim strings As Object() = {"abc", "bad", "cab", "bad", "dad"} - - ' Not available using the classic syntax - - ' Helper syntax - Assert.That(mixed, Has.Some.Null) - Assert.That(mixed, Has.Some.InstanceOfType(GetType(Integer))) - Assert.That(mixed, Has.Some.InstanceOfType(GetType(String))) - Assert.That(strings, Has.Some.StartsWith("ba")) - Assert.That(strings, Has.Some.Not.StartsWith("ba")) - - ' Inherited syntax - Expect(mixed, Some.Null) - Expect(mixed, Some.InstanceOfType(GetType(Integer))) - Expect(mixed, Some.InstanceOfType(GetType(String))) - Expect(strings, Some.StartsWith("ba")) - Expect(strings, Some.Not.StartsWith("ba")) - End Sub - - <Test()> _ - Public Sub NoItemsTests() - - Dim ints As Object() = {1, 2, 3, 4, 5} - Dim strings As Object() = {"abc", "bad", "cab", "bad", "dad"} - - ' Not available using the classic syntax - - ' Helper syntax - Assert.That(ints, Has.None.Null) - Assert.That(ints, Has.None.InstanceOfType(GetType(String))) - Assert.That(ints, Has.None.GreaterThan(99)) - Assert.That(strings, Has.None.StartsWith("qu")) - - ' Inherited syntax - Expect(ints, None.Null) - Expect(ints, None.InstanceOfType(GetType(String))) - Expect(ints, None.GreaterThan(99)) - Expect(strings, None.StartsWith("qu")) - End Sub - - <Test()> _ - Public Sub CollectionContainsTests() - - Dim iarray As Integer() = {1, 2, 3} - Dim sarray As String() = {"a", "b", "c"} - - ' Classic syntax - Assert.Contains(3, iarray) - Assert.Contains("b", sarray) - CollectionAssert.Contains(iarray, 3) - CollectionAssert.Contains(sarray, "b") - CollectionAssert.DoesNotContain(sarray, "x") - ' Showing that Contains uses NUnit equality - CollectionAssert.Contains(iarray, 1.0R) - - ' Helper syntax - Assert.That(iarray, Has.Member(3)) - Assert.That(sarray, Has.Member("b")) - Assert.That(sarray, Has.No.Member("x")) - ' Showing that Contains uses NUnit equality - Assert.That(iarray, Has.Member(1.0R)) - - ' Only available using the new syntax - ' Note that EqualTo and SameAs do NOT give - ' identical results to Contains because - ' Contains uses Object.Equals() - Assert.That(iarray, Has.Some.EqualTo(3)) - Assert.That(iarray, Has.Member(3)) - Assert.That(sarray, Has.Some.EqualTo("b")) - Assert.That(sarray, Has.None.EqualTo("x")) - Assert.That(iarray, Has.None.SameAs(1.0R)) - Assert.That(iarray, Has.All.LessThan(10)) - Assert.That(sarray, Has.All.Length.EqualTo(1)) - Assert.That(sarray, Has.None.Property("Length").GreaterThan(3)) - - ' Inherited syntax - Expect(iarray, Contains(3)) - Expect(sarray, Contains("b")) - Expect(sarray, Has.No.Member("x")) - - ' Only available using new syntax - ' Note that EqualTo and SameAs do NOT give - ' identical results to Contains because - ' Contains uses Object.Equals() - Expect(iarray, Some.EqualTo(3)) - Expect(sarray, Some.EqualTo("b")) - Expect(sarray, None.EqualTo("x")) - Expect(iarray, All.LessThan(10)) - Expect(sarray, All.Length.EqualTo(1)) - Expect(sarray, None.Property("Length").GreaterThan(3)) - End Sub - - <Test()> _ - Public Sub CollectionEquivalenceTests() - - Dim ints1to5 As Integer() = {1, 2, 3, 4, 5} - Dim twothrees As Integer() = {1, 2, 3, 3, 4, 5} - Dim twofours As Integer() = {1, 2, 3, 4, 4, 5} - - ' Classic syntax - CollectionAssert.AreEquivalent(New Integer() {2, 1, 4, 3, 5}, ints1to5) - CollectionAssert.AreNotEquivalent(New Integer() {2, 2, 4, 3, 5}, ints1to5) - CollectionAssert.AreNotEquivalent(New Integer() {2, 4, 3, 5}, ints1to5) - CollectionAssert.AreNotEquivalent(New Integer() {2, 2, 1, 1, 4, 3, 5}, ints1to5) - CollectionAssert.AreNotEquivalent(twothrees, twofours) - - ' Helper syntax - Assert.That(New Integer() {2, 1, 4, 3, 5}, Iz.EquivalentTo(ints1to5)) - Assert.That(New Integer() {2, 2, 4, 3, 5}, Iz.Not.EquivalentTo(ints1to5)) - Assert.That(New Integer() {2, 4, 3, 5}, Iz.Not.EquivalentTo(ints1to5)) - Assert.That(New Integer() {2, 2, 1, 1, 4, 3, 5}, Iz.Not.EquivalentTo(ints1to5)) - Assert.That(twothrees, Iz.Not.EquivalentTo(twofours)) - - ' Inherited syntax - Expect(New Integer() {2, 1, 4, 3, 5}, EquivalentTo(ints1to5)) - End Sub - - <Test()> _ - Public Sub SubsetTests() - - Dim ints1to5 As Integer() = {1, 2, 3, 4, 5} - - ' Classic syntax - CollectionAssert.IsSubsetOf(New Integer() {1, 3, 5}, ints1to5) - CollectionAssert.IsSubsetOf(New Integer() {1, 2, 3, 4, 5}, ints1to5) - CollectionAssert.IsNotSubsetOf(New Integer() {2, 4, 6}, ints1to5) - CollectionAssert.IsNotSubsetOf(New Integer() {1, 2, 2, 2, 5}, ints1to5) - - ' Helper syntax - Assert.That(New Integer() {1, 3, 5}, Iz.SubsetOf(ints1to5)) - Assert.That(New Integer() {1, 2, 3, 4, 5}, Iz.SubsetOf(ints1to5)) - Assert.That(New Integer() {2, 4, 6}, Iz.Not.SubsetOf(ints1to5)) - - ' Inherited syntax - Expect(New Integer() {1, 3, 5}, SubsetOf(ints1to5)) - Expect(New Integer() {1, 2, 3, 4, 5}, SubsetOf(ints1to5)) - Expect(New Integer() {2, 4, 6}, Iz.Not.SubsetOf(ints1to5)) - End Sub -#End Region - -#Region "Property Tests" - <Test()> _ - Public Sub PropertyTests() - - Dim array As String() = {"abc", "bca", "xyz", "qrs"} - Dim array2 As String() = {"a", "ab", "abc"} - Dim list As New ArrayList(array) - - ' Not available using the classic syntax - - ' Helper syntax - ' Assert.That(list, Has.Property("Count")) - ' Assert.That(list, Has.No.Property("Length")) - - Assert.That("Hello", Has.Length.EqualTo(5)) - Assert.That("Hello", Has.Property("Length").EqualTo(5)) - Assert.That("Hello", Has.Property("Length").GreaterThan(3)) - - Assert.That(array, Has.Property("Length").EqualTo(4)) - Assert.That(array, Has.Length.EqualTo(4)) - Assert.That(array, Has.Property("Length").LessThan(10)) - - Assert.That(array, Has.All.Property("Length").EqualTo(3)) - Assert.That(array, Has.All.Length.EqualTo(3)) - Assert.That(array, Iz.All.Length.EqualTo(3)) - Assert.That(array, Has.All.Property("Length").EqualTo(3)) - Assert.That(array, Iz.All.Property("Length").EqualTo(3)) - - Assert.That(array2, Iz.Not.Property("Length").EqualTo(4)) - Assert.That(array2, Iz.Not.Length.EqualTo(4)) - Assert.That(array2, Has.No.Property("Length").GreaterThan(3)) - - ' Inherited syntax - ' Expect(list, Has.Property("Count")) - ' Expect(list, Has.No.Property("Nada")) - - Expect(array, All.Property("Length").EqualTo(3)) - Expect(array, All.Length.EqualTo(3)) - End Sub -#End Region - -#Region "Not Tests" - <Test()> _ - Public Sub NotTests() - ' Not available using the classic syntax - - ' Helper syntax - Assert.That(42, Iz.Not.Null) - Assert.That(42, Iz.Not.True) - Assert.That(42, Iz.Not.False) - Assert.That(2.5, Iz.Not.NaN) - Assert.That(2 + 2, Iz.Not.EqualTo(3)) - Assert.That(2 + 2, Iz.Not.Not.EqualTo(4)) - Assert.That(2 + 2, Iz.Not.Not.Not.EqualTo(5)) - - ' Inherited syntax - Expect(42, Iz.Not.Null) - Expect(42, Iz.Not.True) - Expect(42, Iz.Not.False) - Expect(2.5, Iz.Not.NaN) - Expect(2 + 2, Iz.Not.EqualTo(3)) - Expect(2 + 2, Iz.Not.Not.EqualTo(4)) - Expect(2 + 2, Iz.Not.Not.Not.EqualTo(5)) - End Sub -#End Region - - End Class - -End Namespace - diff --git a/tools/NUnit/samples/vb/syntax/vb-syntax.build b/tools/NUnit/samples/vb/syntax/vb-syntax.build deleted file mode 100644 index aa0f584..0000000 --- a/tools/NUnit/samples/vb/syntax/vb-syntax.build +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<project name="vb-syntax" default="build"> - - <include buildfile="../../samples.common" /> - - <patternset id="source-files"> - <include name="AssemblyInfo.vb" /> - <include name="AssertSyntaxTests.vb" /> - </patternset> - -</project>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/syntax/vb-syntax.vbproj b/tools/NUnit/samples/vb/syntax/vb-syntax.vbproj deleted file mode 100644 index 082a46d..0000000 --- a/tools/NUnit/samples/vb/syntax/vb-syntax.vbproj +++ /dev/null @@ -1,29 +0,0 @@ -<VisualStudioProject> - <VisualBasic ProjectType="Local" ProductVersion="7.10.3077" SchemaVersion="2.0" ProjectGuid="{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}"> - <Build> - <Settings ApplicationIcon="" AssemblyKeyContainerName="" AssemblyName="vb-syntax" AssemblyOriginatorKeyFile="" AssemblyOriginatorKeyMode="None" DefaultClientScript="JScript" DefaultHTMLPageLayout="Grid" DefaultTargetSchema="IE50" DelaySign="false" OutputType="Library" OptionCompare="Binary" OptionExplicit="On" OptionStrict="Off" RootNamespace="NUnit.Samples" StartupObject="NUnit.Samples.(None)"> - <Config Name="Debug" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="" DefineDebug="true" DefineTrace="true" DebugSymbols="true" IncrementalBuild="true" Optimize="false" OutputPath="bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="1" /> - <Config Name="Release" BaseAddress="285212672" ConfigurationOverrideFile="" DefineConstants="" DefineDebug="false" DefineTrace="true" DebugSymbols="false" IncrementalBuild="false" Optimize="true" OutputPath="bin\" RegisterForComInterop="false" RemoveIntegerChecks="false" TreatWarningsAsErrors="false" WarningLevel="1" /> - </Settings> - <References> - <Reference Name="System" AssemblyName="System" /> - <Reference Name="System.Data" AssemblyName="System.Data" /> - <Reference Name="System.XML" AssemblyName="System.Xml" /> - <Reference Name="nunit.framework" AssemblyName="nunit.framework, Version=2.5, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" HintPath="..\..\..\bin\net-1.1\framework\nunit.framework.dll" /> - </References> - <Imports> - <Import Namespace="Microsoft.VisualBasic" /> - <Import Namespace="System" /> - <Import Namespace="System.Collections" /> - <Import Namespace="System.Data" /> - <Import Namespace="System.Diagnostics" /> - </Imports> - </Build> - <Files> - <Include> - <File RelPath="AssemblyInfo.vb" SubType="Code" BuildAction="Compile" /> - <File RelPath="AssertSyntaxTests.vb" SubType="Code" BuildAction="Compile" /> - </Include> - </Files> - </VisualBasic> -</VisualStudioProject>
\ No newline at end of file diff --git a/tools/NUnit/samples/vb/vb-samples.sln b/tools/NUnit/samples/vb/vb-samples.sln deleted file mode 100644 index 7bf8156..0000000 --- a/tools/NUnit/samples/vb/vb-samples.sln +++ /dev/null @@ -1,37 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vb-failures", "failures\vb-failures.vbproj", "{F199991B-6C8E-4AB0-9AAA-703CD4897700}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vb-money", "money\vb-money.vbproj", "{95394B96-A794-48EA-9879-0E4EC79C5724}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "vb-syntax", "syntax\vb-syntax.vbproj", "{6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F199991B-6C8E-4AB0-9AAA-703CD4897700}.Debug.ActiveCfg = Debug|.NET - {F199991B-6C8E-4AB0-9AAA-703CD4897700}.Debug.Build.0 = Debug|.NET - {F199991B-6C8E-4AB0-9AAA-703CD4897700}.Release.ActiveCfg = Release|.NET - {F199991B-6C8E-4AB0-9AAA-703CD4897700}.Release.Build.0 = Release|.NET - {95394B96-A794-48EA-9879-0E4EC79C5724}.Debug.ActiveCfg = Debug|.NET - {95394B96-A794-48EA-9879-0E4EC79C5724}.Debug.Build.0 = Debug|.NET - {95394B96-A794-48EA-9879-0E4EC79C5724}.Release.ActiveCfg = Release|.NET - {95394B96-A794-48EA-9879-0E4EC79C5724}.Release.Build.0 = Release|.NET - {6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Debug.ActiveCfg = Debug|.NET - {6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Debug.Build.0 = Debug|.NET - {6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Release.ActiveCfg = Release|.NET - {6BEF566A-2691-4EE8-91AF-0390CCCDDAF1}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal |