diff --git a/src/Libraries/NUnit.Framework/AbstractAsserter.cs b/src/Libraries/NUnit.Framework/AbstractAsserter.cs
new file mode 100644
index 0000000000..e294abcb35
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/AbstractAsserter.cs
@@ -0,0 +1,58 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// AbstractAsserter is the base class for all asserters.
+ /// Asserters encapsulate a condition test and generation
+ /// of an AssertionException with a tailored message. They
+ /// are used by the Assert class as helper objects.
+ ///
+ /// User-defined asserters may be passed to the
+ /// Assert.DoAssert method in order to implement
+ /// extended asserts.
+ ///
+ public abstract class AbstractAsserter : IAsserter
+ {
+ ///
+ /// The user-defined message for this asserter.
+ ///
+ protected readonly string message;
+
+ ///
+ /// Arguments to use in formatting the user-defined message.
+ ///
+ protected readonly object[] args;
+
+ ///
+ /// Constructs an AbstractAsserter
+ ///
+ /// The message issued upon failure
+ /// Arguments to be used in formatting the message
+ public AbstractAsserter( string message, params object[] args )
+ {
+ this.message = message;
+ this.args = args;
+ }
+
+ protected string FormattedMessage
+ {
+ get
+ {
+ if ( message == null )
+ return string.Empty;
+
+ if ( args != null && args.Length > 0 )
+ return string.Format( message, args );
+
+ return message;
+ }
+ }
+
+ ///
+ /// Assert on the condition this object is designed
+ /// to handle, throwing an exception if it fails.
+ ///
+ public abstract void Assert();
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/AssemblyInfo.cs b/src/Libraries/NUnit.Framework/AssemblyInfo.cs
new file mode 100644
index 0000000000..7f48b63847
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/AssemblyInfo.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: CLSCompliant(true)]
+//
+// 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.2.0")]
diff --git a/src/Libraries/NUnit.Framework/Assert.cs b/src/Libraries/NUnit.Framework/Assert.cs
new file mode 100644
index 0000000000..6567c60e1f
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/Assert.cs
@@ -0,0 +1,623 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace NUnit.Framework
+{
+ ///
+ /// A set of Assert methods
+ ///
+ public class Assert
+ {
+ #region Assert Counting
+
+ private static int counter = 0;
+
+ ///
+ /// Gets the number of assertions executed so far and
+ /// resets the counter to zero.
+ ///
+ public static int Counter
+ {
+ get
+ {
+ int cnt = counter;
+ counter = 0;
+ return cnt;
+ }
+ }
+
+ private static void IncrementAssertCount()
+ {
+ ++counter;
+ }
+
+ #endregion
+
+ #region Constructor
+
+ ///
+ /// We don't actually want any instances of this object, but some people
+ /// like to inherit from it to add other static methods. Hence, the
+ /// protected constructor disallows any instances of this object.
+ ///
+ protected Assert() {}
+
+ #endregion
+
+ #region Equals and ReferenceEquals
+
+ ///
+ /// The Equals method throws an AssertionException. This is done
+ /// to make sure there is no mistake by calling this function.
+ ///
+ ///
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static new bool Equals(object a, object b)
+ {
+ throw new AssertionException("Assert.Equals should not be used for Assertions");
+ }
+
+ ///
+ /// override the default ReferenceEquals to throw an AssertionException. This
+ /// implementation makes sure there is no mistake in calling this function
+ /// as part of Assert.
+ ///
+ ///
+ ///
+ public static new void ReferenceEquals(object a, object b)
+ {
+ throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
+ }
+
+ #endregion
+
+ #region IsTrue
+
+ ///
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an .
+ ///
+ /// The evaluated condition
+ /// The message to display if the condition is false
+ /// Arguments to be used in formatting the message
+ static public void IsTrue(bool condition, string message, params object[] args)
+ {
+ DoAssert( new TrueAsserter( condition, message, args ) );
+ }
+
+ ///
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an .
+ ///
+ /// The evaluated condition
+ /// The message to display if the condition is false
+ static public void IsTrue(bool condition, string message)
+ {
+ Assert.IsTrue(condition, message, null);
+ }
+
+ ///
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an .
+ ///
+ /// The evaluated condition
+ static public void IsTrue(bool condition)
+ {
+ Assert.IsTrue(condition, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsFalse
+
+ ///
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an .
+ ///
+ /// The evaluated condition
+ /// The message to display if the condition is true
+ /// Arguments to be used in formatting the message
+ static public void IsFalse(bool condition, string message, params object[] args)
+ {
+ DoAssert( new FalseAsserter( condition, message, args ) );
+ }
+
+ ///
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an .
+ ///
+ /// The evaluated condition
+ /// The message to display if the condition is true
+ static public void IsFalse(bool condition, string message)
+ {
+ Assert.IsFalse( condition, message, null );
+ }
+
+ ///
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an .
+ ///
+ /// The evaluated condition
+ static public void IsFalse(bool condition)
+ {
+ Assert.IsFalse(condition, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsNotNull
+
+ ///
+ /// Verifies that the object that is passed in is not equal to null
+ /// If the object is not null then an
+ /// is thrown.
+ ///
+ /// The object that is to be tested
+ /// The message to be printed when the object is null
+ /// Arguments to be used in formatting the message
+ static public void IsNotNull(Object anObject, string message, params object[] args)
+ {
+ DoAssert( new NotNullAsserter( anObject, message, args ) );
+ }
+
+ ///
+ /// Verifies that the object that is passed in is not equal to null
+ /// If the object is not null then an
+ /// is thrown.
+ ///
+ /// The object that is to be tested
+ ///
+ static public void IsNotNull(Object anObject, string message)
+ {
+ Assert.IsNotNull(anObject, message, null);
+ }
+
+ ///
+ /// Verifies that the object that is passed in is not equal to null
+ /// If the object is not null then an
+ /// is thrown.
+ ///
+ /// The object that is to be tested
+ static public void IsNotNull(Object anObject)
+ {
+ Assert.IsNotNull(anObject, string.Empty, null);
+ }
+
+ #endregion
+
+ #region IsNull
+
+ ///
+ /// Verifies that the object that is passed in is equal to null
+ /// If the object is null then an
+ /// is thrown.
+ ///
+ /// The object that is to be tested
+ /// The message to be printed when the object is not null
+ /// Arguments to be used in formatting the message
+ static public void IsNull(Object anObject, string message, params object[] args)
+ {
+ DoAssert( new NullAsserter( anObject, message, args ) );
+ }
+
+ ///
+ /// Verifies that the object that is passed in is equal to null
+ /// If the object is null then an
+ /// is thrown.
+ ///
+ /// The object that is to be tested
+ ///
+ static public void IsNull(Object anObject, string message)
+ {
+ Assert.IsNull(anObject, message, null);
+ }
+
+ ///
+ /// Verifies that the object that is passed in is equal to null
+ /// If the object is null then an
+ /// is thrown.
+ ///
+ /// The object that is to be tested
+ static public void IsNull(Object anObject)
+ {
+ Assert.IsNull(anObject, string.Empty, null);
+ }
+
+ #endregion
+
+ #region AreEqual
+
+ #region Doubles
+
+ ///
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an is
+ /// thrown.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ /// The message that will be printed on failure
+ /// Arguments to be used in formatting the message
+ static public void AreEqual(double expected,
+ double actual, double delta, string message, params object[] args)
+ {
+ DoAssert( new EqualAsserter( expected, actual, delta, message, args ) );
+ }
+
+ ///
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an is
+ /// thrown.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ /// The message that will be printed on failure
+ static public void AreEqual(double expected,
+ double actual, double delta, string message)
+ {
+ Assert.AreEqual( expected, actual, delta, message, null );
+ }
+
+ ///
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an is
+ /// thrown.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ static public void AreEqual(double expected, double actual, double delta)
+ {
+ Assert.AreEqual(expected, actual, delta, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Floats
+
+ ///
+ /// Verifies that two floats are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an is
+ /// thrown.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ /// The message printed out upon failure
+ /// Arguments to be used in formatting the message
+ static public void AreEqual(float expected,
+ float actual, float delta, string message, params object[] args)
+ {
+ DoAssert( new EqualAsserter( expected, actual, delta, message, args ) );
+ }
+
+ ///
+ /// Verifies that two floats are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an is
+ /// thrown.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ /// The message printed out upon failure
+ static public void AreEqual(float expected, float actual, float delta, string message)
+ {
+ Assert.AreEqual(expected, actual, delta, message, null);
+ }
+
+ ///
+ /// Verifies that two floats are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equals then an is
+ /// thrown.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ static public void AreEqual(float expected, float actual, float delta)
+ {
+ Assert.AreEqual(expected, actual, delta, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Objects
+
+ ///
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. All
+ /// non-numeric types are compared by using the Equals method.
+ /// Arrays are compared by comparing each element using the same rules.
+ /// If they are not equal an is thrown.
+ ///
+ /// The value that is expected
+ /// The actual value
+ /// The message to display if objects are not equal
+ /// Arguments to be used in formatting the message
+ static public void AreEqual(Object expected, Object actual, string message, params object[] args)
+ {
+ DoAssert( new EqualAsserter(expected, actual, message, args) );
+ }
+
+ ///
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. All
+ /// non-numeric types are compared by using the Equals method.
+ /// If they are not equal an is thrown.
+ ///
+ /// The value that is expected
+ /// The actual value
+ /// The message to display if objects are not equal
+ static public void AreEqual(Object expected, Object actual, string message)
+ {
+ Assert.AreEqual(expected, actual, message, null);
+ }
+
+ ///
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. All
+ /// non-numeric types are compared by using the Equals method.
+ /// If they are not equal an is thrown.
+ ///
+ /// The value that is expected
+ /// The actual value
+ static public void AreEqual(Object expected, Object actual)
+ {
+ Assert.AreEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region AreNotEqual
+
+ ///
+ /// Asserts that two objects are not equal. If they are equal
+ /// an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ /// The message to be printed when the two objects are the same object.
+ /// Arguments to be used in formatting the message
+ static public void AreNotEqual( Object expected, Object actual, string message, params object[] args)
+ {
+ DoAssert( new NotEqualAsserter( expected, actual, message, args ) );
+ }
+
+ ///
+ /// Asserts that two objects are not equal. If they are equal
+ /// an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ /// The message to be printed when the objects are the same
+ static public void AreNotEqual(Object expected, Object actual, string message)
+ {
+ Assert.AreNotEqual(expected, actual, message, null);
+ }
+
+ ///
+ /// Asserts that two objects are not equal. If they are equal
+ /// an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ static public void AreNotEqual(Object expected, Object actual)
+ {
+ Assert.AreNotEqual(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region AreSame
+
+ ///
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ /// The message to be printed when the two objects are not the same object.
+ /// Arguments to be used in formatting the message
+ static public void AreSame(Object expected, Object actual, string message, params object[] args)
+ {
+ DoAssert( new SameAsserter( expected, actual, message, args ) );
+ }
+
+ ///
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ /// The message to be printed when the object is null
+ static public void AreSame(Object expected, Object actual, string message)
+ {
+ Assert.AreSame(expected, actual, message, null);
+ }
+
+ ///
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ static public void AreSame(Object expected, Object actual)
+ {
+ Assert.AreSame(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region AreNotSame
+
+ ///
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ /// The message to be printed when the two objects are the same object.
+ /// Arguments to be used in formatting the message
+ static public void AreNotSame(Object expected, Object actual, string message, params object[] args)
+ {
+ DoAssert( new NotSameAsserter( expected, actual, message, args ) );
+ }
+
+ ///
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ /// The message to be printed when the objects are the same
+ static public void AreNotSame(Object expected, Object actual, string message)
+ {
+ Assert.AreNotSame(expected, actual, message, null);
+ }
+
+ ///
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an is thrown.
+ ///
+ /// The expected object
+ /// The actual object
+ static public void AreNotSame(Object expected, Object actual)
+ {
+ Assert.AreNotSame(expected, actual, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Fail
+
+ ///
+ /// Throws an with the message and arguments
+ /// that are passed in. This is used by the other Assert functions.
+ ///
+ /// The message to initialize the with.
+ /// Arguments to be used in formatting the message
+ static public void Fail(string message, params object[] args )
+ {
+ if (message == null) message = string.Empty;
+ else if ( args != null && args.Length > 0 )
+ message = string.Format( message, args );
+
+ throw new AssertionException(message);
+ }
+
+ ///
+ /// Throws an with the message that is
+ /// passed in. This is used by the other Assert functions.
+ ///
+ /// The message to initialize the with.
+ static public void Fail(string message)
+ {
+ Assert.Fail(message, null);
+ }
+
+ ///
+ /// Throws an .
+ /// This is used by the other Assert functions.
+ ///
+ static public void Fail()
+ {
+ Assert.Fail(string.Empty, null);
+ }
+
+ #endregion
+
+ #region Ignore
+
+ ///
+ /// Throws an with the message and arguments
+ /// that are passed in. This causes the test to be reported as ignored.
+ ///
+ /// The message to initialize the with.
+ /// Arguments to be used in formatting the message
+ static public void Ignore( string message, object[] args )
+ {
+ if (message == null) message = string.Empty;
+ else if ( args != null && args.Length > 0 )
+ message = string.Format( message, args );
+
+ throw new IgnoreException(message);
+ }
+
+ ///
+ /// Throws an with the message that is
+ /// passed in. This causes the test to be reported as ignored.
+ ///
+ /// The message to initialize the with.
+ static public void Ignore( string message )
+ {
+ Assert.Ignore( message, null );
+ }
+
+ ///
+ /// Throws an .
+ /// This causes the test to be reported as ignored.
+ ///
+ static public void Ignore()
+ {
+ Assert.Ignore( string.Empty, null );
+ }
+
+ #endregion
+
+ #region DoAssert
+
+ static public void DoAssert( IAsserter asserter )
+ {
+ Assert.IncrementAssertCount();
+ asserter.Assert();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/src/Libraries/NUnit.Framework/Assertion.cs b/src/Libraries/NUnit.Framework/Assertion.cs
new file mode 100644
index 0000000000..b1c6fe8ed6
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/Assertion.cs
@@ -0,0 +1,190 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ /// A set of Assert methods.
+ ///
+ [Obsolete("Use Assert class instead")]
+ public class Assertion
+ {
+ ///
+ /// Asserts that a condition is true. If it isn't it throws
+ /// an .
+ ///
+ /// The message to display is the condition
+ /// is false
+ /// The evaluated condition
+ static public void Assert(string message, bool condition)
+ {
+ NUnit.Framework.Assert.IsTrue(condition, message);
+ }
+
+ ///
+ /// Asserts that a condition is true. If it isn't it throws
+ /// an .
+ ///
+ /// The evaluated condition
+ static public void Assert(bool condition)
+ {
+ Assertion.Assert(string.Empty, condition);
+ }
+
+ ///
+ /// /// Asserts that two doubles are equal concerning a delta. If the
+ /// expected value is infinity then the delta value is ignored.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ static public void AssertEquals(double expected, double actual, double delta)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual, delta);
+ }
+ ///
+ /// /// Asserts that two singles are equal concerning a delta. If the
+ /// expected value is infinity then the delta value is ignored.
+ ///
+ /// The expected value
+ /// The actual value
+ /// The maximum acceptable difference between the
+ /// the expected and the actual
+ static public void AssertEquals(float expected, float actual, float delta)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual, delta);
+ }
+
+ /// Asserts that two objects are equal. If they are not
+ /// an is thrown.
+ static public void AssertEquals(Object expected, Object actual)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual);
+ }
+
+ /// Asserts that two ints are equal. If they are not
+ /// an is thrown.
+ static public void AssertEquals(int expected, int actual)
+ {
+ Assertion.AssertEquals(string.Empty, expected, actual);
+ }
+
+ /// Asserts that two ints are equal. If they are not
+ /// an is thrown.
+ static public void AssertEquals(string message, int expected, int actual)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, message);
+ }
+
+ /// Asserts that two doubles are equal concerning a delta.
+ /// If the expected value is infinity then the delta value is ignored.
+ ///
+ static public void AssertEquals(string message, double expected,
+ double actual, double delta)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, delta, message);
+ }
+
+ /// Asserts that two floats are equal concerning a delta.
+ /// If the expected value is infinity then the delta value is ignored.
+ ///
+ static public void AssertEquals(string message, float expected,
+ float actual, float delta)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, delta, message);
+ }
+
+ ///
+ /// Asserts that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. Numeric
+ /// types are compared via string comparision on their contents to
+ /// avoid problems comparing values between different types. All
+ /// non-numeric types are compared by using the Equals method.
+ /// If they are not equal an is thrown.
+ ///
+ static public void AssertEquals(string message, Object expected, Object actual)
+ {
+ NUnit.Framework.Assert.AreEqual(expected, actual, message);
+ }
+
+ /// Asserts that an object isn't null.
+ static public void AssertNotNull(Object anObject)
+ {
+ NUnit.Framework.Assert.IsNotNull(anObject, string.Empty);
+ }
+
+ /// Asserts that an object isn't null.
+ static public void AssertNotNull(string message, Object anObject)
+ {
+ NUnit.Framework.Assert.IsNotNull(anObject, message);
+ }
+
+ /// Asserts that an object is null.
+ static public void AssertNull(Object anObject)
+ {
+ NUnit.Framework.Assert.IsNull(anObject, string.Empty);
+ }
+
+ /// Asserts that an object is null.
+ static public void AssertNull(string message, Object anObject)
+ {
+ NUnit.Framework.Assert.IsNull(anObject, message);
+ }
+
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an is thrown.
+ ///
+ static public void AssertSame(Object expected, Object actual)
+ {
+ NUnit.Framework.Assert.AreSame(expected, actual, string.Empty);
+ }
+
+ /// Asserts that two objects refer to the same object.
+ /// If they are not an is thrown.
+ ///
+ static public void AssertSame(string message, Object expected, Object actual)
+ {
+ NUnit.Framework.Assert.AreSame(expected, actual, message);
+ }
+
+ /// Fails a test with no message.
+ static public void Fail()
+ {
+ NUnit.Framework.Assert.Fail();
+ }
+
+ /// Fails a test with the given message.
+ static public void Fail(string message)
+ {
+ NUnit.Framework.Assert.Fail(message);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Libraries/NUnit.Framework/AssertionException.cs b/src/Libraries/NUnit.Framework/AssertionException.cs
new file mode 100644
index 0000000000..ec5fb5db22
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/AssertionException.cs
@@ -0,0 +1,68 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Thrown when an assertion failed.
+ ///
+ ///
+ [Serializable]
+ public class AssertionException : System.Exception
+ {
+ ///
+ ///
+ ///
+ ///
+ public AssertionException (string message) : base(message)
+ {}
+
+ ///
+ /// Standard constructor
+ ///
+ /// The error message that explains
+ /// the reason for the exception
+ /// The exception that caused the
+ /// current exception
+ public AssertionException(string message, Exception inner) :
+ base(message, inner)
+ {}
+
+ ///
+ /// Serialization Constructor
+ ///
+ protected AssertionException(SerializationInfo info,
+ StreamingContext context) : base(info,context)
+ {}
+
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/AssertionFailureMessage.cs b/src/Libraries/NUnit.Framework/AssertionFailureMessage.cs
new file mode 100644
index 0000000000..d337d01c22
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/AssertionFailureMessage.cs
@@ -0,0 +1,430 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig, Douglas de la Torre
+/************************************************************************************
+'
+' Copyright 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright 2000-2002 Philip A. Craig
+' Copyright 2001 Douglas de la Torre
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright 2002 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov
+' Copyright 2000-2002 Philip A. Craig, or Copyright 2001 Douglas de la Torre
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+using System.Text;
+using System.IO;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Summary description for AssertionFailureMessage.
+ ///
+ public class AssertionFailureMessage : StringWriter
+ {
+ #region Static Constants
+
+ ///
+ /// Number of characters before a highlighted position before
+ /// clipping will occur. Clipped text is replaced with an
+ /// elipsis "..."
+ ///
+ static public readonly int PreClipLength = 35;
+
+ ///
+ /// Number of characters after a highlighted position before
+ /// clipping will occur. Clipped text is replaced with an
+ /// elipsis "..."
+ ///
+ static public readonly int PostClipLength = 35;
+
+ static protected readonly string ExpectedText = "expected:<";
+ static protected readonly string ButWasText = " but was:<";
+
+ static private readonly string expectedFmt = "\texpected:<{0}>";
+ static private readonly string butWasFmt = "\t but was:<{0}>";
+ static private readonly string diffStringLengthsFmt
+ = "\tString lengths differ. Expected length={0}, but was length={1}.";
+ static private readonly string sameStringLengthsFmt
+ = "\tString lengths are both {0}.";
+ static private readonly string diffArrayLengthsFmt
+ = "Array lengths differ. Expected length={0}, but was length={1}.";
+ static private readonly string sameArrayLengthsFmt
+ = "Array lengths are both {0}.";
+ static private readonly string stringsDifferAtIndexFmt
+ = "\tStrings differ at index {0}.";
+ static private readonly string arraysDifferAtIndexFmt
+ = "Arrays differ at index {0}.";
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Construct an AssertionFailureMessage with a message
+ /// and optional arguments.
+ ///
+ ///
+ ///
+ public AssertionFailureMessage( string message, params object[] args )
+ : base( CreateStringBuilder( message, args ) ) { }
+
+ ///
+ /// Construct an empty AssertionFailureMessage
+ ///
+ public AssertionFailureMessage() : this( null, null ) { }
+
+ #endregion
+
+ ///
+ /// Display two lines that communicate the expected value, and the actual value
+ ///
+ /// The expected value
+ /// The actual value found
+ public void DisplayExpectedAndActual( Object expected, Object actual )
+ {
+ WriteLine();
+ Write( expectedFmt, DisplayString( expected ) );
+ WriteLine();
+ Write( butWasFmt, DisplayString( actual ) );
+ }
+
+ ///
+ /// Draws a marker under the expected/actual strings that highlights
+ /// where in the string a mismatch occurred.
+ ///
+ /// The position of the mismatch
+ public void DisplayPositionMarker( int iPosition )
+ {
+ WriteLine();
+ Write( "\t" + new String( '-', ButWasText.Length + 1 ) );
+ if( iPosition > 0 )
+ {
+ Write( new string( '-', iPosition ) );
+ }
+ Write( "^" );
+ }
+
+ ///
+ /// Reports whether the string lengths are the same or different, and
+ /// what the string lengths are.
+ ///
+ /// The expected string
+ /// The actual string value
+ protected void BuildStringLengthReport( string sExpected, string sActual )
+ {
+ WriteLine();
+ if( sExpected.Length != sActual.Length )
+ Write( diffStringLengthsFmt, sExpected.Length, sActual.Length );
+ else
+ Write( sameStringLengthsFmt, sExpected.Length );
+ }
+
+ ///
+ /// Called to create additional message lines when two objects have been
+ /// found to be unequal. If the inputs are strings, a special message is
+ /// rendered that can help track down where the strings are different,
+ /// based on differences in length, or differences in content.
+ ///
+ /// If the inputs are not strings, the ToString method of the objects
+ /// is used to show what is different about them.
+ ///
+ /// The expected value
+ /// The actual value
+ /// True if a case-insensitive comparison is being performed
+ public void DisplayDifferences( object expected, object actual, bool caseInsensitive )
+ {
+ if( InputsAreStrings( expected, actual ) )
+ {
+ DisplayStringDifferences(
+ (string)expected,
+ (string)actual,
+ caseInsensitive );
+ }
+ else
+ {
+ DisplayExpectedAndActual( expected, actual );
+ }
+ }
+
+ ///
+ /// Constructs a message that can be displayed when the content of two
+ /// strings are different, but the string lengths are the same. The
+ /// message will clip the strings to a reasonable length, centered
+ /// around the first position where they are mismatched, and draw
+ /// a line marking the position of the difference to make comparison
+ /// quicker.
+ ///
+ /// The expected string value
+ /// The actual string value
+ /// True if a case-insensitive comparison is being performed
+ protected void DisplayStringDifferences( string sExpected, string sActual, bool caseInsensitive )
+ {
+ //
+ // If they mismatch at a specified position, report the
+ // difference.
+ //
+ int iPosition = caseInsensitive
+ ? FindMismatchPosition( sExpected.ToLower(), sActual.ToLower(), 0 )
+ : FindMismatchPosition( sExpected, sActual, 0 );
+ //
+ // If the lengths differ, but they match up to the length,
+ // show the difference just past the length of the shorter
+ // string
+ //
+ if( iPosition == -1 )
+ iPosition = Math.Min( sExpected.Length, sActual.Length );
+
+ BuildStringLengthReport( sExpected, sActual );
+
+ WriteLine();
+ Write( stringsDifferAtIndexFmt, iPosition );
+
+ //
+ // Clips the strings, then turns any hidden whitespace into visible
+ // characters
+ //
+ string sClippedExpected = ConvertWhitespace(ClipAroundPosition( sExpected, iPosition ));
+ string sClippedActual = ConvertWhitespace(ClipAroundPosition( sActual, iPosition ));
+
+ DisplayExpectedAndActual(
+ sClippedExpected,
+ sClippedActual );
+
+ // Add a line showing where they differ. If the string lengths are
+ // different, they start differing just past the length of the
+ // shorter string
+ DisplayPositionMarker( caseInsensitive
+ ? FindMismatchPosition( sClippedExpected.ToLower(), sClippedActual.ToLower(), 0 )
+ : FindMismatchPosition( sClippedExpected, sClippedActual, 0 ) );
+ }
+
+ private void DisplayAdditionalElements( string label, Array array, int index, int max )
+ {
+ WriteLine();
+ Write( "{0}<", label );
+
+ for( int i = 0; i < max; i++ )
+ {
+ Write( DisplayString( array.GetValue(index++) ) );
+
+ if ( index >= array.Length )
+ break;
+
+ Write( "," );
+ }
+
+ if ( index < array.Length )
+ Write( "..." );
+
+ Write( ">" );
+ }
+
+ #region Static Methods
+
+ ///
+ /// Display an object as a string
+ ///
+ ///
+ ///
+ static protected string DisplayString( object obj )
+ {
+ if ( obj == null )
+ return "(null)";
+ else if ( obj is string )
+ return Quoted( (string)obj );
+ else
+ return obj.ToString();
+ }
+
+ ///
+ /// Quote a string
+ ///
+ ///
+ ///
+ static protected string Quoted( string text )
+ {
+ return string.Format( "\"{0}\"", text );
+ }
+
+ ///
+ /// Tests two objects to determine if they are strings.
+ ///
+ ///
+ ///
+ ///
+ static protected bool InputsAreStrings( Object expected, Object actual )
+ {
+ return expected != null && actual != null &&
+ expected is string && actual is string;
+ }
+
+ ///
+ /// Used to create a StringBuilder that is used for constructing
+ /// the output message when text is different. Handles initialization
+ /// when a message is provided. If message is null, an empty
+ /// StringBuilder is returned.
+ ///
+ ///
+ ///
+ ///
+ static protected StringBuilder CreateStringBuilder( string message, params object[] args )
+ {
+ if (message != null)
+ if ( args != null && args.Length > 0 )
+ return new StringBuilder( string.Format( message, args ) );
+ else
+ return new StringBuilder( message );
+ else
+ return new StringBuilder();
+ }
+
+ ///
+ /// Renders up to M characters before, and up to N characters after
+ /// the specified index position. If leading or trailing text is
+ /// clipped, and elipses "..." is added where the missing text would
+ /// be.
+ ///
+ /// Clips strings to limit previous or post newline characters,
+ /// since these mess up the comparison
+ ///
+ ///
+ ///
+ ///
+ static protected string ClipAroundPosition( string sString, int iPosition )
+ {
+ if( sString == null || sString.Length == 0 )
+ return "";
+
+ bool preClip = iPosition > PreClipLength;
+ bool postClip = iPosition + PostClipLength < sString.Length;
+
+ int start = preClip
+ ? iPosition - PreClipLength : 0;
+ int length = postClip
+ ? iPosition + PostClipLength - start : sString.Length - start;
+
+ if ( start + length > iPosition + PostClipLength )
+ length = iPosition + PostClipLength - start;
+
+ StringBuilder sb = new StringBuilder();
+ if ( preClip ) sb.Append("...");
+ sb.Append( sString.Substring( start, length ) );
+ if ( postClip ) sb.Append("...");
+
+ return sb.ToString();
+ }
+
+ ///
+ /// Shows the position two strings start to differ. Comparison
+ /// starts at the start index.
+ ///
+ ///
+ ///
+ ///
+ /// -1 if no mismatch found, or the index where mismatch found
+ static private int FindMismatchPosition( string sExpected, string sActual, int iStart )
+ {
+ int iLength = Math.Min( sExpected.Length, sActual.Length );
+ for( int i=iStart; i
+ /// Turns CR, LF, or TAB into visual indicator to preserve visual marker
+ /// position. This is done by replacing the '\r' into '\\' and 'r'
+ /// characters, and the '\n' into '\\' and 'n' characters, and '\t' into
+ /// '\\' and 't' characters.
+ ///
+ /// Thus the single character becomes two characters for display.
+ ///
+ ///
+ ///
+ static protected string ConvertWhitespace( string sInput )
+ {
+ if( null != sInput )
+ {
+ sInput = sInput.Replace( "\r", "\\r" );
+ sInput = sInput.Replace( "\n", "\\n" );
+ sInput = sInput.Replace( "\t", "\\t" );
+ }
+ return sInput;
+ }
+
+ ///
+ /// Called to create a message when two arrays are not equal.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ static public string FormatMessageForFailArraysNotEqual(int index, Array expected, Array actual,
+ string message, params object[] args)
+ {
+ AssertionFailureMessage msg = new AssertionFailureMessage( message, args );
+
+ msg.WriteLine();
+ if( expected.Length != actual.Length )
+ msg.Write( diffArrayLengthsFmt, expected.Length, actual.Length );
+ else
+ msg.Write( sameArrayLengthsFmt, expected.Length );
+
+ msg.WriteLine();
+ msg.Write( arraysDifferAtIndexFmt, index );
+
+ if ( index < expected.Length && index < actual.Length )
+ msg.DisplayDifferences( expected.GetValue( index ), actual.GetValue( index ), false );
+ else if( expected.Length < actual.Length )
+ msg.DisplayAdditionalElements( " extra:", actual, index, 3 );
+ else
+ msg.DisplayAdditionalElements( " missing:", expected, index, 3 );
+
+ return msg.ToString();
+ }
+
+ #endregion
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/CategoryAttribute.cs b/src/Libraries/NUnit.Framework/CategoryAttribute.cs
new file mode 100644
index 0000000000..d25118491b
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/CategoryAttribute.cs
@@ -0,0 +1,60 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Summary description for CategoryAttribute.
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple=true)]
+ public sealed class CategoryAttribute : Attribute
+ {
+ private string name;
+
+ ///
+ /// Construct attribute for a given category
+ ///
+ /// The name of the category
+ public CategoryAttribute(string name)
+ {
+ this.name = name;
+ }
+
+ ///
+ /// The name of the category
+ ///
+ public string Name
+ {
+ get { return name; }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/ComparisonAsserter.cs b/src/Libraries/NUnit.Framework/ComparisonAsserter.cs
new file mode 100644
index 0000000000..2f7fdda7c2
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/ComparisonAsserter.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Abstract class used as a base for asserters that compare
+ /// expected and an actual values in some way or another.
+ ///
+ public abstract class ComparisonAsserter : AbstractAsserter
+ {
+ ///
+ /// The expected value, used as the basis for comparison.
+ ///
+ protected object expected;
+
+ ///
+ /// The actual value to be compared.
+ ///
+ protected object actual;
+
+ ///
+ /// Constructs a ComparisonAsserter for two objects
+ ///
+ /// The expected value
+ /// The actual value
+ /// The message to issue on failure
+ /// Arguments to apply in formatting the message
+ public ComparisonAsserter( object expected, object actual, string message, params object[] args )
+ : base( message, args )
+ {
+ this.expected = expected;
+ this.actual = actual;
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/ConditionAsserters.cs b/src/Libraries/NUnit.Framework/ConditionAsserters.cs
new file mode 100644
index 0000000000..98b37edb32
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/ConditionAsserters.cs
@@ -0,0 +1,101 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// ConditionAsserter class represents an asssertion
+ /// that tests a particular condition, which is passed
+ /// to it in the constructor. The failure message is
+ /// not specialized in this class, but derived classes
+ /// are free to do so.
+ ///
+ public class ConditionAsserter : AbstractAsserter
+ {
+ ///
+ /// The condition we are testing
+ ///
+ protected bool condition;
+
+ ///
+ /// Constructor
+ ///
+ /// The condition to be tested
+ /// The message issued upon failure
+ /// Arguments to be used in formatting the message
+ public ConditionAsserter( bool condition, string message, params object[] args )
+ : base( message, args )
+ {
+ this.condition = condition;
+ }
+
+ ///
+ /// Assert the condition.
+ ///
+ public override void Assert()
+ {
+ if ( !condition )
+ NUnit.Framework.Assert.Fail( message, args );
+ }
+ }
+
+ ///
+ /// Class to assert that a condition is true
+ ///
+ public class TrueAsserter : ConditionAsserter
+ {
+ ///
+ /// Constructor
+ ///
+ /// The condition to assert
+ /// The message to issue on failure
+ /// Arguments to apply in formatting the message
+ public TrueAsserter( bool condition, string message, params object[] args )
+ : base( condition, message, args ) { }
+ }
+
+ ///
+ /// Class to assert that a condition is false
+ ///
+ public class FalseAsserter : ConditionAsserter
+ {
+ ///
+ /// Constructor
+ ///
+ /// The condition to assert
+ /// The message to issue on failure
+ /// Arguments to apply in formatting the message
+ public FalseAsserter( bool condition, string message, params object[] args )
+ : base( !condition, message, args ) { }
+
+ }
+
+ ///
+ /// Class to assert that an object is null
+ ///
+ public class NullAsserter : ConditionAsserter
+ {
+ ///
+ /// Constructor
+ ///
+ /// The object to test
+ /// The message to issue on failure
+ /// Arguments to apply in formatting the message
+ public NullAsserter( object anObject, string message, params object[] args )
+ : base( anObject == null, message, args ) { }
+ }
+
+ ///
+ /// Class to assert that an object is not null
+ ///
+ public class NotNullAsserter : ConditionAsserter
+ {
+ ///
+ /// Constructor
+ ///
+ /// The object to test
+ /// The message to issue on failure
+ /// Arguments to apply in formatting the message
+ public NotNullAsserter( object anObject, string message, params object[] args )
+ : base( anObject != null, message, args ) { }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/EqualAsserter.cs b/src/Libraries/NUnit.Framework/EqualAsserter.cs
new file mode 100644
index 0000000000..9465772f23
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/EqualAsserter.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Text;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Class to assert that two objects are equal
+ ///
+ public class EqualAsserter : EqualityAsserter
+ {
+ ///
+ /// Constructs an EqualAsserter for two objects
+ ///
+ /// The expected value
+ /// The actual value
+ /// The message to issue on failure
+ /// Arguments to apply in formatting the message
+ public EqualAsserter( object expected, object actual, string message, params object[] args )
+ : base( expected, actual, message, args ) { }
+
+ public EqualAsserter( double expected, double actual, double delta, string message, params object[] args )
+ : base( expected, actual, delta, message, args ) { }
+
+ ///
+ /// Assert that the objects are equal
+ ///
+ /// True if they are equal, false if not
+ public override void Assert()
+ {
+ if ( expected == null && actual == null ) return;
+ if ( expected == null || actual == null )
+ FailNotEqual();
+
+ // For now, dynamically call array assertion if necessary. Try to move
+ // this into the ObjectsEqual method later on.
+ if ( expected.GetType().IsArray && actual.GetType().IsArray )
+ {
+ Array expectedArray = expected as Array;
+ Array actualArray = actual as Array;
+
+ if ( expectedArray.Rank != actualArray.Rank )
+ FailNotEqual();
+
+ if ( expectedArray.Rank != 1 )
+ NUnit.Framework.Assert.Fail( "Multi-dimension array comparison is not supported" );
+
+ int iLength = Math.Min( expectedArray.Length, actualArray.Length );
+ for( int i = 0; i < iLength; i++ )
+ if ( !ObjectsEqual( expectedArray.GetValue( i ), actualArray.GetValue( i ) ) )
+ FailArraysNotEqual( i );
+
+ if ( expectedArray.Length != actualArray.Length )
+ FailArraysNotEqual( iLength );
+ }
+ else
+ {
+ if ( !ObjectsEqual( expected, actual ) )
+ FailNotEqual();
+ }
+ }
+
+ private void FailNotEqual()
+ {
+ AssertionFailureMessage msg = new AssertionFailureMessage( message, args );
+ msg.DisplayDifferences( expected, actual, false );
+ throw new AssertionException( msg.ToString() );
+ }
+
+ private void FailArraysNotEqual( int index )
+ {
+ throw new AssertionException(
+ AssertionFailureMessage.FormatMessageForFailArraysNotEqual(
+ index,
+ (Array)expected,
+ (Array)actual,
+ message,
+ args ) );
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/EqualityAsserter.cs b/src/Libraries/NUnit.Framework/EqualityAsserter.cs
new file mode 100644
index 0000000000..3c9e40247c
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/EqualityAsserter.cs
@@ -0,0 +1,131 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Abstract base class for EqualsAsserter and NotEqualsAsserter
+ ///
+ public abstract class EqualityAsserter : ComparisonAsserter
+ {
+ private double delta;
+
+ public EqualityAsserter( object expected, object actual, string message, params object[] args )
+ : base( expected, actual, message, args ) { }
+
+ public EqualityAsserter( double expected, double actual, double delta, string message, params object[] args )
+ : base( expected, actual, message, args )
+ {
+ this.delta = delta;
+ }
+
+ ///
+ /// Used to compare two objects. Two nulls are equal and null
+ /// is not equal to non-null. Comparisons between the same
+ /// numeric types are fine (Int32 to Int32, or Int64 to Int64),
+ /// but the Equals method fails across different types so we
+ /// use ToString and compare the results.
+ ///
+ ///
+ ///
+ ///
+ protected virtual bool ObjectsEqual( Object expected, Object actual )
+ {
+ if ( expected == null && actual == null ) return true;
+ if ( expected == null || actual == null ) return false;
+
+ //if ( expected.GetType().IsArray && actual.GetType().IsArray )
+ // return ArraysEqual( (System.Array)expected, (System.Array)actual );
+
+ if ( expected is double && actual is double )
+ {
+ // handle infinity specially since subtracting two infinite values gives
+ // NaN and the following test fails. mono also needs NaN to be handled
+ // specially although ms.net could use either method.
+ if (double.IsInfinity((double)expected) || double.IsNaN((double)expected) || double.IsNaN((double)actual))
+ return (double)expected == (double)actual;
+ else
+ return Math.Abs((double)expected-(double)actual) <= this.delta;
+ }
+
+ // if ( expected is float && actual is float )
+ // {
+ // // handle infinity specially since subtracting two infinite values gives
+ // // NaN and the following test fails. mono also needs NaN to be handled
+ // // specially although ms.net could use either method.
+ // if (float.IsInfinity((float)expected) || float.IsNaN((float)expected) || float.IsNaN((float)actual))
+ // return (float)expected == (float)actual;
+ // else
+ // return Math.Abs((float)expected-(float)actual) <= (float)this.delta;
+ // }
+
+ if ( expected.GetType() != actual.GetType() &&
+ IsNumericType( expected ) && IsNumericType( actual ) )
+ {
+ //
+ // Convert to strings and compare result to avoid
+ // issues with different types that have the same
+ // value
+ //
+ string sExpected = expected.ToString();
+ string sActual = actual.ToString();
+ return sExpected.Equals( sActual );
+ }
+ return expected.Equals(actual);
+ }
+
+ ///
+ /// Checks the type of the object, returning true if
+ /// the object is a numeric type.
+ ///
+ /// The object to check
+ /// true if the object is a numeric type
+ private bool IsNumericType( Object obj )
+ {
+ if( null != obj )
+ {
+ if( obj is byte ) return true;
+ if( obj is sbyte ) return true;
+ if( obj is decimal ) return true;
+ if( obj is double ) return true;
+ if( obj is float ) return true;
+ if( obj is int ) return true;
+ if( obj is uint ) return true;
+ if( obj is long ) return true;
+ if( obj is short ) return true;
+ if( obj is ushort ) return true;
+
+ if( obj is System.Byte ) return true;
+ if( obj is System.SByte ) return true;
+ if( obj is System.Decimal ) return true;
+ if( obj is System.Double ) return true;
+ if( obj is System.Single ) return true;
+ if( obj is System.Int32 ) return true;
+ if( obj is System.UInt32 ) return true;
+ if( obj is System.Int64 ) return true;
+ if( obj is System.UInt64 ) return true;
+ if( obj is System.Int16 ) return true;
+ if( obj is System.UInt16 ) return true;
+ }
+ return false;
+ }
+
+ protected virtual bool ArraysEqual( Array expected, Array actual )
+ {
+ if ( expected.Rank != actual.Rank )
+ return false;
+
+ if ( expected.Rank != 1 )
+ throw new ArgumentException( "Multi-dimension array comparison is not supported" );
+
+ int iLength = Math.Min( expected.Length, actual.Length );
+ for( int i = 0; i < iLength; i++ )
+ if ( !ObjectsEqual( expected.GetValue( i ), actual.GetValue( i ) ) )
+ return false;
+
+ if ( expected.Length != actual.Length )
+ return false;
+
+ return true;
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/ExpectedExceptionAttribute.cs b/src/Libraries/NUnit.Framework/ExpectedExceptionAttribute.cs
new file mode 100644
index 0000000000..07c0e7c011
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/ExpectedExceptionAttribute.cs
@@ -0,0 +1,82 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ ///
+ /// ExpectedAttributeException.
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public sealed class ExpectedExceptionAttribute : Attribute
+ {
+ private Type expectedException;
+ private string expectedMessage;
+
+ ///
+ /// Constructor for a given type of exception
+ ///
+ ///
+ public ExpectedExceptionAttribute(Type exceptionType)
+ {
+ expectedException = exceptionType;
+ }
+
+ ///
+ /// Constructor for a given type of exception and expected message text
+ ///
+ ///
+ ///
+ public ExpectedExceptionAttribute(Type exceptionType, string expectedMessage)
+ {
+ expectedException = exceptionType;
+ this.expectedMessage = expectedMessage;
+ }
+
+ ///
+ /// The expected exception type
+ ///
+ public Type ExceptionType
+ {
+ get{ return expectedException; }
+ set{ expectedException = value; }
+ }
+
+ ///
+ /// The expected message
+ ///
+ public string ExpectedMessage
+ {
+ get { return expectedMessage; }
+ set { expectedMessage = value; }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/ExplicitAttribute.cs b/src/Libraries/NUnit.Framework/ExplicitAttribute.cs
new file mode 100644
index 0000000000..d96ded7378
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/ExplicitAttribute.cs
@@ -0,0 +1,21 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// ExplicitAttribute marks a test or test fixture so that it will
+ /// only be run if explicitly executed from the gui or command line
+ /// or if it is included by use of a filter. The test will not be
+ /// run simply because an enclosing suite is run.
+ ///
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple=false)]
+ public sealed class ExplicitAttribute : Attribute
+ {
+ ///
+ /// Constructor
+ ///
+ public ExplicitAttribute()
+ {
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/IAsserter.cs b/src/Libraries/NUnit.Framework/IAsserter.cs
new file mode 100644
index 0000000000..6a0bc5acdc
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/IAsserter.cs
@@ -0,0 +1,23 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// The interface implemented by an asserter. Asserters
+ /// encapsulate a condition test and generation of an
+ /// AssertionException with a tailored message. They
+ /// are used by the Assert class as helper objects.
+ ///
+ /// User-defined asserters may be passed to the
+ /// Assert.DoAssert method in order to implement
+ /// extended asserts.
+ ///
+ public interface IAsserter
+ {
+ ///
+ /// Assert the truth of the condition, throwing an
+ /// exception if the condition is false.
+ ///
+ void Assert();
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/IgnoreAttribute.cs b/src/Libraries/NUnit.Framework/IgnoreAttribute.cs
new file mode 100644
index 0000000000..7d4fc629c0
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/IgnoreAttribute.cs
@@ -0,0 +1,59 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+ ///
+ /// IgnoreAttribute.
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Method|AttributeTargets.Class, AllowMultiple=false)]
+ public sealed class IgnoreAttribute : Attribute
+ {
+ private string reason;
+
+ ///
+ /// Constructor
+ ///
+ ///
+ public IgnoreAttribute(string reason)
+ {
+ this.reason = reason;
+ }
+
+ ///
+ /// The reason for ignoring a test
+ ///
+ public string Reason
+ {
+ get { return reason; }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/IgnoreException.cs b/src/Libraries/NUnit.Framework/IgnoreException.cs
new file mode 100644
index 0000000000..b2007631bf
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/IgnoreException.cs
@@ -0,0 +1,68 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Thrown when an assertion failed.
+ ///
+ ///
+ [Serializable]
+ public class IgnoreException : System.Exception
+ {
+ ///
+ ///
+ ///
+ ///
+ public IgnoreException (string message) : base(message)
+ {}
+
+ ///
+ /// Standard constructor
+ ///
+ /// The error message that explains
+ /// the reason for the exception
+ /// The exception that caused the
+ /// current exception
+ public IgnoreException(string message, Exception inner) :
+ base(message, inner)
+ {}
+
+ ///
+ /// Serialization Constructor
+ ///
+ protected IgnoreException(SerializationInfo info,
+ StreamingContext context) : base(info,context)
+ {}
+
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/NotEqualAsserter.cs b/src/Libraries/NUnit.Framework/NotEqualAsserter.cs
new file mode 100644
index 0000000000..b7ce2cda16
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/NotEqualAsserter.cs
@@ -0,0 +1,32 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Summary description for NotEqualAsserter.
+ ///
+ public class NotEqualAsserter : EqualityAsserter
+ {
+ public NotEqualAsserter( object expected, object actual, string message, params object[] args )
+ : base( expected, actual, message, args ) { }
+
+ public override void Assert()
+ {
+ if ( expected == null && actual == null ) Fail();
+ if ( expected == null || actual == null ) return;
+
+ if ( expected.GetType().IsArray && actual.GetType().IsArray )
+ {
+ if ( ArraysEqual( (Array)expected, (Array)actual ) )
+ Fail();
+ }
+ else if ( ObjectsEqual( expected, actual ) )
+ Fail();
+ }
+
+ public bool Fail()
+ {
+ throw new AssertionException( FormattedMessage );
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/NotSameAsserter.cs b/src/Libraries/NUnit.Framework/NotSameAsserter.cs
new file mode 100644
index 0000000000..a1e66ab97f
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/NotSameAsserter.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Asserter that verifies two objects are different.
+ ///
+ public class NotSameAsserter : ComparisonAsserter
+ {
+ ///
+ /// Construct a NotSameAsserter object
+ ///
+ /// The expected value
+ /// The actual value
+ /// A user-defined message for use in reporting errors
+ /// Arguments to be used in formatting the user-defined message
+ public NotSameAsserter( object expected, object actual, string message, params object[] args)
+ : base( expected, actual, message, args ) { }
+
+ ///
+ /// Assert that the objects are different
+ ///
+ public override void Assert()
+ {
+ if ( object.ReferenceEquals( expected, actual ) )
+ {
+ string formatted = FormattedMessage;
+ if ( formatted.Length > 0 )
+ formatted += " ";
+
+ throw new AssertionException( formatted + "expected not same" );
+ }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/OldTestCase.cs b/src/Libraries/NUnit.Framework/OldTestCase.cs
new file mode 100644
index 0000000000..eac597b03f
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/OldTestCase.cs
@@ -0,0 +1,58 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ ///
+ /// TestFixture
+ ///
+ ///
+ [TestFixture]
+ [Obsolete("use TestFixture attribute instead of inheritance",false)]
+ public class TestCase : Assertion
+ {
+ ///
+ /// SetUp method
+ ///
+ [SetUp]
+ [Obsolete("use SetUp attribute instead of naming convention",false)]
+ protected virtual void SetUp()
+ {}
+
+ ///
+ /// TearDown method
+ ///
+ [TearDown]
+ [Obsolete("use TearDown attribute instead of naming convention",false)]
+ protected virtual void TearDown()
+ {}
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/PlatformAttribute.cs b/src/Libraries/NUnit.Framework/PlatformAttribute.cs
new file mode 100644
index 0000000000..6cf9459a99
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/PlatformAttribute.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Text;
+
+namespace NUnit.Framework
+{
+ ///
+ /// PlatformAttribute is used to mark a test fixture or an
+ /// individual method as applying to a particular platform only.
+ ///
+ [AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple=false)]
+ public sealed class PlatformAttribute : Attribute
+ {
+ private string include;
+ private string exclude;
+
+ public PlatformAttribute() { }
+
+ public PlatformAttribute( string platforms )
+ {
+ this.include = platforms;
+ }
+
+ ///
+ /// Name of the platform that is needed in order for
+ /// a test to run. Multiple platforms may be given,
+ /// separated by a comma.
+ ///
+ public string Include
+ {
+ get { return this.include; }
+ set { include = value; }
+ }
+
+ ///
+ /// Name of the platform to be excluded. Multiple platforms
+ /// may be given, separated by a comma.
+ ///
+ public string Exclude
+ {
+ get { return this.exclude; }
+ set { this.exclude = value; }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/SameAsserter.cs b/src/Libraries/NUnit.Framework/SameAsserter.cs
new file mode 100644
index 0000000000..aac0e38e5b
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/SameAsserter.cs
@@ -0,0 +1,35 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Asserter that verifies two objects are the same.
+ ///
+ public class SameAsserter : ComparisonAsserter
+ {
+ ///
+ /// Construct a SameAsserter object
+ ///
+ /// The expected value
+ /// The actual value
+ /// A user-defined message for use in reporting errors
+ /// Arguments to be used in formatting the user-defined message
+ public SameAsserter( object expected, object actual, string message, params object[] args )
+ : base( expected, actual, message, args ) { }
+
+ ///
+ /// Assert that the objects are the same
+ ///
+ public override void Assert()
+ {
+ if ( ! object.ReferenceEquals( expected, actual ) )
+ {
+ string formatted = FormattedMessage;
+ if ( formatted.Length > 0 )
+ formatted += " ";
+
+ throw new AssertionException( formatted + "expected same" );
+ }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/SetUpAttribute.cs b/src/Libraries/NUnit.Framework/SetUpAttribute.cs
new file mode 100644
index 0000000000..0897c8b3d5
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/SetUpAttribute.cs
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+ ///
+ /// SetUpAttribute.
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public sealed class SetUpAttribute : Attribute
+ {}
+}
diff --git a/src/Libraries/NUnit.Framework/SuiteAttribute.cs b/src/Libraries/NUnit.Framework/SuiteAttribute.cs
new file mode 100644
index 0000000000..d1d67b6c2c
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/SuiteAttribute.cs
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+ ///
+ /// SuiteAttribute.
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Property, AllowMultiple=false)]
+ public sealed class SuiteAttribute : Attribute
+ {}
+}
diff --git a/src/Libraries/NUnit.Framework/SuiteBuilderAttribute.cs b/src/Libraries/NUnit.Framework/SuiteBuilderAttribute.cs
new file mode 100644
index 0000000000..37f4cd29d7
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/SuiteBuilderAttribute.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace NUnit.Framework
+{
+ ///
+ /// SuiteBuilderAttribute is used to mark custom suite builders.
+ /// The class so marked must implement the ISuiteBuilder interface.
+ ///
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)]
+ public sealed class SuiteBuilderAttribute : Attribute
+ {}
+}
diff --git a/src/Libraries/NUnit.Framework/TearDownAttribute.cs b/src/Libraries/NUnit.Framework/TearDownAttribute.cs
new file mode 100644
index 0000000000..ad105963a7
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/TearDownAttribute.cs
@@ -0,0 +1,40 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+ ///
+ /// TearDownAttribute.
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public sealed class TearDownAttribute : Attribute
+ {}
+}
diff --git a/src/Libraries/NUnit.Framework/TestAttribute.cs b/src/Libraries/NUnit.Framework/TestAttribute.cs
new file mode 100644
index 0000000000..016d5de284
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/TestAttribute.cs
@@ -0,0 +1,69 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov,
+' Charlie Poole or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ ///
+ /// Adding this attribute to a method within a
+ /// class makes the method callable from the NUnit test runner. There is a property
+ /// called Description which is optional which you can provide a more detailed test
+ /// description. This class cannot be inherited.
+ ///
+ ///
+ ///
+ /// [TestFixture]
+ /// public class Fixture
+ /// {
+ /// [Test]
+ /// public void MethodToTest()
+ /// {}
+ ///
+ /// [Test(Description = "more detailed description")]
+ /// publc void TestDescriptionMethod()
+ /// {}
+ /// }
+ ///
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public sealed class TestAttribute : Attribute
+ {
+ private string description;
+
+ ///
+ /// Descriptive text for this test
+ ///
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/TestContext.cs b/src/Libraries/NUnit.Framework/TestContext.cs
new file mode 100644
index 0000000000..087b3deb03
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/TestContext.cs
@@ -0,0 +1,103 @@
+using System;
+using System.Diagnostics;
+
+namespace NUnit.Framework
+{
+ ///
+ /// Experimental class with static settings that affect tests.
+ /// A setings may be saved and restored. Currently only
+ /// one setting - Tracing - is available.
+ ///
+ public class TestContext
+ {
+ ///
+ /// The current context, head of the list of saved contexts.
+ ///
+ private static ContextHolder current = new ContextHolder();
+
+ public static bool Tracing
+ {
+ get { return current.Tracing; }
+ set { current.Tracing = value; }
+ }
+
+ ///
+ /// Saves the old context and makes a fresh one
+ /// current without changing any settings.
+ ///
+ public static void Save()
+ {
+ TestContext.current = new ContextHolder( current );
+ }
+
+ ///
+ /// Restores the last saved context and puts
+ /// any saved settings back into effect.
+ ///
+ public static void Restore()
+ {
+ current.ReverseChanges();
+ current = current.prior;
+ }
+
+ private TestContext() { }
+
+ private class ContextHolder
+ {
+ ///
+ /// Indicates whether trace is enabled
+ ///
+ private bool tracing;
+
+ ///
+ /// Link to a prior saved context
+ ///
+ public ContextHolder prior;
+
+ public ContextHolder()
+ {
+ this.prior = null;
+ this.tracing = false;
+ }
+
+ public ContextHolder( ContextHolder other )
+ {
+ this.prior = other;
+ this.tracing = other.tracing;
+ }
+
+ ///
+ /// Used to restore settings to their prior
+ /// values before reverting to a prior context.
+ ///
+ public void ReverseChanges()
+ {
+ if ( prior == null )
+ throw new InvalidOperationException( "TestContext: too many Restores" );
+
+ this.Tracing = prior.Tracing;
+ }
+
+ ///
+ /// Controls whether trace and debug output are written
+ /// to the standard output.
+ ///
+ public bool Tracing
+ {
+ get { return tracing; }
+ set
+ {
+ if ( tracing != value )
+ {
+ tracing = value;
+ if ( tracing )
+ Trace.Listeners.Add( new TextWriterTraceListener( Console.Out, "NUnit" ) );
+ else
+ Trace.Listeners.Remove( "NUnit" );
+ }
+ }
+ }
+
+ }
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/TestFixtureAttribute.cs b/src/Libraries/NUnit.Framework/TestFixtureAttribute.cs
new file mode 100644
index 0000000000..d899d11d42
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/TestFixtureAttribute.cs
@@ -0,0 +1,56 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ ///
+ /// TestFixtureAttribute
+ ///
+ ///
+ /// [TestFixture]
+ /// public class ExampleClass
+ /// {}
+ ///
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple=false, Inherited=true)]
+ public sealed class TestFixtureAttribute : Attribute
+ {
+ private string description;
+
+ ///
+ /// Descriptive text for this fixture
+ ///
+ public string Description
+ {
+ get { return description; }
+ set { description = value; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Libraries/NUnit.Framework/TestFixtureSetUpAttribute.cs b/src/Libraries/NUnit.Framework/TestFixtureSetUpAttribute.cs
new file mode 100644
index 0000000000..56a8964aaf
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/TestFixtureSetUpAttribute.cs
@@ -0,0 +1,41 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ ///
+ /// TestFixtureSetUpAttribute
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class TestFixtureSetUpAttribute : Attribute
+ {
+ }
+}
diff --git a/src/Libraries/NUnit.Framework/TestFixtureTearDownAttribute.cs b/src/Libraries/NUnit.Framework/TestFixtureTearDownAttribute.cs
new file mode 100644
index 0000000000..87fbdc3704
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/TestFixtureTearDownAttribute.cs
@@ -0,0 +1,42 @@
+#region Copyright (c) 2002-2003, James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole, Philip A. Craig
+/************************************************************************************
+'
+' Copyright © 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' Copyright © 2000-2003 Philip A. Craig
+'
+' This software is provided 'as-is', without any express or implied warranty. In no
+' event will the authors be held liable for any damages arising from the use of this
+' software.
+'
+' Permission is granted to anyone to use this software for any purpose, including
+' commercial applications, and to alter it and redistribute it freely, subject to the
+' following restrictions:
+'
+' 1. The origin of this software must not be misrepresented; you must not claim that
+' you wrote the original software. If you use this software in a product, an
+' acknowledgment (see the following) in the product documentation is required.
+'
+' Portions Copyright © 2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole
+' or Copyright © 2000-2003 Philip A. Craig
+'
+' 2. Altered source versions must be plainly marked as such, and must not be
+' misrepresented as being the original software.
+'
+' 3. This notice may not be removed or altered from any source distribution.
+'
+'***********************************************************************************/
+#endregion
+
+namespace NUnit.Framework
+{
+ using System;
+
+ ///
+ /// TestFixtureTearDownAttribute
+ ///
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple=false)]
+ public class TestFixtureTearDownAttribute : Attribute
+ {
+ }
+}
+
diff --git a/src/Libraries/NUnit.Framework/nunit.framework.build b/src/Libraries/NUnit.Framework/nunit.framework.build
new file mode 100644
index 0000000000..120014c4c6
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/nunit.framework.build
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Libraries/NUnit.Framework/nunit.framework.dll.csproj b/src/Libraries/NUnit.Framework/nunit.framework.dll.csproj
new file mode 100644
index 0000000000..dc0270dbd1
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/nunit.framework.dll.csproj
@@ -0,0 +1,143 @@
+
+
+ Local
+ 8.0.41115
+ 2.0
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382}
+ Debug
+ AnyCPU
+ nunit.framework
+ JScript
+ Grid
+ IE50
+ nunit.key
+ Library
+ NUnit.Framework
+ OnBuildSuccess
+ True
+ File
+ ..\..\..\bin\
+ false
+ 285212672
+ false
+ TRACE;StronglyNamedAssembly
+ false
+ 4096
+ false
+ true
+ false
+ false
+ false
+ 4
+
+
+
+
+
+
+ System
+
+
+ System.Data
+
+
+ System.XML
+
+
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+ Code
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Libraries/NUnit.Framework/nunit.framework.dll.csproj.user b/src/Libraries/NUnit.Framework/nunit.framework.dll.csproj.user
new file mode 100644
index 0000000000..e1d33e369a
--- /dev/null
+++ b/src/Libraries/NUnit.Framework/nunit.framework.dll.csproj.user
@@ -0,0 +1,7 @@
+
+
+ 8.0.41115
+ ProjectFiles
+ 0
+
+
\ No newline at end of file
diff --git a/src/Libraries/NUnit.Framework/nunit.key b/src/Libraries/NUnit.Framework/nunit.key
new file mode 100644
index 0000000000..733af42455
Binary files /dev/null and b/src/Libraries/NUnit.Framework/nunit.key differ
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index 9dd26cfb97..164cc84506 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -30,7 +30,7 @@
4
-
+
..\RequiredLibraries\ICSharpCode.SharpZipLib.dll
False
diff --git a/src/SharpDevelop.sln b/src/SharpDevelop.sln
index 1515b49639..cf62c55a51 100644
--- a/src/SharpDevelop.sln
+++ b/src/SharpDevelop.sln
@@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
-# SharpDevelop 2.0.0.373
+# SharpDevelop 2.0.0.377
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@@ -58,6 +58,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll", "Libraries\NUnit.Framework\nunit.framework.dll.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
+EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Build.Tasks", "Libraries\ICSharpCode.Build.Tasks\Project\ICSharpCode.Build.Tasks.csproj", "{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}"
@@ -182,6 +184,7 @@ Global
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
+ {83DD7E12-A705-4DBA-9D71-09C8973D9382} = {9421EDF4-9769-4BE9-B5A6-C87DE221D73C}
{1152B71B-3C05-4598-B20D-823B5D40559E} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
{2748AD25-9C63-4E12-877B-4DCE96FBED54} = {5A3EBEBA-0560-41C1-966B-23F7D03A5486}
diff --git a/src/Tools/Tools.build b/src/Tools/Tools.build
index bf8f4b5322..6fd0cd947a 100644
--- a/src/Tools/Tools.build
+++ b/src/Tools/Tools.build
@@ -10,6 +10,9 @@
+
+
+
@@ -22,6 +25,7 @@
-->
+