nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #00120
[Merge] lp:~a-schlapsi/nunit-3.0/bug-432805 into lp:nunit-3.0
Andreas Schlapsi has proposed merging lp:~a-schlapsi/nunit-3.0/bug-432805 into lp:nunit-3.0.
Requested reviews:
Charlie Poole (charlie.poole)
Related bugs:
#432805 Some Framework Tests don't run on Linux
https://bugs.launchpad.net/bugs/432805
--
https://code.launchpad.net/~a-schlapsi/nunit-3.0/bug-432805/+merge/12496
Your team NUnit Developers is subscribed to branch lp:nunit-3.0.
=== modified file 'src/framework/NUnit/Framework/Text.cs'
--- src/framework/NUnit/Framework/Text.cs 2009-09-22 01:07:21 +0000
+++ src/framework/NUnit/Framework/Text.cs 2009-09-27 21:25:19 +0000
@@ -1,161 +1,161 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-using NUnit.Framework.Constraints;
-
-namespace NUnit.Framework
-{
- /// <summary>
- /// Helper class with static methods used to supply constraints
- /// that operate on strings.
- /// </summary>
- [Obsolete("Use Is class for string constraints")]
- public class Text
- {
- #region All
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them succeed.
- /// </summary>
- [Obsolete("Use Is.All")]
- public static ConstraintExpression All
- {
- get { return new ConstraintExpression().All; }
- }
-
- #endregion
-
- #region Contains
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- [Obsolete("Use Is.StringContaining")]
- public static SubstringConstraint Contains(string expected)
- {
- return new SubstringConstraint(expected);
- }
-
- #endregion
-
- #region DoesNotContain
-
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- [Obsolete("Use Is.Not.StringContaining")]
- public static SubstringConstraint DoesNotContain(string expected)
- {
- return new ConstraintExpression().Not.ContainsSubstring(expected);
- }
-
- #endregion
-
- #region DoesNotStartWith
-
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public static StartsWithConstraint DoesNotStartWith(string expected)
- {
- return new ConstraintExpression().Not.StartsWith(expected);
- }
-
- #endregion
-
- #region EndsWith
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- [Obsolete("Use Is.StringEnding")]
- public static EndsWithConstraint EndsWith(string expected)
- {
- return new EndsWithConstraint(expected);
- }
-
- #endregion
-
- #region DoesNotEndWith
-
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public static EndsWithConstraint DoesNotEndWith(string expected)
- {
- return new ConstraintExpression().Not.EndsWith(expected);
- }
-
- #endregion
-
- #region Matches
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value matches the regular expression supplied as an argument.
- /// </summary>
- [Obsolete("Use Is.StringMatching")]
- public static RegexConstraint Matches(string pattern)
- {
- return new RegexConstraint(pattern);
- }
-#endif
-
- #endregion
-
- #region DoesNotMatch
-
-#if !NUNITLITE
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value matches the pattern supplied as an argument.
- /// </summary>
- [Obsolete]
- public static RegexConstraint DoesNotMatch(string pattern)
- {
- return new ConstraintExpression().Not.Matches(pattern);
- }
-#endif
-
- #endregion
-
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Helper class with static methods used to supply constraints
+ /// that operate on strings.
+ /// </summary>
+ [Obsolete("Use Is class for string constraints")]
+ public class Text
+ {
+ #region All
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+ [Obsolete("Use Is.All")]
+public static ConstraintExpression All
+ {
+ get { return new ConstraintExpression().All; }
+ }
+
+ #endregion
+
+ #region Contains
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+ [Obsolete("Use Is.StringContaining")]
+public static SubstringConstraint Contains(string expected)
+ {
+ return new SubstringConstraint(expected);
+ }
+
+ #endregion
+
+ #region DoesNotContain
+
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+ [Obsolete("Use Is.Not.StringContaining")]
+public static SubstringConstraint DoesNotContain(string expected)
+ {
+ return new ConstraintExpression().Not.ContainsSubstring(expected);
+ }
+
+ #endregion
+
+ #region DoesNotStartWith
+
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public static StartsWithConstraint DoesNotStartWith(string expected)
+ {
+ return new ConstraintExpression().Not.StartsWith(expected);
+ }
+
+ #endregion
+
+ #region EndsWith
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+ [Obsolete("Use Is.StringEnding")]
+public static EndsWithConstraint EndsWith(string expected)
+ {
+ return new EndsWithConstraint(expected);
+ }
+
+ #endregion
+
+ #region DoesNotEndWith
+
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public static EndsWithConstraint DoesNotEndWith(string expected)
+ {
+ return new ConstraintExpression().Not.EndsWith(expected);
+ }
+
+ #endregion
+
+ #region Matches
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value matches the regular expression supplied as an argument.
+ /// </summary>
+ [Obsolete("Use Is.StringMatching")]
+public static RegexConstraint Matches(string pattern)
+ {
+ return new RegexConstraint(pattern);
+ }
+#endif
+
+ #endregion
+
+ #region DoesNotMatch
+
+#if !NUNITLITE
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value matches the pattern supplied as an argument.
+ /// </summary>
+ [Obsolete]
+public static RegexConstraint DoesNotMatch(string pattern)
+ {
+ return new ConstraintExpression().Not.Matches(pattern);
+ }
+#endif
+
+ #endregion
+
+ }
+}
=== modified file 'src/framework/Shared/Framework/Assert.cs'
--- src/framework/Shared/Framework/Assert.cs 2009-09-22 01:07:21 +0000
+++ src/framework/Shared/Framework/Assert.cs 2009-09-27 21:25:19 +0000
@@ -1,3698 +1,3698 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-using System.ComponentModel;
-using NUnit.Framework.Constraints;
-
-namespace NUnit.Framework
-{
- /// <summary>
- /// Delegate used by tests that execute code and
- /// capture any thrown exception.
- /// </summary>
- public delegate void TestDelegate();
-
- /// <summary>
- /// The Assert class contains a collection of static methods that
- /// implement the most common assertions used in NUnit.
- /// </summary>
- public class Assert
- {
- #region Constructor
-
- /// <summary>
- /// We don't actually want any instances of this object, but some people
- /// like to inherit from it to add other static methods. Hence, the
- /// protected constructor disallows any instances of this object.
- /// </summary>
- protected Assert() { }
-
- #endregion
-
- #region Assert Counting
-
- private static int counter = 0;
-
- /// <summary>
- /// Gets the number of assertions executed so far and
- /// resets the counter to zero.
- /// </summary>
- public static int Counter
- {
- get
- {
- int cnt = counter;
- counter = 0;
- return cnt;
- }
- }
-
- private static void IncrementAssertCount()
- {
- ++counter;
- }
-
- #endregion
-
- #region Equals and ReferenceEquals
-
-#if !NETCF
- /// <summary>
- /// The Equals method throws an AssertionException. This is done
- /// to make sure there is no mistake by calling this function.
- /// </summary>
- /// <param name="a"></param>
- /// <param name="b"></param>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public static new bool Equals(object a, object b)
- {
- throw new InvalidOperationException("Assert.Equals should not be used for Assertions");
- }
-
- /// <summary>
- /// override the default ReferenceEquals to throw an AssertionException. This
- /// implementation makes sure there is no mistake in calling this function
- /// as part of Assert.
- /// </summary>
- /// <param name="a"></param>
- /// <param name="b"></param>
- public static new void ReferenceEquals(object a, object b)
- {
- throw new InvalidOperationException("Assert.ReferenceEquals should not be used for Assertions");
- }
-#endif
-
- #endregion
-
- #region Utility Asserts
-
- #region Pass
-
-#if !NUNITLITE
- /// <summary>
- /// Throws a <see cref="SuccessException"/> with the message and arguments
- /// that are passed in. This allows a test to be cut short, with a result
- /// of success returned to NUnit.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void Pass(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 SuccessException(message);
- }
-
- /// <summary>
- /// Throws a <see cref="SuccessException"/> with the message and arguments
- /// that are passed in. This allows a test to be cut short, with a result
- /// of success returned to NUnit.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
- static public void Pass(string message)
- {
- Assert.Pass(message, null);
- }
-
- /// <summary>
- /// Throws a <see cref="SuccessException"/> with the message and arguments
- /// that are passed in. This allows a test to be cut short, with a result
- /// of success returned to NUnit.
- /// </summary>
- static public void Pass()
- {
- Assert.Pass(string.Empty, null);
- }
-#endif
- #endregion
-
- #region Fail
-
- /// <summary>
- /// Throws an <see cref="AssertionException"/> with the message and arguments
- /// that are passed in. This is used by the other Assert functions.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void Fail(string message, params object[] args)
- {
- if (message == null) message = string.Empty;
- else if (args != null && args.Length > 0)
- message = string.Format(message, args);
-
- throw new AssertionException(message);
- }
-
- /// <summary>
- /// Throws an <see cref="AssertionException"/> with the message that is
- /// passed in. This is used by the other Assert functions.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
- static public void Fail(string message)
- {
- Assert.Fail(message, null);
- }
-
- /// <summary>
- /// Throws an <see cref="AssertionException"/>.
- /// This is used by the other Assert functions.
- /// </summary>
- static public void Fail()
- {
- Assert.Fail(string.Empty, null);
- }
-
- #endregion
-
- #region Ignore
-
-#if !NUNITLITE
- /// <summary>
- /// Throws an <see cref="IgnoreException"/> with the message and arguments
- /// that are passed in. This causes the test to be reported as ignored.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void Ignore(string message, params object[] args)
- {
- if (message == null) message = string.Empty;
- else if (args != null && args.Length > 0)
- message = string.Format(message, args);
-
- throw new IgnoreException(message);
- }
-
- /// <summary>
- /// Throws an <see cref="IgnoreException"/> with the message that is
- /// passed in. This causes the test to be reported as ignored.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
- static public void Ignore(string message)
- {
- Assert.Ignore(message, null);
- }
-
- /// <summary>
- /// Throws an <see cref="IgnoreException"/>.
- /// This causes the test to be reported as ignored.
- /// </summary>
- static public void Ignore()
- {
- Assert.Ignore(string.Empty, null);
- }
-#endif
-
- #endregion
-
- #region InConclusive
-
-#if !NUNITLITE
- /// <summary>
- /// Throws an <see cref="InconclusiveException"/> with the message and arguments
- /// that are passed in. This causes the test to be reported as inconclusive.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void Inconclusive(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 InconclusiveException(message);
- }
-
- /// <summary>
- /// Throws an <see cref="InconclusiveException"/> with the message that is
- /// passed in. This causes the test to be reported as inconclusive.
- /// </summary>
- /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param>
- static public void Inconclusive(string message)
- {
- Assert.Inconclusive(message, null);
- }
-
- /// <summary>
- /// Throws an <see cref="InconclusiveException"/>.
- /// This causes the test to be reported as Inconclusive.
- /// </summary>
- static public void Inconclusive()
- {
- Assert.Inconclusive(string.Empty, null);
- }
-#endif
-
- #endregion
-
- #endregion
-
- #region Assert.That
-
- #region Object
- /// <summary>
- /// Apply a constraint to an actual value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="expression">A Constraint to be applied</param>
- /// <param name="actual">The actual value to test</param>
- static public void That(object actual, IResolveConstraint expression)
- {
- Assert.That(actual, expression, null, null);
- }
-
- /// <summary>
- /// Apply a constraint to an actual value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="expression">A Constraint to be applied</param>
- /// <param name="actual">The actual value to test</param>
- /// <param name="message">The message that will be displayed on failure</param>
- static public void That(object actual, IResolveConstraint expression, string message)
- {
- Assert.That(actual, expression, message, null);
- }
-
- /// <summary>
- /// Apply a constraint to an actual value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="expression">A Constraint expression to be applied</param>
- /// <param name="actual">The actual value to test</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void That(object actual, IResolveConstraint expression, string message, params object[] args)
- {
- Constraint constraint = expression.Resolve();
-
- Assert.IncrementAssertCount();
- if (!constraint.Matches(actual))
- {
- MessageWriter writer = new TextMessageWriter(message, args);
- constraint.WriteMessageTo(writer);
- throw new AssertionException(writer.ToString());
- }
- }
- #endregion
-
- #region ActualValueDelegate
-#if !NUNITLITE
- /// <summary>
- /// Apply a constraint to an actual value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="expr">A Constraint expression to be applied</param>
- /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
- static public void That(ActualValueDelegate del, IResolveConstraint expr)
- {
- Assert.That(del, expr.Resolve(), null, null);
- }
-
- /// <summary>
- /// Apply a constraint to an actual value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="expr">A Constraint expression to be applied</param>
- /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
- /// <param name="message">The message that will be displayed on failure</param>
- static public void That(ActualValueDelegate del, IResolveConstraint expr, string message)
- {
- Assert.That(del, expr.Resolve(), message, null);
- }
-
- /// <summary>
- /// Apply a constraint to an actual value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
- /// <param name="expr">A Constraint expression to be applied</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args)
- {
- Constraint constraint = expr.Resolve();
-
- Assert.IncrementAssertCount();
- if (!constraint.Matches(del))
- {
- MessageWriter writer = new TextMessageWriter(message, args);
- constraint.WriteMessageTo(writer);
- throw new AssertionException(writer.ToString());
- }
- }
-#endif
- #endregion
-
- #region ref Object
-#if CLR_2_0
- /// <summary>
- /// Apply a constraint to a referenced value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="actual">The actual value to test</param>
- /// <param name="expression">A Constraint to be applied</param>
- static public void That<T>(ref T actual, IResolveConstraint expression)
- {
- Assert.That(ref actual, expression, null, null);
- }
-
- /// <summary>
- /// Apply a constraint to a referenced value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="actual">The actual value to test</param>
- /// <param name="expression">A Constraint to be applied</param>
- /// <param name="message">The message that will be displayed on failure</param>
- static public void That<T>(ref T actual, IResolveConstraint expression, string message)
- {
- Assert.That(ref actual, expression, message, null);
- }
-
- /// <summary>
- /// Apply a constraint to a referenced value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="actual">The actual value to test</param>
- /// <param name="expression">A Constraint to be applied</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args)
- {
- Constraint constraint = expression.Resolve();
-
- Assert.IncrementAssertCount();
- if (!constraint.Matches(ref actual))
- {
- MessageWriter writer = new TextMessageWriter(message, args);
- constraint.WriteMessageTo(writer);
- throw new AssertionException(writer.ToString());
- }
- }
-#else
- /// <summary>
- /// Apply a constraint to a referenced boolean, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="actual">The actual value to test</param>
- /// <param name="expression">A Constraint to be applied</param>
- static public void That(ref bool actual, IResolveConstraint expression)
- {
- Assert.That(ref actual, expression, null, null);
- }
-
- /// <summary>
- /// Apply a constraint to a referenced value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="actual">The actual value to test</param>
- /// <param name="expression">A Constraint to be applied</param>
- /// <param name="message">The message that will be displayed on failure</param>
- static public void That(ref bool actual, IResolveConstraint expression, string message)
- {
- Assert.That(ref actual, expression, message, null);
- }
-
- /// <summary>
- /// Apply a constraint to a referenced value, succeeding if the constraint
- /// is satisfied and throwing an assertion exception on failure.
- /// </summary>
- /// <param name="actual">The actual value to test</param>
- /// <param name="expression">A Constraint to be applied</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args)
- {
- Constraint constraint = expression.Resolve();
-
- Assert.IncrementAssertCount();
- if (!constraint.Matches(ref actual))
- {
- MessageWriter writer = new TextMessageWriter(message, args);
- constraint.WriteMessageTo(writer);
- throw new AssertionException(writer.ToString());
- }
- }
-#endif
- #endregion
-
- #region Boolean
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display if the condition is false</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- static public void That(bool condition, string message, params object[] args)
- {
- Assert.That(condition, Is.True, message, args);
- }
-
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display if the condition is false</param>
- static public void That(bool condition, string message)
- {
- Assert.That(condition, Is.True, message, null);
- }
-
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- static public void That(bool condition)
- {
- Assert.That(condition, Is.True, null, null);
- }
- #endregion
-
- /// <summary>
- /// Asserts that the code represented by a delegate throws an exception
- /// that satisfies the constraint provided.
- /// </summary>
- /// <param name="code">A TestDelegate to be executed</param>
- /// <param name="constraint">A ThrowsConstraint used in the test</param>
- static public void That(TestDelegate code, IResolveConstraint constraint)
- {
- Assert.That((object)code, constraint);
- }
- #endregion
-
- #region Throws, Catch and DoesNotThrow
-
- #region Throws
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <param name="expression">A constraint to be satisfied by the exception</param>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message, params object[] args)
- {
- Exception caughtException = null;
-
- try
- {
- code();
- }
- catch (Exception ex)
- {
- caughtException = ex;
- }
-
- Assert.That(caughtException, expression, message, args);
-
- return caughtException;
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <param name="expression">A constraint to be satisfied by the exception</param>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message)
- {
- return Throws(expression, code, message, null);
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <param name="expression">A constraint to be satisfied by the exception</param>
- /// <param name="code">A TestSnippet delegate</param>
- public static Exception Throws(IResolveConstraint expression, TestDelegate code)
- {
- return Throws(expression, code, string.Empty, null);
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <param name="expectedExceptionType">The exception Type expected</param>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
- {
- return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, args);
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <param name="expectedExceptionType">The exception Type expected</param>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message)
- {
- return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, null);
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <param name="expectedExceptionType">The exception Type expected</param>
- /// <param name="code">A TestSnippet delegate</param>
- public static Exception Throws(Type expectedExceptionType, TestDelegate code)
- {
- return Throws(new ExactTypeConstraint(expectedExceptionType), code, string.Empty, null);
- }
-
- #endregion
-
- #region Throws<T>
-#if CLR_2_0
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <typeparam name="T">Type of the expected exception</typeparam>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static T Throws<T>(TestDelegate code, string message, params object[] args) where T : Exception
- {
- return (T)Throws(typeof(T), code, message, args);
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <typeparam name="T">Type of the expected exception</typeparam>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static T Throws<T>(TestDelegate code, string message) where T : Exception
- {
- return Throws<T>(code, message, null);
- }
-
- /// <summary>
- /// Verifies that a delegate throws a particular exception when called.
- /// </summary>
- /// <typeparam name="T">Type of the expected exception</typeparam>
- /// <param name="code">A TestSnippet delegate</param>
- public static T Throws<T>(TestDelegate code) where T : Exception
- {
- return Throws<T>(code, string.Empty, null);
- }
-#endif
- #endregion
-
- #region Catch
- /// <summary>
- /// Verifies that a delegate throws an exception when called
- /// and returns it.
- /// </summary>
- /// <param name="code">A TestDelegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static Exception Catch(TestDelegate code, string message, params object[] args)
- {
- return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message, args);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception when called
- /// and returns it.
- /// </summary>
- /// <param name="code">A TestDelegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static Exception Catch(TestDelegate code, string message)
- {
- return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception when called
- /// and returns it.
- /// </summary>
- /// <param name="code">A TestDelegate</param>
- public static Exception Catch(TestDelegate code)
- {
- return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception of a certain Type
- /// or one derived from it when called and returns it.
- /// </summary>
- /// <param name="expectedExceptionType">The expected Exception Type</param>
- /// <param name="code">A TestDelegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
- {
- return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message, args);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception of a certain Type
- /// or one derived from it when called and returns it.
- /// </summary>
- /// <param name="expectedExceptionType">The expected Exception Type</param>
- /// <param name="code">A TestDelegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message)
- {
- return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception of a certain Type
- /// or one derived from it when called and returns it.
- /// </summary>
- /// <param name="expectedExceptionType">The expected Exception Type</param>
- /// <param name="code">A TestDelegate</param>
- public static Exception Catch(Type expectedExceptionType, TestDelegate code)
- {
- return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code);
- }
- #endregion
-
- #region Catch<T>
-#if CLR_2_0
- /// <summary>
- /// Verifies that a delegate throws an exception of a certain Type
- /// or one derived from it when called and returns it.
- /// </summary>
- /// <param name="code">A TestDelegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static T Catch<T>(TestDelegate code, string message, params object[] args) where T : System.Exception
- {
- return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message, args);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception of a certain Type
- /// or one derived from it when called and returns it.
- /// </summary>
- /// <param name="code">A TestDelegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static T Catch<T>(TestDelegate code, string message) where T : System.Exception
- {
- return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message);
- }
-
- /// <summary>
- /// Verifies that a delegate throws an exception of a certain Type
- /// or one derived from it when called and returns it.
- /// </summary>
- /// <param name="code">A TestDelegate</param>
- public static T Catch<T>(TestDelegate code) where T : System.Exception
- {
- return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code);
- }
-#endif
- #endregion
-
- #region DoesNotThrow
-
- /// <summary>
- /// Verifies that a delegate does not throw an exception
- /// </summary>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- /// <param name="args">Arguments to be used in formatting the message</param>
- public static void DoesNotThrow(TestDelegate code, string message, params object[] args)
- {
- try
- {
- code();
- }
- catch (Exception ex)
- {
- TextMessageWriter writer = new TextMessageWriter(message, args);
- writer.WriteLine("Unexpected exception: {0}", ex.GetType());
- Assert.Fail(writer.ToString());
- }
- }
-
- /// <summary>
- /// Verifies that a delegate does not throw an exception.
- /// </summary>
- /// <param name="code">A TestSnippet delegate</param>
- /// <param name="message">The message that will be displayed on failure</param>
- public static void DoesNotThrow(TestDelegate code, string message)
- {
- DoesNotThrow(code, message, null);
- }
-
- /// <summary>
- /// Verifies that a delegate does not throw an exception.
- /// </summary>
- /// <param name="code">A TestSnippet delegate</param>
- public static void DoesNotThrow(TestDelegate code)
- {
- DoesNotThrow(code, string.Empty, null);
- }
-
- #endregion
-
- #endregion
-
- #region True
-
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void True(bool condition, string message, params object[] args)
- {
- Assert.That(condition, Is.True ,message, args);
- }
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void True(bool condition, string message)
- {
- Assert.That(condition, Is.True ,message, null);
- }
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- public static void True(bool condition)
- {
- Assert.That(condition, Is.True ,null, null);
- }
-
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsTrue(bool condition, string message, params object[] args)
- {
- Assert.That(condition, Is.True ,message, args);
- }
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsTrue(bool condition, string message)
- {
- Assert.That(condition, Is.True ,message, null);
- }
- /// <summary>
- /// Asserts that a condition is true. If the condition is false the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- public static void IsTrue(bool condition)
- {
- Assert.That(condition, Is.True ,null, null);
- }
-
- #endregion
-
- #region False
-
- /// <summary>
- /// Asserts that a condition is false. If the condition is true the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void False(bool condition, string message, params object[] args)
- {
- Assert.That(condition, Is.False ,message, args);
- }
- /// <summary>
- /// Asserts that a condition is false. If the condition is true the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void False(bool condition, string message)
- {
- Assert.That(condition, Is.False ,message, null);
- }
- /// <summary>
- /// Asserts that a condition is false. If the condition is true the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- public static void False(bool condition)
- {
- Assert.That(condition, Is.False ,null, null);
- }
-
- /// <summary>
- /// Asserts that a condition is false. If the condition is true the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsFalse(bool condition, string message, params object[] args)
- {
- Assert.That(condition, Is.False ,message, args);
- }
- /// <summary>
- /// Asserts that a condition is false. If the condition is true the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsFalse(bool condition, string message)
- {
- Assert.That(condition, Is.False ,message, null);
- }
- /// <summary>
- /// Asserts that a condition is false. If the condition is true the method throws
- /// an <see cref="AssertionException"/>.
- /// </summary>
- /// <param name="condition">The evaluated condition</param>
- public static void IsFalse(bool condition)
- {
- Assert.That(condition, Is.False ,null, null);
- }
-
- #endregion
-
- #region NotNull
-
- /// <summary>
- /// Verifies that the object that is passed in is not equal to <code>null</code>
- /// If the object is <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void NotNull(object anObject, string message, params object[] args)
- {
- Assert.That(anObject, Is.Not.Null ,message, args);
- }
- /// <summary>
- /// Verifies that the object that is passed in is not equal to <code>null</code>
- /// If the object is <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void NotNull(object anObject, string message)
- {
- Assert.That(anObject, Is.Not.Null ,message, null);
- }
- /// <summary>
- /// Verifies that the object that is passed in is not equal to <code>null</code>
- /// If the object is <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- public static void NotNull(object anObject)
- {
- Assert.That(anObject, Is.Not.Null ,null, null);
- }
-
- /// <summary>
- /// Verifies that the object that is passed in is not equal to <code>null</code>
- /// If the object is <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotNull(object anObject, string message, params object[] args)
- {
- Assert.That(anObject, Is.Not.Null ,message, args);
- }
- /// <summary>
- /// Verifies that the object that is passed in is not equal to <code>null</code>
- /// If the object is <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotNull(object anObject, string message)
- {
- Assert.That(anObject, Is.Not.Null ,message, null);
- }
- /// <summary>
- /// Verifies that the object that is passed in is not equal to <code>null</code>
- /// If the object is <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- public static void IsNotNull(object anObject)
- {
- Assert.That(anObject, Is.Not.Null ,null, null);
- }
-
- #endregion
-
- #region Null
-
- /// <summary>
- /// Verifies that the object that is passed in is equal to <code>null</code>
- /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Null(object anObject, string message, params object[] args)
- {
- Assert.That(anObject, Is.Null ,message, args);
- }
- /// <summary>
- /// Verifies that the object that is passed in is equal to <code>null</code>
- /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Null(object anObject, string message)
- {
- Assert.That(anObject, Is.Null ,message, null);
- }
- /// <summary>
- /// Verifies that the object that is passed in is equal to <code>null</code>
- /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- public static void Null(object anObject)
- {
- Assert.That(anObject, Is.Null ,null, null);
- }
-
- /// <summary>
- /// Verifies that the object that is passed in is equal to <code>null</code>
- /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNull(object anObject, string message, params object[] args)
- {
- Assert.That(anObject, Is.Null ,message, args);
- }
- /// <summary>
- /// Verifies that the object that is passed in is equal to <code>null</code>
- /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNull(object anObject, string message)
- {
- Assert.That(anObject, Is.Null ,message, null);
- }
- /// <summary>
- /// Verifies that the object that is passed in is equal to <code>null</code>
- /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="anObject">The object that is to be tested</param>
- public static void IsNull(object anObject)
- {
- Assert.That(anObject, Is.Null ,null, null);
- }
-
- #endregion
-
- #region IsNaN
-
-#if !NUNITLITE
- /// <summary>
- /// Verifies that the double that is passed in is an <code>NaN</code> value.
- /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="aDouble">The value that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNaN(double aDouble, string message, params object[] args)
- {
- Assert.That(aDouble, Is.NaN ,message, args);
- }
- /// <summary>
- /// Verifies that the double that is passed in is an <code>NaN</code> value.
- /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="aDouble">The value that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNaN(double aDouble, string message)
- {
- Assert.That(aDouble, Is.NaN ,message, null);
- }
- /// <summary>
- /// Verifies that the double that is passed in is an <code>NaN</code> value.
- /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="aDouble">The value that is to be tested</param>
- public static void IsNaN(double aDouble)
- {
- Assert.That(aDouble, Is.NaN ,null, null);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Verifies that the double that is passed in is an <code>NaN</code> value.
- /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="aDouble">The value that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNaN(double? aDouble, string message, params object[] args)
- {
- Assert.That(aDouble, Is.NaN ,message, args);
- }
- /// <summary>
- /// Verifies that the double that is passed in is an <code>NaN</code> value.
- /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="aDouble">The value that is to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNaN(double? aDouble, string message)
- {
- Assert.That(aDouble, Is.NaN ,message, null);
- }
- /// <summary>
- /// Verifies that the double that is passed in is an <code>NaN</code> value.
- /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
- /// is thrown.
- /// </summary>
- /// <param name="aDouble">The value that is to be tested</param>
- public static void IsNaN(double? aDouble)
- {
- Assert.That(aDouble, Is.NaN ,null, null);
- }
-#endif
-#endif
-
- #endregion
-
- #region IsEmpty
-
-#if !NUNITLITE
- /// <summary>
- /// Assert that a string is empty - that is equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsEmpty(string aString, string message, params object[] args)
- {
- Assert.That(aString, new EmptyStringConstraint() ,message, args);
- }
- /// <summary>
- /// Assert that a string is empty - that is equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsEmpty(string aString, string message)
- {
- Assert.That(aString, new EmptyStringConstraint() ,message, null);
- }
- /// <summary>
- /// Assert that a string is empty - that is equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- public static void IsEmpty(string aString)
- {
- Assert.That(aString, new EmptyStringConstraint() ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsEmpty
-
-#if !NUNITLITE
- /// <summary>
- /// Assert that an array, list or other collection is empty
- /// </summary>
- /// <param name="collection">An array, list or other collection implementing ICollection</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsEmpty(ICollection collection, string message, params object[] args)
- {
- Assert.That(collection, new EmptyCollectionConstraint() ,message, args);
- }
- /// <summary>
- /// Assert that an array, list or other collection is empty
- /// </summary>
- /// <param name="collection">An array, list or other collection implementing ICollection</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsEmpty(ICollection collection, string message)
- {
- Assert.That(collection, new EmptyCollectionConstraint() ,message, null);
- }
- /// <summary>
- /// Assert that an array, list or other collection is empty
- /// </summary>
- /// <param name="collection">An array, list or other collection implementing ICollection</param>
- public static void IsEmpty(ICollection collection)
- {
- Assert.That(collection, new EmptyCollectionConstraint() ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsNotEmpty
-
-#if !NUNITLITE
- /// <summary>
- /// Assert that a string is not empty - that is not equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotEmpty(string aString, string message, params object[] args)
- {
- Assert.That(aString, Is.Not.Empty ,message, args);
- }
- /// <summary>
- /// Assert that a string is not empty - that is not equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotEmpty(string aString, string message)
- {
- Assert.That(aString, Is.Not.Empty ,message, null);
- }
- /// <summary>
- /// Assert that a string is not empty - that is not equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- public static void IsNotEmpty(string aString)
- {
- Assert.That(aString, Is.Not.Empty ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsNotEmpty
-
-#if !NUNITLITE
- /// <summary>
- /// Assert that an array, list or other collection is not empty
- /// </summary>
- /// <param name="collection">An array, list or other collection implementing ICollection</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotEmpty(ICollection collection, string message, params object[] args)
- {
- Assert.That(collection, Is.Not.Empty ,message, args);
- }
- /// <summary>
- /// Assert that an array, list or other collection is not empty
- /// </summary>
- /// <param name="collection">An array, list or other collection implementing ICollection</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotEmpty(ICollection collection, string message)
- {
- Assert.That(collection, Is.Not.Empty ,message, null);
- }
- /// <summary>
- /// Assert that an array, list or other collection is not empty
- /// </summary>
- /// <param name="collection">An array, list or other collection implementing ICollection</param>
- public static void IsNotEmpty(ICollection collection)
- {
- Assert.That(collection, Is.Not.Empty ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsNullOrEmpty
-
-#if !NUNITLITE
- /// <summary>
- /// Assert that a string is either null or equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNullOrEmpty(string aString, string message, params object[] args)
- {
- Assert.That(aString, new NullOrEmptyStringConstraint() ,message, args);
- }
- /// <summary>
- /// Assert that a string is either null or equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNullOrEmpty(string aString, string message)
- {
- Assert.That(aString, new NullOrEmptyStringConstraint() ,message, null);
- }
- /// <summary>
- /// Assert that a string is either null or equal to string.Empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- public static void IsNullOrEmpty(string aString)
- {
- Assert.That(aString, new NullOrEmptyStringConstraint() ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsNotNullOrEmpty
-
-#if !NUNITLITE
- /// <summary>
- /// Assert that a string is not null or empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotNullOrEmpty(string aString, string message, params object[] args)
- {
- Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,message, args);
- }
- /// <summary>
- /// Assert that a string is not null or empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotNullOrEmpty(string aString, string message)
- {
- Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,message, null);
- }
- /// <summary>
- /// Assert that a string is not null or empty
- /// </summary>
- /// <param name="aString">The string to be tested</param>
- public static void IsNotNullOrEmpty(string aString)
- {
- Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsAssignableFrom
-
-#if !NUNITLITE
- /// <summary>
- /// Asserts that an object may be assigned a value of a given Type.
- /// </summary>
- /// <param name="expected">The expected Type.</param>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsAssignableFrom(Type expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.AssignableFrom(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object may be assigned a value of a given Type.
- /// </summary>
- /// <param name="expected">The expected Type.</param>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsAssignableFrom(Type expected, object actual, string message)
- {
- Assert.That(actual, Is.AssignableFrom(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object may be assigned a value of a given Type.
- /// </summary>
- /// <param name="expected">The expected Type.</param>
- /// <param name="actual">The object under examination</param>
- public static void IsAssignableFrom(Type expected, object actual)
- {
- Assert.That(actual, Is.AssignableFrom(expected) ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsAssignableFrom<T>
-
-#if !NUNITLITE
-#if CLR_2_0
- /// <summary>
- /// Asserts that an object may be assigned a value of a given Type.
- /// </summary>
- /// <typeparam name="T">The expected Type.</typeparam>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsAssignableFrom<T>(object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.AssignableFrom(typeof(T)) ,message, args);
- }
- /// <summary>
- /// Asserts that an object may be assigned a value of a given Type.
- /// </summary>
- /// <typeparam name="T">The expected Type.</typeparam>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsAssignableFrom<T>(object actual, string message)
- {
- Assert.That(actual, Is.AssignableFrom(typeof(T)) ,message, null);
- }
- /// <summary>
- /// Asserts that an object may be assigned a value of a given Type.
- /// </summary>
- /// <typeparam name="T">The expected Type.</typeparam>
- /// <param name="actual">The object under examination</param>
- public static void IsAssignableFrom<T>(object actual)
- {
- Assert.That(actual, Is.AssignableFrom(typeof(T)) ,null, null);
- }
-#endif
-#endif
-
- #endregion
-
- #region IsNotAssignableFrom
-
-#if !NUNITLITE
- /// <summary>
- /// Asserts that an object may not be assigned a value of a given Type.
- /// </summary>
- /// <param name="expected">The expected Type.</param>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotAssignableFrom(Type expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.AssignableFrom(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object may not be assigned a value of a given Type.
- /// </summary>
- /// <param name="expected">The expected Type.</param>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotAssignableFrom(Type expected, object actual, string message)
- {
- Assert.That(actual, Is.Not.AssignableFrom(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object may not be assigned a value of a given Type.
- /// </summary>
- /// <param name="expected">The expected Type.</param>
- /// <param name="actual">The object under examination</param>
- public static void IsNotAssignableFrom(Type expected, object actual)
- {
- Assert.That(actual, Is.Not.AssignableFrom(expected) ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsNotAssignableFrom<T>
-
-#if !NUNITLITE
-#if CLR_2_0
- /// <summary>
- /// Asserts that an object may not be assigned a value of a given Type.
- /// </summary>
- /// <typeparam name="T">The expected Type.</typeparam>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotAssignableFrom<T>(object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,message, args);
- }
- /// <summary>
- /// Asserts that an object may not be assigned a value of a given Type.
- /// </summary>
- /// <typeparam name="T">The expected Type.</typeparam>
- /// <param name="actual">The object under examination</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotAssignableFrom<T>(object actual, string message)
- {
- Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,message, null);
- }
- /// <summary>
- /// Asserts that an object may not be assigned a value of a given Type.
- /// </summary>
- /// <typeparam name="T">The expected Type.</typeparam>
- /// <param name="actual">The object under examination</param>
- public static void IsNotAssignableFrom<T>(object actual)
- {
- Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,null, null);
- }
-#endif
-#endif
-
- #endregion
-
- #region IsInstanceOf
-
-#if !NUNITLITE
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsInstanceOf(Type expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.InstanceOf(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsInstanceOf(Type expected, object actual, string message)
- {
- Assert.That(actual, Is.InstanceOf(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- public static void IsInstanceOf(Type expected, object actual)
- {
- Assert.That(actual, Is.InstanceOf(expected) ,null, null);
- }
-
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [Obsolete]
- public static void IsInstanceOfType(Type expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.InstanceOf(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- [Obsolete]
- public static void IsInstanceOfType(Type expected, object actual, string message)
- {
- Assert.That(actual, Is.InstanceOf(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- [Obsolete]
- public static void IsInstanceOfType(Type expected, object actual)
- {
- Assert.That(actual, Is.InstanceOf(expected) ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsInstanceOf<T>
-
-#if !NUNITLITE
-#if CLR_2_0
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <typeparam name="T">The expected Type</typeparam>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsInstanceOf<T>(object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.InstanceOf(typeof(T)) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <typeparam name="T">The expected Type</typeparam>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsInstanceOf<T>(object actual, string message)
- {
- Assert.That(actual, Is.InstanceOf(typeof(T)) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is an instance of a given type.
- /// </summary>
- /// <typeparam name="T">The expected Type</typeparam>
- /// <param name="actual">The object being examined</param>
- public static void IsInstanceOf<T>(object actual)
- {
- Assert.That(actual, Is.InstanceOf(typeof(T)) ,null, null);
- }
-#endif
-#endif
-
- #endregion
-
- #region IsNotInstanceOf
-
-#if !NUNITLITE
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotInstanceOf(Type expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.InstanceOf(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotInstanceOf(Type expected, object actual, string message)
- {
- Assert.That(actual, Is.Not.InstanceOf(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- public static void IsNotInstanceOf(Type expected, object actual)
- {
- Assert.That(actual, Is.Not.InstanceOf(expected) ,null, null);
- }
-
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [Obsolete]
- public static void IsNotInstanceOfType(Type expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.InstanceOf(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- [Obsolete]
- public static void IsNotInstanceOfType(Type expected, object actual, string message)
- {
- Assert.That(actual, Is.Not.InstanceOf(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <param name="expected">The expected Type</param>
- /// <param name="actual">The object being examined</param>
- [Obsolete]
- public static void IsNotInstanceOfType(Type expected, object actual)
- {
- Assert.That(actual, Is.Not.InstanceOf(expected) ,null, null);
- }
-#endif
-
- #endregion
-
- #region IsNotInstanceOf<T>
-
-#if !NUNITLITE
-#if CLR_2_0
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <typeparam name="T">The expected Type</typeparam>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void IsNotInstanceOf<T>(object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <typeparam name="T">The expected Type</typeparam>
- /// <param name="actual">The object being examined</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void IsNotInstanceOf<T>(object actual, string message)
- {
- Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is not an instance of a given type.
- /// </summary>
- /// <typeparam name="T">The expected Type</typeparam>
- /// <param name="actual">The object being examined</param>
- public static void IsNotInstanceOf<T>(object actual)
- {
- Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,null, null);
- }
-#endif
-#endif
-
- #endregion
-
- #region AreEqual
-
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreEqual(int expected, int actual, string message, params object[] args)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreEqual(int expected, int actual, string message)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreEqual(int expected, int actual)
- {
- Assert.That(actual, Is.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreEqual(long expected, long actual, string message, params object[] args)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreEqual(long expected, long actual, string message)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreEqual(long expected, long actual)
- {
- Assert.That(actual, Is.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void AreEqual(uint expected, uint actual, string message, params object[] args)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void AreEqual(uint expected, uint actual, string message)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- [CLSCompliant(false)]
- public static void AreEqual(uint expected, uint actual)
- {
- Assert.That(actual, Is.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void AreEqual(ulong expected, ulong actual, string message, params object[] args)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void AreEqual(ulong expected, ulong actual, string message)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- [CLSCompliant(false)]
- public static void AreEqual(ulong expected, ulong actual)
- {
- Assert.That(actual, Is.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreEqual(decimal expected, decimal actual, string message, params object[] args)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreEqual(decimal expected, decimal actual, string message)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are equal. If they are not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreEqual(decimal expected, decimal actual)
- {
- Assert.That(actual, Is.EqualTo(expected) ,null, null);
- }
-
- #endregion
-
- #region AreEqual
-
- /// <summary>
- /// Verifies that two doubles are equal considering a delta. If the
- /// expected value is infinity then the delta value is ignored. If
- /// they are not equal then an <see cref="AssertionException"/> is
- /// thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreEqual(double expected, double actual, double delta, string message, params object[] args)
- {
- AssertDoublesAreEqual(expected, actual, delta ,message, args);
- }
- /// <summary>
- /// Verifies that two doubles are equal considering a delta. If the
- /// expected value is infinity then the delta value is ignored. If
- /// they are not equal then an <see cref="AssertionException"/> is
- /// thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreEqual(double expected, double actual, double delta, string message)
- {
- AssertDoublesAreEqual(expected, actual, delta ,message, null);
- }
- /// <summary>
- /// Verifies that two doubles are equal considering a delta. If the
- /// expected value is infinity then the delta value is ignored. If
- /// they are not equal then an <see cref="AssertionException"/> is
- /// thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- public static void AreEqual(double expected, double actual, double delta)
- {
- AssertDoublesAreEqual(expected, actual, delta ,null, null);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Verifies that two doubles are equal considering a delta. If the
- /// expected value is infinity then the delta value is ignored. If
- /// they are not equal then an <see cref="AssertionException"/> is
- /// thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreEqual(double expected, double? actual, double delta, string message, params object[] args)
- {
- AssertDoublesAreEqual(expected, (double)actual, delta ,message, args);
- }
- /// <summary>
- /// Verifies that two doubles are equal considering a delta. If the
- /// expected value is infinity then the delta value is ignored. If
- /// they are not equal then an <see cref="AssertionException"/> is
- /// thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreEqual(double expected, double? actual, double delta, string message)
- {
- AssertDoublesAreEqual(expected, (double)actual, delta ,message, null);
- }
- /// <summary>
- /// Verifies that two doubles are equal considering a delta. If the
- /// expected value is infinity then the delta value is ignored. If
- /// they are not equal then an <see cref="AssertionException"/> is
- /// thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- public static void AreEqual(double expected, double? actual, double delta)
- {
- AssertDoublesAreEqual(expected, (double)actual, delta ,null, null);
- }
-#endif
-
- #endregion
-
- #region AreEqual
-
- /// <summary>
- /// Verifies that two objects are equal. Two objects are considered
- /// equal if both are null, or if both have the same value. NUnit
- /// has special semantics for some object types.
- /// If they are not equal an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The value that is expected</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreEqual(object expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two objects are equal. Two objects are considered
- /// equal if both are null, or if both have the same value. NUnit
- /// has special semantics for some object types.
- /// If they are not equal an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The value that is expected</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreEqual(object expected, object actual, string message)
- {
- Assert.That(actual, Is.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two objects are equal. Two objects are considered
- /// equal if both are null, or if both have the same value. NUnit
- /// has special semantics for some object types.
- /// If they are not equal an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The value that is expected</param>
- /// <param name="actual">The actual value</param>
- public static void AreEqual(object expected, object actual)
- {
- Assert.That(actual, Is.EqualTo(expected) ,null, null);
- }
-
- #endregion
-
- #region AreNotEqual
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotEqual(int expected, int actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotEqual(int expected, int actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreNotEqual(int expected, int actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotEqual(long expected, long actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotEqual(long expected, long actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreNotEqual(long expected, long actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void AreNotEqual(uint expected, uint actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void AreNotEqual(uint expected, uint actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- [CLSCompliant(false)]
- public static void AreNotEqual(uint expected, uint actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void AreNotEqual(ulong expected, ulong actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- [CLSCompliant(false)]
- public static void AreNotEqual(ulong expected, ulong actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotEqual(decimal expected, decimal actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotEqual(decimal expected, decimal actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreNotEqual(decimal expected, decimal actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotEqual(float expected, float actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotEqual(float expected, float actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreNotEqual(float expected, float actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotEqual(double expected, double actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotEqual(double expected, double actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two values are not equal. If they are equal, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- public static void AreNotEqual(double expected, double actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- #endregion
-
- #region AreNotEqual
-
- /// <summary>
- /// Verifies that two objects are not equal. Two objects are considered
- /// equal if both are null, or if both have the same value. NUnit
- /// has special semantics for some object types.
- /// If they are equal an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The value that is expected</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotEqual(object expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
- }
- /// <summary>
- /// Verifies that two objects are not equal. Two objects are considered
- /// equal if both are null, or if both have the same value. NUnit
- /// has special semantics for some object types.
- /// If they are equal an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The value that is expected</param>
- /// <param name="actual">The actual value</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotEqual(object expected, object actual, string message)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
- }
- /// <summary>
- /// Verifies that two objects are not equal. Two objects are considered
- /// equal if both are null, or if both have the same value. NUnit
- /// has special semantics for some object types.
- /// If they are equal an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The value that is expected</param>
- /// <param name="actual">The actual value</param>
- public static void AreNotEqual(object expected, object actual)
- {
- Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
- }
-
- #endregion
-
- #region AreSame
-
- /// <summary>
- /// Asserts that two objects refer to the same object. If they
- /// are not the same an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The actual object</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreSame(object expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.SameAs(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that two objects refer to the same object. If they
- /// are not the same an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The actual object</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreSame(object expected, object actual, string message)
- {
- Assert.That(actual, Is.SameAs(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that two objects refer to the same object. If they
- /// are not the same an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The actual object</param>
- public static void AreSame(object expected, object actual)
- {
- Assert.That(actual, Is.SameAs(expected) ,null, null);
- }
-
- #endregion
-
- #region AreNotSame
-
- /// <summary>
- /// Asserts that two objects do not refer to the same object. If they
- /// are the same an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The actual object</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void AreNotSame(object expected, object actual, string message, params object[] args)
- {
- Assert.That(actual, Is.Not.SameAs(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that two objects do not refer to the same object. If they
- /// are the same an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The actual object</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void AreNotSame(object expected, object actual, string message)
- {
- Assert.That(actual, Is.Not.SameAs(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that two objects do not refer to the same object. If they
- /// are the same an <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The actual object</param>
- public static void AreNotSame(object expected, object actual)
- {
- Assert.That(actual, Is.Not.SameAs(expected) ,null, null);
- }
-
- #endregion
-
- #region Greater
-
-#if !NUNITLITE
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Greater(int arg1, int arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Greater(int arg1, int arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void Greater(int arg1, int arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void Greater(uint arg1, uint arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void Greater(uint arg1, uint arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- [CLSCompliant(false)]
- public static void Greater(uint arg1, uint arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Greater(long arg1, long arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Greater(long arg1, long arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void Greater(long arg1, long arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void Greater(ulong arg1, ulong arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void Greater(ulong arg1, ulong arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- [CLSCompliant(false)]
- public static void Greater(ulong arg1, ulong arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Greater(decimal arg1, decimal arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Greater(decimal arg1, decimal arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void Greater(decimal arg1, decimal arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Greater(double arg1, double arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Greater(double arg1, double arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void Greater(double arg1, double arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Greater(float arg1, float arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Greater(float arg1, float arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void Greater(float arg1, float arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Greater(IComparable arg1, IComparable arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Greater(IComparable arg1, IComparable arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void Greater(IComparable arg1, IComparable arg2)
- {
- Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
- }
-#endif
-
- #endregion
-
- #region Less
-
-#if !NUNITLITE
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Less(int arg1, int arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Less(int arg1, int arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void Less(int arg1, int arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void Less(uint arg1, uint arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void Less(uint arg1, uint arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- [CLSCompliant(false)]
- public static void Less(uint arg1, uint arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Less(long arg1, long arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Less(long arg1, long arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void Less(long arg1, long arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void Less(ulong arg1, ulong arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void Less(ulong arg1, ulong arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- [CLSCompliant(false)]
- public static void Less(ulong arg1, ulong arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Less(decimal arg1, decimal arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Less(decimal arg1, decimal arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void Less(decimal arg1, decimal arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Less(double arg1, double arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Less(double arg1, double arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void Less(double arg1, double arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Less(float arg1, float arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Less(float arg1, float arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void Less(float arg1, float arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Less(IComparable arg1, IComparable arg2, string message)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void Less(IComparable arg1, IComparable arg2)
- {
- Assert.That(arg1, Is.LessThan(arg2) ,null, null);
- }
-#endif
-
- #endregion
-
- #region GreaterOrEqual
-
-#if !NUNITLITE
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void GreaterOrEqual(int arg1, int arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void GreaterOrEqual(int arg1, int arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void GreaterOrEqual(int arg1, int arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void GreaterOrEqual(uint arg1, uint arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- [CLSCompliant(false)]
- public static void GreaterOrEqual(uint arg1, uint arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void GreaterOrEqual(long arg1, long arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void GreaterOrEqual(long arg1, long arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void GreaterOrEqual(long arg1, long arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void GreaterOrEqual(ulong arg1, ulong arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- [CLSCompliant(false)]
- public static void GreaterOrEqual(ulong arg1, ulong arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void GreaterOrEqual(decimal arg1, decimal arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void GreaterOrEqual(decimal arg1, decimal arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void GreaterOrEqual(double arg1, double arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void GreaterOrEqual(double arg1, double arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void GreaterOrEqual(double arg1, double arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void GreaterOrEqual(float arg1, float arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void GreaterOrEqual(float arg1, float arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void GreaterOrEqual(float arg1, float arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is greater than or equal tothe second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be greater</param>
- /// <param name="arg2">The second value, expected to be less</param>
- public static void GreaterOrEqual(IComparable arg1, IComparable arg2)
- {
- Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
- }
-#endif
-
- #endregion
-
- #region LessOrEqual
-
-#if !NUNITLITE
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void LessOrEqual(int arg1, int arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void LessOrEqual(int arg1, int arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void LessOrEqual(int arg1, int arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void LessOrEqual(uint arg1, uint arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- [CLSCompliant(false)]
- public static void LessOrEqual(uint arg1, uint arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void LessOrEqual(long arg1, long arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void LessOrEqual(long arg1, long arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void LessOrEqual(long arg1, long arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- [CLSCompliant(false)]
- public static void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- [CLSCompliant(false)]
- public static void LessOrEqual(ulong arg1, ulong arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- [CLSCompliant(false)]
- public static void LessOrEqual(ulong arg1, ulong arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void LessOrEqual(decimal arg1, decimal arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void LessOrEqual(decimal arg1, decimal arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void LessOrEqual(double arg1, double arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void LessOrEqual(double arg1, double arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void LessOrEqual(double arg1, double arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void LessOrEqual(float arg1, float arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void LessOrEqual(float arg1, float arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void LessOrEqual(float arg1, float arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void LessOrEqual(IComparable arg1, IComparable arg2, string message)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
- }
- /// <summary>
- /// Verifies that the first value is less than or equal to the second
- /// value. If it is not, then an
- /// <see cref="AssertionException"/> is thrown.
- /// </summary>
- /// <param name="arg1">The first value, expected to be less</param>
- /// <param name="arg2">The second value, expected to be greater</param>
- public static void LessOrEqual(IComparable arg1, IComparable arg2)
- {
- Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
- }
-#endif
-
- #endregion
-
- #region Contains
-
-#if !NUNITLITE
- /// <summary>
- /// Asserts that an object is contained in a list.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The list to be examined</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- public static void Contains(object expected, ICollection actual, string message, params object[] args)
- {
- Assert.That(actual, new CollectionContainsConstraint(expected) ,message, args);
- }
- /// <summary>
- /// Asserts that an object is contained in a list.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The list to be examined</param>
- /// <param name="message">The message to display in case of failure</param>
- public static void Contains(object expected, ICollection actual, string message)
- {
- Assert.That(actual, new CollectionContainsConstraint(expected) ,message, null);
- }
- /// <summary>
- /// Asserts that an object is contained in a list.
- /// </summary>
- /// <param name="expected">The expected object</param>
- /// <param name="actual">The list to be examined</param>
- public static void Contains(object expected, ICollection actual)
- {
- Assert.That(actual, new CollectionContainsConstraint(expected) ,null, null);
- }
-#endif
-
- #endregion
-
-
- #region Helper Methods
- /// <summary>
- /// Helper for Assert.AreEqual(double expected, double actual, ...)
- /// allowing code generation to work consistently.
- /// </summary>
- /// <param name="expected">The expected value</param>
- /// <param name="actual">The actual value</param>
- /// <param name="delta">The maximum acceptable difference between the
- /// the expected and the actual</param>
- /// <param name="message">The message to display in case of failure</param>
- /// <param name="args">Array of objects to be used in formatting the message</param>
- protected static void AssertDoublesAreEqual(double expected, double actual, double delta, string message, object[] args)
- {
- if (double.IsNaN(expected) || double.IsInfinity(expected))
- Assert.That(actual, Is.EqualTo(expected), message, args);
- else
- Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
- }
- #endregion
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Delegate used by tests that execute code and
+ /// capture any thrown exception.
+ /// </summary>
+ public delegate void TestDelegate();
+
+ /// <summary>
+ /// The Assert class contains a collection of static methods that
+ /// implement the most common assertions used in NUnit.
+ /// </summary>
+ public class Assert
+ {
+ #region Constructor
+
+ /// <summary>
+ /// We don't actually want any instances of this object, but some people
+ /// like to inherit from it to add other static methods. Hence, the
+ /// protected constructor disallows any instances of this object.
+ /// </summary>
+ protected Assert() { }
+
+ #endregion
+
+ #region Assert Counting
+
+ private static int counter = 0;
+
+ /// <summary>
+ /// Gets the number of assertions executed so far and
+ /// resets the counter to zero.
+ /// </summary>
+ public static int Counter
+ {
+ get
+ {
+ int cnt = counter;
+ counter = 0;
+ return cnt;
+ }
+ }
+
+ private static void IncrementAssertCount()
+ {
+ ++counter;
+ }
+
+ #endregion
+
+ #region Equals and ReferenceEquals
+
+#if !NETCF
+ /// <summary>
+ /// The Equals method throws an AssertionException. This is done
+ /// to make sure there is no mistake by calling this function.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static new bool Equals(object a, object b)
+ {
+ throw new InvalidOperationException("Assert.Equals should not be used for Assertions");
+ }
+
+ /// <summary>
+ /// override the default ReferenceEquals to throw an AssertionException. This
+ /// implementation makes sure there is no mistake in calling this function
+ /// as part of Assert.
+ /// </summary>
+ /// <param name="a"></param>
+ /// <param name="b"></param>
+ public static new void ReferenceEquals(object a, object b)
+ {
+ throw new InvalidOperationException("Assert.ReferenceEquals should not be used for Assertions");
+ }
+#endif
+
+ #endregion
+
+ #region Utility Asserts
+
+ #region Pass
+
+#if !NUNITLITE
+ /// <summary>
+ /// Throws a <see cref="SuccessException"/> with the message and arguments
+ /// that are passed in. This allows a test to be cut short, with a result
+ /// of success returned to NUnit.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Pass(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 SuccessException(message);
+ }
+
+ /// <summary>
+ /// Throws a <see cref="SuccessException"/> with the message and arguments
+ /// that are passed in. This allows a test to be cut short, with a result
+ /// of success returned to NUnit.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ static public void Pass(string message)
+ {
+ Assert.Pass(message, null);
+ }
+
+ /// <summary>
+ /// Throws a <see cref="SuccessException"/> with the message and arguments
+ /// that are passed in. This allows a test to be cut short, with a result
+ /// of success returned to NUnit.
+ /// </summary>
+ static public void Pass()
+ {
+ Assert.Pass(string.Empty, null);
+ }
+#endif
+ #endregion
+
+ #region Fail
+
+ /// <summary>
+ /// Throws an <see cref="AssertionException"/> with the message and arguments
+ /// that are passed in. This is used by the other Assert functions.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Fail(string message, params object[] args)
+ {
+ if (message == null) message = string.Empty;
+ else if (args != null && args.Length > 0)
+ message = string.Format(message, args);
+
+ throw new AssertionException(message);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="AssertionException"/> with the message that is
+ /// passed in. This is used by the other Assert functions.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ static public void Fail(string message)
+ {
+ Assert.Fail(message, null);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="AssertionException"/>.
+ /// This is used by the other Assert functions.
+ /// </summary>
+ static public void Fail()
+ {
+ Assert.Fail(string.Empty, null);
+ }
+
+ #endregion
+
+ #region Ignore
+
+#if !NUNITLITE
+ /// <summary>
+ /// Throws an <see cref="IgnoreException"/> with the message and arguments
+ /// that are passed in. This causes the test to be reported as ignored.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Ignore(string message, params object[] args)
+ {
+ if (message == null) message = string.Empty;
+ else if (args != null && args.Length > 0)
+ message = string.Format(message, args);
+
+ throw new IgnoreException(message);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="IgnoreException"/> with the message that is
+ /// passed in. This causes the test to be reported as ignored.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
+ static public void Ignore(string message)
+ {
+ Assert.Ignore(message, null);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="IgnoreException"/>.
+ /// This causes the test to be reported as ignored.
+ /// </summary>
+ static public void Ignore()
+ {
+ Assert.Ignore(string.Empty, null);
+ }
+#endif
+
+ #endregion
+
+ #region InConclusive
+
+#if !NUNITLITE
+ /// <summary>
+ /// Throws an <see cref="InconclusiveException"/> with the message and arguments
+ /// that are passed in. This causes the test to be reported as inconclusive.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void Inconclusive(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 InconclusiveException(message);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="InconclusiveException"/> with the message that is
+ /// passed in. This causes the test to be reported as inconclusive.
+ /// </summary>
+ /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param>
+ static public void Inconclusive(string message)
+ {
+ Assert.Inconclusive(message, null);
+ }
+
+ /// <summary>
+ /// Throws an <see cref="InconclusiveException"/>.
+ /// This causes the test to be reported as Inconclusive.
+ /// </summary>
+ static public void Inconclusive()
+ {
+ Assert.Inconclusive(string.Empty, null);
+ }
+#endif
+
+ #endregion
+
+ #endregion
+
+ #region Assert.That
+
+ #region Object
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="expression">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ static public void That(object actual, IResolveConstraint expression)
+ {
+ Assert.That(actual, expression, null, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="expression">A Constraint to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void That(object actual, IResolveConstraint expression, string message)
+ {
+ Assert.That(actual, expression, message, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="expression">A Constraint expression to be applied</param>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That(object actual, IResolveConstraint expression, string message, params object[] args)
+ {
+ Constraint constraint = expression.Resolve();
+
+ Assert.IncrementAssertCount();
+ if (!constraint.Matches(actual))
+ {
+ MessageWriter writer = new TextMessageWriter(message, args);
+ constraint.WriteMessageTo(writer);
+ throw new AssertionException(writer.ToString());
+ }
+ }
+ #endregion
+
+ #region ActualValueDelegate
+#if !NUNITLITE
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="expr">A Constraint expression to be applied</param>
+ /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
+ static public void That(ActualValueDelegate del, IResolveConstraint expr)
+ {
+ Assert.That(del, expr.Resolve(), null, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="expr">A Constraint expression to be applied</param>
+ /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void That(ActualValueDelegate del, IResolveConstraint expr, string message)
+ {
+ Assert.That(del, expr.Resolve(), message, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to an actual value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
+ /// <param name="expr">A Constraint expression to be applied</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args)
+ {
+ Constraint constraint = expr.Resolve();
+
+ Assert.IncrementAssertCount();
+ if (!constraint.Matches(del))
+ {
+ MessageWriter writer = new TextMessageWriter(message, args);
+ constraint.WriteMessageTo(writer);
+ throw new AssertionException(writer.ToString());
+ }
+ }
+#endif
+ #endregion
+
+ #region ref Object
+#if CLR_2_0
+ /// <summary>
+ /// Apply a constraint to a referenced value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="expression">A Constraint to be applied</param>
+ static public void That<T>(ref T actual, IResolveConstraint expression)
+ {
+ Assert.That(ref actual, expression, null, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to a referenced value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="expression">A Constraint to be applied</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void That<T>(ref T actual, IResolveConstraint expression, string message)
+ {
+ Assert.That(ref actual, expression, message, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to a referenced value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="expression">A Constraint to be applied</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args)
+ {
+ Constraint constraint = expression.Resolve();
+
+ Assert.IncrementAssertCount();
+ if (!constraint.Matches(ref actual))
+ {
+ MessageWriter writer = new TextMessageWriter(message, args);
+ constraint.WriteMessageTo(writer);
+ throw new AssertionException(writer.ToString());
+ }
+ }
+#else
+ /// <summary>
+ /// Apply a constraint to a referenced boolean, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="expression">A Constraint to be applied</param>
+ static public void That(ref bool actual, IResolveConstraint expression)
+ {
+ Assert.That(ref actual, expression, null, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to a referenced value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="expression">A Constraint to be applied</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ static public void That(ref bool actual, IResolveConstraint expression, string message)
+ {
+ Assert.That(ref actual, expression, message, null);
+ }
+
+ /// <summary>
+ /// Apply a constraint to a referenced value, succeeding if the constraint
+ /// is satisfied and throwing an assertion exception on failure.
+ /// </summary>
+ /// <param name="actual">The actual value to test</param>
+ /// <param name="expression">A Constraint to be applied</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args)
+ {
+ Constraint constraint = expression.Resolve();
+
+ Assert.IncrementAssertCount();
+ if (!constraint.Matches(ref actual))
+ {
+ MessageWriter writer = new TextMessageWriter(message, args);
+ constraint.WriteMessageTo(writer);
+ throw new AssertionException(writer.ToString());
+ }
+ }
+#endif
+ #endregion
+
+ #region Boolean
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ static public void That(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.True, message, args);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display if the condition is false</param>
+ static public void That(bool condition, string message)
+ {
+ Assert.That(condition, Is.True, message, null);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ static public void That(bool condition)
+ {
+ Assert.That(condition, Is.True, null, null);
+ }
+ #endregion
+
+ /// <summary>
+ /// Asserts that the code represented by a delegate throws an exception
+ /// that satisfies the constraint provided.
+ /// </summary>
+ /// <param name="code">A TestDelegate to be executed</param>
+ /// <param name="constraint">A ThrowsConstraint used in the test</param>
+ static public void That(TestDelegate code, IResolveConstraint constraint)
+ {
+ Assert.That((object)code, constraint);
+ }
+ #endregion
+
+ #region Throws, Catch and DoesNotThrow
+
+ #region Throws
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <param name="expression">A constraint to be satisfied by the exception</param>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message, params object[] args)
+ {
+ Exception caughtException = null;
+
+ try
+ {
+ code();
+ }
+ catch (Exception ex)
+ {
+ caughtException = ex;
+ }
+
+ Assert.That(caughtException, expression, message, args);
+
+ return caughtException;
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <param name="expression">A constraint to be satisfied by the exception</param>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message)
+ {
+ return Throws(expression, code, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <param name="expression">A constraint to be satisfied by the exception</param>
+ /// <param name="code">A TestSnippet delegate</param>
+ public static Exception Throws(IResolveConstraint expression, TestDelegate code)
+ {
+ return Throws(expression, code, string.Empty, null);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <param name="expectedExceptionType">The exception Type expected</param>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
+ {
+ return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <param name="expectedExceptionType">The exception Type expected</param>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message)
+ {
+ return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <param name="expectedExceptionType">The exception Type expected</param>
+ /// <param name="code">A TestSnippet delegate</param>
+ public static Exception Throws(Type expectedExceptionType, TestDelegate code)
+ {
+ return Throws(new ExactTypeConstraint(expectedExceptionType), code, string.Empty, null);
+ }
+
+ #endregion
+
+ #region Throws<T>
+#if CLR_2_0
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <typeparam name="T">Type of the expected exception</typeparam>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static T Throws<T>(TestDelegate code, string message, params object[] args) where T : Exception
+ {
+ return (T)Throws(typeof(T), code, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <typeparam name="T">Type of the expected exception</typeparam>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static T Throws<T>(TestDelegate code, string message) where T : Exception
+ {
+ return Throws<T>(code, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws a particular exception when called.
+ /// </summary>
+ /// <typeparam name="T">Type of the expected exception</typeparam>
+ /// <param name="code">A TestSnippet delegate</param>
+ public static T Throws<T>(TestDelegate code) where T : Exception
+ {
+ return Throws<T>(code, string.Empty, null);
+ }
+#endif
+ #endregion
+
+ #region Catch
+ /// <summary>
+ /// Verifies that a delegate throws an exception when called
+ /// and returns it.
+ /// </summary>
+ /// <param name="code">A TestDelegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static Exception Catch(TestDelegate code, string message, params object[] args)
+ {
+ return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception when called
+ /// and returns it.
+ /// </summary>
+ /// <param name="code">A TestDelegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static Exception Catch(TestDelegate code, string message)
+ {
+ return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception when called
+ /// and returns it.
+ /// </summary>
+ /// <param name="code">A TestDelegate</param>
+ public static Exception Catch(TestDelegate code)
+ {
+ return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception of a certain Type
+ /// or one derived from it when called and returns it.
+ /// </summary>
+ /// <param name="expectedExceptionType">The expected Exception Type</param>
+ /// <param name="code">A TestDelegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
+ {
+ return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception of a certain Type
+ /// or one derived from it when called and returns it.
+ /// </summary>
+ /// <param name="expectedExceptionType">The expected Exception Type</param>
+ /// <param name="code">A TestDelegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message)
+ {
+ return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception of a certain Type
+ /// or one derived from it when called and returns it.
+ /// </summary>
+ /// <param name="expectedExceptionType">The expected Exception Type</param>
+ /// <param name="code">A TestDelegate</param>
+ public static Exception Catch(Type expectedExceptionType, TestDelegate code)
+ {
+ return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code);
+ }
+ #endregion
+
+ #region Catch<T>
+#if CLR_2_0
+ /// <summary>
+ /// Verifies that a delegate throws an exception of a certain Type
+ /// or one derived from it when called and returns it.
+ /// </summary>
+ /// <param name="code">A TestDelegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static T Catch<T>(TestDelegate code, string message, params object[] args) where T : System.Exception
+ {
+ return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message, args);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception of a certain Type
+ /// or one derived from it when called and returns it.
+ /// </summary>
+ /// <param name="code">A TestDelegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static T Catch<T>(TestDelegate code, string message) where T : System.Exception
+ {
+ return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate throws an exception of a certain Type
+ /// or one derived from it when called and returns it.
+ /// </summary>
+ /// <param name="code">A TestDelegate</param>
+ public static T Catch<T>(TestDelegate code) where T : System.Exception
+ {
+ return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code);
+ }
+#endif
+ #endregion
+
+ #region DoesNotThrow
+
+ /// <summary>
+ /// Verifies that a delegate does not throw an exception
+ /// </summary>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ /// <param name="args">Arguments to be used in formatting the message</param>
+ public static void DoesNotThrow(TestDelegate code, string message, params object[] args)
+ {
+ try
+ {
+ code();
+ }
+ catch (Exception ex)
+ {
+ TextMessageWriter writer = new TextMessageWriter(message, args);
+ writer.WriteLine("Unexpected exception: {0}", ex.GetType());
+ Assert.Fail(writer.ToString());
+ }
+ }
+
+ /// <summary>
+ /// Verifies that a delegate does not throw an exception.
+ /// </summary>
+ /// <param name="code">A TestSnippet delegate</param>
+ /// <param name="message">The message that will be displayed on failure</param>
+ public static void DoesNotThrow(TestDelegate code, string message)
+ {
+ DoesNotThrow(code, message, null);
+ }
+
+ /// <summary>
+ /// Verifies that a delegate does not throw an exception.
+ /// </summary>
+ /// <param name="code">A TestSnippet delegate</param>
+ public static void DoesNotThrow(TestDelegate code)
+ {
+ DoesNotThrow(code, string.Empty, null);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region True
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void True(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.True ,message, args);
+ }
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void True(bool condition, string message)
+ {
+ Assert.That(condition, Is.True ,message, null);
+ }
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+public static void True(bool condition)
+ {
+ Assert.That(condition, Is.True ,null, null);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsTrue(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.True ,message, args);
+ }
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsTrue(bool condition, string message)
+ {
+ Assert.That(condition, Is.True ,message, null);
+ }
+ /// <summary>
+ /// Asserts that a condition is true. If the condition is false the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+public static void IsTrue(bool condition)
+ {
+ Assert.That(condition, Is.True ,null, null);
+ }
+
+ #endregion
+
+ #region False
+
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void False(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.False ,message, args);
+ }
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void False(bool condition, string message)
+ {
+ Assert.That(condition, Is.False ,message, null);
+ }
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+public static void False(bool condition)
+ {
+ Assert.That(condition, Is.False ,null, null);
+ }
+
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsFalse(bool condition, string message, params object[] args)
+ {
+ Assert.That(condition, Is.False ,message, args);
+ }
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsFalse(bool condition, string message)
+ {
+ Assert.That(condition, Is.False ,message, null);
+ }
+ /// <summary>
+ /// Asserts that a condition is false. If the condition is true the method throws
+ /// an <see cref="AssertionException"/>.
+ /// </summary>
+ /// <param name="condition">The evaluated condition</param>
+public static void IsFalse(bool condition)
+ {
+ Assert.That(condition, Is.False ,null, null);
+ }
+
+ #endregion
+
+ #region NotNull
+
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void NotNull(object anObject, string message, params object[] args)
+ {
+ Assert.That(anObject, Is.Not.Null ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void NotNull(object anObject, string message)
+ {
+ Assert.That(anObject, Is.Not.Null ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+public static void NotNull(object anObject)
+ {
+ Assert.That(anObject, Is.Not.Null ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotNull(object anObject, string message, params object[] args)
+ {
+ Assert.That(anObject, Is.Not.Null ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotNull(object anObject, string message)
+ {
+ Assert.That(anObject, Is.Not.Null ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is not equal to <code>null</code>
+ /// If the object is <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+public static void IsNotNull(object anObject)
+ {
+ Assert.That(anObject, Is.Not.Null ,null, null);
+ }
+
+ #endregion
+
+ #region Null
+
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Null(object anObject, string message, params object[] args)
+ {
+ Assert.That(anObject, Is.Null ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Null(object anObject, string message)
+ {
+ Assert.That(anObject, Is.Null ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+public static void Null(object anObject)
+ {
+ Assert.That(anObject, Is.Null ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNull(object anObject, string message, params object[] args)
+ {
+ Assert.That(anObject, Is.Null ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNull(object anObject, string message)
+ {
+ Assert.That(anObject, Is.Null ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the object that is passed in is equal to <code>null</code>
+ /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="anObject">The object that is to be tested</param>
+public static void IsNull(object anObject)
+ {
+ Assert.That(anObject, Is.Null ,null, null);
+ }
+
+ #endregion
+
+ #region IsNaN
+
+#if !NUNITLITE
+ /// <summary>
+ /// Verifies that the double that is passed in is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNaN(double aDouble, string message, params object[] args)
+ {
+ Assert.That(aDouble, Is.NaN ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the double that is passed in is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNaN(double aDouble, string message)
+ {
+ Assert.That(aDouble, Is.NaN ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the double that is passed in is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+public static void IsNaN(double aDouble)
+ {
+ Assert.That(aDouble, Is.NaN ,null, null);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Verifies that the double that is passed in is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNaN(double? aDouble, string message, params object[] args)
+ {
+ Assert.That(aDouble, Is.NaN ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the double that is passed in is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNaN(double? aDouble, string message)
+ {
+ Assert.That(aDouble, Is.NaN ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the double that is passed in is an <code>NaN</code> value.
+ /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
+ /// is thrown.
+ /// </summary>
+ /// <param name="aDouble">The value that is to be tested</param>
+public static void IsNaN(double? aDouble)
+ {
+ Assert.That(aDouble, Is.NaN ,null, null);
+ }
+#endif
+#endif
+
+ #endregion
+
+ #region IsEmpty
+
+#if !NUNITLITE
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsEmpty(string aString, string message, params object[] args)
+ {
+ Assert.That(aString, new EmptyStringConstraint() ,message, args);
+ }
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsEmpty(string aString, string message)
+ {
+ Assert.That(aString, new EmptyStringConstraint() ,message, null);
+ }
+ /// <summary>
+ /// Assert that a string is empty - that is equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+public static void IsEmpty(string aString)
+ {
+ Assert.That(aString, new EmptyStringConstraint() ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsEmpty
+
+#if !NUNITLITE
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsEmpty(ICollection collection, string message, params object[] args)
+ {
+ Assert.That(collection, new EmptyCollectionConstraint() ,message, args);
+ }
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsEmpty(ICollection collection, string message)
+ {
+ Assert.That(collection, new EmptyCollectionConstraint() ,message, null);
+ }
+ /// <summary>
+ /// Assert that an array, list or other collection is empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+public static void IsEmpty(ICollection collection)
+ {
+ Assert.That(collection, new EmptyCollectionConstraint() ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsNotEmpty
+
+#if !NUNITLITE
+ /// <summary>
+ /// Assert that a string is not empty - that is not equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotEmpty(string aString, string message, params object[] args)
+ {
+ Assert.That(aString, Is.Not.Empty ,message, args);
+ }
+ /// <summary>
+ /// Assert that a string is not empty - that is not equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotEmpty(string aString, string message)
+ {
+ Assert.That(aString, Is.Not.Empty ,message, null);
+ }
+ /// <summary>
+ /// Assert that a string is not empty - that is not equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+public static void IsNotEmpty(string aString)
+ {
+ Assert.That(aString, Is.Not.Empty ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsNotEmpty
+
+#if !NUNITLITE
+ /// <summary>
+ /// Assert that an array, list or other collection is not empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotEmpty(ICollection collection, string message, params object[] args)
+ {
+ Assert.That(collection, Is.Not.Empty ,message, args);
+ }
+ /// <summary>
+ /// Assert that an array, list or other collection is not empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotEmpty(ICollection collection, string message)
+ {
+ Assert.That(collection, Is.Not.Empty ,message, null);
+ }
+ /// <summary>
+ /// Assert that an array, list or other collection is not empty
+ /// </summary>
+ /// <param name="collection">An array, list or other collection implementing ICollection</param>
+public static void IsNotEmpty(ICollection collection)
+ {
+ Assert.That(collection, Is.Not.Empty ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsNullOrEmpty
+
+#if !NUNITLITE
+ /// <summary>
+ /// Assert that a string is either null or equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNullOrEmpty(string aString, string message, params object[] args)
+ {
+ Assert.That(aString, new NullOrEmptyStringConstraint() ,message, args);
+ }
+ /// <summary>
+ /// Assert that a string is either null or equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNullOrEmpty(string aString, string message)
+ {
+ Assert.That(aString, new NullOrEmptyStringConstraint() ,message, null);
+ }
+ /// <summary>
+ /// Assert that a string is either null or equal to string.Empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+public static void IsNullOrEmpty(string aString)
+ {
+ Assert.That(aString, new NullOrEmptyStringConstraint() ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsNotNullOrEmpty
+
+#if !NUNITLITE
+ /// <summary>
+ /// Assert that a string is not null or empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotNullOrEmpty(string aString, string message, params object[] args)
+ {
+ Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,message, args);
+ }
+ /// <summary>
+ /// Assert that a string is not null or empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotNullOrEmpty(string aString, string message)
+ {
+ Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,message, null);
+ }
+ /// <summary>
+ /// Assert that a string is not null or empty
+ /// </summary>
+ /// <param name="aString">The string to be tested</param>
+public static void IsNotNullOrEmpty(string aString)
+ {
+ Assert.That(aString, new NotConstraint( new NullOrEmptyStringConstraint()) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsAssignableFrom
+
+#if !NUNITLITE
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsAssignableFrom(Type expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.AssignableFrom(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsAssignableFrom(Type expected, object actual, string message)
+ {
+ Assert.That(actual, Is.AssignableFrom(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+public static void IsAssignableFrom(Type expected, object actual)
+ {
+ Assert.That(actual, Is.AssignableFrom(expected) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsAssignableFrom<T>
+
+#if !NUNITLITE
+#if CLR_2_0
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type.</typeparam>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsAssignableFrom<T>(object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.AssignableFrom(typeof(T)) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type.</typeparam>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsAssignableFrom<T>(object actual, string message)
+ {
+ Assert.That(actual, Is.AssignableFrom(typeof(T)) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object may be assigned a value of a given Type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type.</typeparam>
+ /// <param name="actual">The object under examination</param>
+public static void IsAssignableFrom<T>(object actual)
+ {
+ Assert.That(actual, Is.AssignableFrom(typeof(T)) ,null, null);
+ }
+#endif
+#endif
+
+ #endregion
+
+ #region IsNotAssignableFrom
+
+#if !NUNITLITE
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotAssignableFrom(Type expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotAssignableFrom(Type expected, object actual, string message)
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <param name="expected">The expected Type.</param>
+ /// <param name="actual">The object under examination</param>
+public static void IsNotAssignableFrom(Type expected, object actual)
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(expected) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsNotAssignableFrom<T>
+
+#if !NUNITLITE
+#if CLR_2_0
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type.</typeparam>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotAssignableFrom<T>(object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type.</typeparam>
+ /// <param name="actual">The object under examination</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotAssignableFrom<T>(object actual, string message)
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object may not be assigned a value of a given Type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type.</typeparam>
+ /// <param name="actual">The object under examination</param>
+public static void IsNotAssignableFrom<T>(object actual)
+ {
+ Assert.That(actual, Is.Not.AssignableFrom(typeof(T)) ,null, null);
+ }
+#endif
+#endif
+
+ #endregion
+
+ #region IsInstanceOf
+
+#if !NUNITLITE
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsInstanceOf(Type expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.InstanceOf(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsInstanceOf(Type expected, object actual, string message)
+ {
+ Assert.That(actual, Is.InstanceOf(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+public static void IsInstanceOf(Type expected, object actual)
+ {
+ Assert.That(actual, Is.InstanceOf(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [Obsolete]
+public static void IsInstanceOfType(Type expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.InstanceOf(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [Obsolete]
+public static void IsInstanceOfType(Type expected, object actual, string message)
+ {
+ Assert.That(actual, Is.InstanceOf(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ [Obsolete]
+public static void IsInstanceOfType(Type expected, object actual)
+ {
+ Assert.That(actual, Is.InstanceOf(expected) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsInstanceOf<T>
+
+#if !NUNITLITE
+#if CLR_2_0
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type</typeparam>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsInstanceOf<T>(object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.InstanceOf(typeof(T)) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type</typeparam>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsInstanceOf<T>(object actual, string message)
+ {
+ Assert.That(actual, Is.InstanceOf(typeof(T)) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is an instance of a given type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type</typeparam>
+ /// <param name="actual">The object being examined</param>
+public static void IsInstanceOf<T>(object actual)
+ {
+ Assert.That(actual, Is.InstanceOf(typeof(T)) ,null, null);
+ }
+#endif
+#endif
+
+ #endregion
+
+ #region IsNotInstanceOf
+
+#if !NUNITLITE
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotInstanceOf(Type expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotInstanceOf(Type expected, object actual, string message)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+public static void IsNotInstanceOf(Type expected, object actual)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [Obsolete]
+public static void IsNotInstanceOfType(Type expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [Obsolete]
+public static void IsNotInstanceOfType(Type expected, object actual, string message)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <param name="expected">The expected Type</param>
+ /// <param name="actual">The object being examined</param>
+ [Obsolete]
+public static void IsNotInstanceOfType(Type expected, object actual)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(expected) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region IsNotInstanceOf<T>
+
+#if !NUNITLITE
+#if CLR_2_0
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type</typeparam>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void IsNotInstanceOf<T>(object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type</typeparam>
+ /// <param name="actual">The object being examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void IsNotInstanceOf<T>(object actual, string message)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is not an instance of a given type.
+ /// </summary>
+ /// <typeparam name="T">The expected Type</typeparam>
+ /// <param name="actual">The object being examined</param>
+public static void IsNotInstanceOf<T>(object actual)
+ {
+ Assert.That(actual, Is.Not.InstanceOf(typeof(T)) ,null, null);
+ }
+#endif
+#endif
+
+ #endregion
+
+ #region AreEqual
+
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreEqual(int expected, int actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreEqual(int expected, int actual, string message)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreEqual(int expected, int actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreEqual(long expected, long actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreEqual(long expected, long actual, string message)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreEqual(long expected, long actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void AreEqual(uint expected, uint actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void AreEqual(uint expected, uint actual, string message)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ [CLSCompliant(false)]
+public static void AreEqual(uint expected, uint actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void AreEqual(ulong expected, ulong actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void AreEqual(ulong expected, ulong actual, string message)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ [CLSCompliant(false)]
+public static void AreEqual(ulong expected, ulong actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreEqual(decimal expected, decimal actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreEqual(decimal expected, decimal actual, string message)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are equal. If they are not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreEqual(decimal expected, decimal actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,null, null);
+ }
+
+ #endregion
+
+ #region AreEqual
+
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equal then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreEqual(double expected, double actual, double delta, string message, params object[] args)
+ {
+ AssertDoublesAreEqual(expected, actual, delta ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equal then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreEqual(double expected, double actual, double delta, string message)
+ {
+ AssertDoublesAreEqual(expected, actual, delta ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equal then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+public static void AreEqual(double expected, double actual, double delta)
+ {
+ AssertDoublesAreEqual(expected, actual, delta ,null, null);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equal then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreEqual(double expected, double? actual, double delta, string message, params object[] args)
+ {
+ AssertDoublesAreEqual(expected, (double)actual, delta ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equal then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreEqual(double expected, double? actual, double delta, string message)
+ {
+ AssertDoublesAreEqual(expected, (double)actual, delta ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two doubles are equal considering a delta. If the
+ /// expected value is infinity then the delta value is ignored. If
+ /// they are not equal then an <see cref="AssertionException"/> is
+ /// thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+public static void AreEqual(double expected, double? actual, double delta)
+ {
+ AssertDoublesAreEqual(expected, (double)actual, delta ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region AreEqual
+
+ /// <summary>
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. NUnit
+ /// has special semantics for some object types.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreEqual(object expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. NUnit
+ /// has special semantics for some object types.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreEqual(object expected, object actual, string message)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two objects are equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. NUnit
+ /// has special semantics for some object types.
+ /// If they are not equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+public static void AreEqual(object expected, object actual)
+ {
+ Assert.That(actual, Is.EqualTo(expected) ,null, null);
+ }
+
+ #endregion
+
+ #region AreNotEqual
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotEqual(int expected, int actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotEqual(int expected, int actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreNotEqual(int expected, int actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotEqual(long expected, long actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotEqual(long expected, long actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreNotEqual(long expected, long actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void AreNotEqual(uint expected, uint actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void AreNotEqual(uint expected, uint actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ [CLSCompliant(false)]
+public static void AreNotEqual(uint expected, uint actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void AreNotEqual(ulong expected, ulong actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ [CLSCompliant(false)]
+public static void AreNotEqual(ulong expected, ulong actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotEqual(decimal expected, decimal actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotEqual(decimal expected, decimal actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreNotEqual(decimal expected, decimal actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotEqual(float expected, float actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotEqual(float expected, float actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreNotEqual(float expected, float actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotEqual(double expected, double actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotEqual(double expected, double actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two values are not equal. If they are equal, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+public static void AreNotEqual(double expected, double actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ #endregion
+
+ #region AreNotEqual
+
+ /// <summary>
+ /// Verifies that two objects are not equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. NUnit
+ /// has special semantics for some object types.
+ /// If they are equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotEqual(object expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that two objects are not equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. NUnit
+ /// has special semantics for some object types.
+ /// If they are equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotEqual(object expected, object actual, string message)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that two objects are not equal. Two objects are considered
+ /// equal if both are null, or if both have the same value. NUnit
+ /// has special semantics for some object types.
+ /// If they are equal an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The value that is expected</param>
+ /// <param name="actual">The actual value</param>
+public static void AreNotEqual(object expected, object actual)
+ {
+ Assert.That(actual, Is.Not.EqualTo(expected) ,null, null);
+ }
+
+ #endregion
+
+ #region AreSame
+
+ /// <summary>
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreSame(object expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.SameAs(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreSame(object expected, object actual, string message)
+ {
+ Assert.That(actual, Is.SameAs(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that two objects refer to the same object. If they
+ /// are not the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+public static void AreSame(object expected, object actual)
+ {
+ Assert.That(actual, Is.SameAs(expected) ,null, null);
+ }
+
+ #endregion
+
+ #region AreNotSame
+
+ /// <summary>
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void AreNotSame(object expected, object actual, string message, params object[] args)
+ {
+ Assert.That(actual, Is.Not.SameAs(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void AreNotSame(object expected, object actual, string message)
+ {
+ Assert.That(actual, Is.Not.SameAs(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that two objects do not refer to the same object. If they
+ /// are the same an <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The actual object</param>
+public static void AreNotSame(object expected, object actual)
+ {
+ Assert.That(actual, Is.Not.SameAs(expected) ,null, null);
+ }
+
+ #endregion
+
+ #region Greater
+
+#if !NUNITLITE
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Greater(int arg1, int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Greater(int arg1, int arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void Greater(int arg1, int arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void Greater(uint arg1, uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void Greater(uint arg1, uint arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+public static void Greater(uint arg1, uint arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Greater(long arg1, long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Greater(long arg1, long arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void Greater(long arg1, long arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void Greater(ulong arg1, ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void Greater(ulong arg1, ulong arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+public static void Greater(ulong arg1, ulong arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Greater(decimal arg1, decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Greater(decimal arg1, decimal arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void Greater(decimal arg1, decimal arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Greater(double arg1, double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Greater(double arg1, double arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void Greater(double arg1, double arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Greater(float arg1, float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Greater(float arg1, float arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void Greater(float arg1, float arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Greater(IComparable arg1, IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Greater(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void Greater(IComparable arg1, IComparable arg2)
+ {
+ Assert.That(arg1, Is.GreaterThan(arg2) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region Less
+
+#if !NUNITLITE
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Less(int arg1, int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Less(int arg1, int arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void Less(int arg1, int arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void Less(uint arg1, uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void Less(uint arg1, uint arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+public static void Less(uint arg1, uint arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Less(long arg1, long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Less(long arg1, long arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void Less(long arg1, long arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void Less(ulong arg1, ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void Less(ulong arg1, ulong arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+public static void Less(ulong arg1, ulong arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Less(decimal arg1, decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Less(decimal arg1, decimal arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void Less(decimal arg1, decimal arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Less(double arg1, double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Less(double arg1, double arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void Less(double arg1, double arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Less(float arg1, float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Less(float arg1, float arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void Less(float arg1, float arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Less(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void Less(IComparable arg1, IComparable arg2)
+ {
+ Assert.That(arg1, Is.LessThan(arg2) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region GreaterOrEqual
+
+#if !NUNITLITE
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void GreaterOrEqual(int arg1, int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void GreaterOrEqual(int arg1, int arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void GreaterOrEqual(int arg1, int arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void GreaterOrEqual(uint arg1, uint arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+public static void GreaterOrEqual(uint arg1, uint arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void GreaterOrEqual(long arg1, long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void GreaterOrEqual(long arg1, long arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void GreaterOrEqual(long arg1, long arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void GreaterOrEqual(ulong arg1, ulong arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ [CLSCompliant(false)]
+public static void GreaterOrEqual(ulong arg1, ulong arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void GreaterOrEqual(decimal arg1, decimal arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void GreaterOrEqual(decimal arg1, decimal arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void GreaterOrEqual(double arg1, double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void GreaterOrEqual(double arg1, double arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void GreaterOrEqual(double arg1, double arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void GreaterOrEqual(float arg1, float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void GreaterOrEqual(float arg1, float arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void GreaterOrEqual(float arg1, float arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is greater than or equal tothe second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be greater</param>
+ /// <param name="arg2">The second value, expected to be less</param>
+public static void GreaterOrEqual(IComparable arg1, IComparable arg2)
+ {
+ Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region LessOrEqual
+
+#if !NUNITLITE
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void LessOrEqual(int arg1, int arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void LessOrEqual(int arg1, int arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void LessOrEqual(int arg1, int arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void LessOrEqual(uint arg1, uint arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+public static void LessOrEqual(uint arg1, uint arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void LessOrEqual(long arg1, long arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void LessOrEqual(long arg1, long arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void LessOrEqual(long arg1, long arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ [CLSCompliant(false)]
+public static void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ [CLSCompliant(false)]
+public static void LessOrEqual(ulong arg1, ulong arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ [CLSCompliant(false)]
+public static void LessOrEqual(ulong arg1, ulong arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void LessOrEqual(decimal arg1, decimal arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void LessOrEqual(decimal arg1, decimal arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void LessOrEqual(double arg1, double arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void LessOrEqual(double arg1, double arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void LessOrEqual(double arg1, double arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void LessOrEqual(float arg1, float arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void LessOrEqual(float arg1, float arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void LessOrEqual(float arg1, float arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, args);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void LessOrEqual(IComparable arg1, IComparable arg2, string message)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,message, null);
+ }
+ /// <summary>
+ /// Verifies that the first value is less than or equal to the second
+ /// value. If it is not, then an
+ /// <see cref="AssertionException"/> is thrown.
+ /// </summary>
+ /// <param name="arg1">The first value, expected to be less</param>
+ /// <param name="arg2">The second value, expected to be greater</param>
+public static void LessOrEqual(IComparable arg1, IComparable arg2)
+ {
+ Assert.That(arg1, Is.LessThanOrEqualTo(arg2) ,null, null);
+ }
+#endif
+
+ #endregion
+
+ #region Contains
+
+#if !NUNITLITE
+ /// <summary>
+ /// Asserts that an object is contained in a list.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The list to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+public static void Contains(object expected, ICollection actual, string message, params object[] args)
+ {
+ Assert.That(actual, new CollectionContainsConstraint(expected) ,message, args);
+ }
+ /// <summary>
+ /// Asserts that an object is contained in a list.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The list to be examined</param>
+ /// <param name="message">The message to display in case of failure</param>
+public static void Contains(object expected, ICollection actual, string message)
+ {
+ Assert.That(actual, new CollectionContainsConstraint(expected) ,message, null);
+ }
+ /// <summary>
+ /// Asserts that an object is contained in a list.
+ /// </summary>
+ /// <param name="expected">The expected object</param>
+ /// <param name="actual">The list to be examined</param>
+public static void Contains(object expected, ICollection actual)
+ {
+ Assert.That(actual, new CollectionContainsConstraint(expected) ,null, null);
+ }
+#endif
+
+ #endregion
+
+
+ #region Helper Methods
+ /// <summary>
+ /// Helper for Assert.AreEqual(double expected, double actual, ...)
+ /// allowing code generation to work consistently.
+ /// </summary>
+ /// <param name="expected">The expected value</param>
+ /// <param name="actual">The actual value</param>
+ /// <param name="delta">The maximum acceptable difference between the
+ /// the expected and the actual</param>
+ /// <param name="message">The message to display in case of failure</param>
+ /// <param name="args">Array of objects to be used in formatting the message</param>
+ protected static void AssertDoublesAreEqual(double expected, double actual, double delta, string message, object[] args)
+ {
+ if (double.IsNaN(expected) || double.IsInfinity(expected))
+ Assert.That(actual, Is.EqualTo(expected), message, args);
+ else
+ Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
+ }
+ #endregion
+ }
+}
=== modified file 'src/framework/Shared/Framework/Constraints/ConstraintExpression.cs'
--- src/framework/Shared/Framework/Constraints/ConstraintExpression.cs 2009-09-22 01:07:21 +0000
+++ src/framework/Shared/Framework/Constraints/ConstraintExpression.cs 2009-09-27 21:25:19 +0000
@@ -1,775 +1,775 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-
-namespace NUnit.Framework.Constraints
-{
- /// <summary>
- /// ConstraintExpression represents a compound constraint in the
- /// process of being constructed from a series of syntactic elements.
- ///
- /// Individual elements are appended to the expression as they are
- /// reognized. Once an actual Constraint is appended, the expression
- /// returns a resolvable Constraint.
- /// </summary>
- public class ConstraintExpression : ConstraintExpressionBase
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="T:ConstraintExpression"/> class.
- /// </summary>
- public ConstraintExpression() { }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="T:ConstraintExpression"/>
- /// class passing in a ConstraintBuilder, which may be pre-populated.
- /// </summary>
- /// <param name="builder">The builder.</param>
- public ConstraintExpression(ConstraintBuilder builder)
- : base( builder ) { }
-
- #region Not
-
- /// <summary>
- /// Returns a ConstraintExpression that negates any
- /// following constraint.
- /// </summary>
- public ConstraintExpression Not
- {
- get { return this.Append(new NotOperator()); }
- }
-
- /// <summary>
- /// Returns a ConstraintExpression that negates any
- /// following constraint.
- /// </summary>
- public ConstraintExpression No
- {
- get { return this.Append(new NotOperator()); }
- }
-
- #endregion
-
- #region All
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them succeed.
- /// </summary>
- public ConstraintExpression All
- {
- get { return this.Append(new AllOperator()); }
- }
-
- #endregion
-
- #region Some
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if at least one of them succeeds.
- /// </summary>
- public ConstraintExpression Some
- {
- get { return this.Append(new SomeOperator()); }
- }
-
- #endregion
-
- #region None
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them fail.
- /// </summary>
- public ConstraintExpression None
- {
- get { return this.Append(new NoneOperator()); }
- }
-
- #endregion
-
- #region Property
-
- /// <summary>
- /// Returns a new PropertyConstraintExpression, which will either
- /// test for the existence of the named property on the object
- /// being tested or apply any following constraint to that property.
- /// </summary>
- public ResolvableConstraintExpression Property(string name)
- {
- return this.Append(new PropOperator(name));
- }
-
- #endregion
-
- #region Length
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Length property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression Length
- {
- get { return Property("Length"); }
- }
-
- #endregion
-
- #region Count
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Count property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression Count
- {
- get { return Property("Count"); }
- }
-
- #endregion
-
- #region Message
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Message property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression Message
- {
- get { return Property("Message"); }
- }
-
- #endregion
-
- #region InnerException
-
-#if !NUNITLITE
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the InnerException property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression InnerException
- {
- get { return Property("InnerException"); }
- }
-#endif
-
- #endregion
-
- #region Attribute
-
- /// <summary>
- /// Returns a new AttributeConstraint checking for the
- /// presence of a particular attribute on an object.
- /// </summary>
- public ResolvableConstraintExpression Attribute(Type expectedType)
- {
- return this.Append(new AttributeOperator(expectedType));
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a new AttributeConstraint checking for the
- /// presence of a particular attribute on an object.
- /// </summary>
- public ResolvableConstraintExpression Attribute<T>()
- {
- return Attribute(typeof(T));
- }
-#endif
-
- #endregion
-
- #region With
-
- /// <summary>
- /// With is currently a NOP - reserved for future use.
- /// </summary>
- public ConstraintExpression With
- {
- get { return this.Append(new WithOperator()); }
- }
-
- #endregion
-
- #region Matches
-
-#if !NUNITLITE
- /// <summary>
- /// Returns the constraint provided as an argument - used to allow custom
- /// custom constraints to easily participate in the syntax.
- /// </summary>
- public Constraint Matches(Constraint constraint)
- {
- return this.Append(constraint);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns the constraint provided as an argument - used to allow custom
- /// custom constraints to easily participate in the syntax.
- /// </summary>
- public Constraint Matches<T>(Predicate<T> predicate)
- {
- return this.Append(new PredicateConstraint<T>(predicate));
- }
-#endif
-#endif
-
- #endregion
-
- #region Null
-
- /// <summary>
- /// Returns a constraint that tests for null
- /// </summary>
- public NullConstraint Null
- {
- get { return (NullConstraint)this.Append(new NullConstraint()); }
- }
-
- #endregion
-
- #region True
-
- /// <summary>
- /// Returns a constraint that tests for True
- /// </summary>
- public TrueConstraint True
- {
- get { return (TrueConstraint)this.Append(new TrueConstraint()); }
- }
-
- #endregion
-
- #region False
-
- /// <summary>
- /// Returns a constraint that tests for False
- /// </summary>
- public FalseConstraint False
- {
- get { return (FalseConstraint)this.Append(new FalseConstraint()); }
- }
-
- #endregion
-
- #region NaN
-
- /// <summary>
- /// Returns a constraint that tests for NaN
- /// </summary>
- public NaNConstraint NaN
- {
- get { return (NaNConstraint)this.Append(new NaNConstraint()); }
- }
-
- #endregion
-
- #region Empty
-
- /// <summary>
- /// Returns a constraint that tests for empty
- /// </summary>
- public EmptyConstraint Empty
- {
- get { return (EmptyConstraint)this.Append(new EmptyConstraint()); }
- }
-
- #endregion
-
- #region Unique
-
- /// <summary>
- /// Returns a constraint that tests whether a collection
- /// contains all unique items.
- /// </summary>
- public UniqueItemsConstraint Unique
- {
- get { return (UniqueItemsConstraint)this.Append(new UniqueItemsConstraint()); }
- }
-
- #endregion
-
- #region BinarySerializable
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that tests whether an object graph is serializable in binary format.
- /// </summary>
- public BinarySerializableConstraint BinarySerializable
- {
- get { return (BinarySerializableConstraint)this.Append(new BinarySerializableConstraint()); }
- }
-#endif
-
- #endregion
-
- #region XmlSerializable
-
-#if !NETCF_1_0
- /// <summary>
- /// Returns a constraint that tests whether an object graph is serializable in xml format.
- /// </summary>
- public XmlSerializableConstraint XmlSerializable
- {
- get { return (XmlSerializableConstraint)this.Append(new XmlSerializableConstraint()); }
- }
-#endif
-
- #endregion
-
- #region EqualTo
-
- /// <summary>
- /// Returns a constraint that tests two items for equality
- /// </summary>
- public EqualConstraint EqualTo(object expected)
- {
- return (EqualConstraint)this.Append(new EqualConstraint(expected));
- }
-
- #endregion
-
- #region SameAs
-
- /// <summary>
- /// Returns a constraint that tests that two references are the same object
- /// </summary>
- public SameAsConstraint SameAs(object expected)
- {
- return (SameAsConstraint)this.Append(new SameAsConstraint(expected));
- }
-
- #endregion
-
- #region GreaterThan
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than the suppled argument
- /// </summary>
- public GreaterThanConstraint GreaterThan(object expected)
- {
- return (GreaterThanConstraint)this.Append(new GreaterThanConstraint(expected));
- }
-
- #endregion
-
- #region GreaterThanOrEqualTo
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than or equal to the suppled argument
- /// </summary>
- public GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
- {
- return (GreaterThanOrEqualConstraint)this.Append(new GreaterThanOrEqualConstraint(expected));
- }
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than or equal to the suppled argument
- /// </summary>
- public GreaterThanOrEqualConstraint AtLeast(object expected)
- {
- return (GreaterThanOrEqualConstraint)this.Append(new GreaterThanOrEqualConstraint(expected));
- }
-
- #endregion
-
- #region LessThan
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than the suppled argument
- /// </summary>
- public LessThanConstraint LessThan(object expected)
- {
- return (LessThanConstraint)this.Append(new LessThanConstraint(expected));
- }
-
- #endregion
-
- #region LessThanOrEqualTo
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than or equal to the suppled argument
- /// </summary>
- public LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
- {
- return (LessThanOrEqualConstraint)this.Append(new LessThanOrEqualConstraint(expected));
- }
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than or equal to the suppled argument
- /// </summary>
- public LessThanOrEqualConstraint AtMost(object expected)
- {
- return (LessThanOrEqualConstraint)this.Append(new LessThanOrEqualConstraint(expected));
- }
-
- #endregion
-
- #region TypeOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual
- /// value is of the exact type supplied as an argument.
- /// </summary>
- public ExactTypeConstraint TypeOf(Type expectedType)
- {
- return (ExactTypeConstraint)this.Append(new ExactTypeConstraint(expectedType));
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual
- /// value is of the exact type supplied as an argument.
- /// </summary>
- public ExactTypeConstraint TypeOf<T>()
- {
- return (ExactTypeConstraint)this.Append(new ExactTypeConstraint(typeof(T)));
- }
-#endif
-
- #endregion
-
- #region InstanceOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- public InstanceOfTypeConstraint InstanceOf(Type expectedType)
- {
- return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(expectedType));
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- public InstanceOfTypeConstraint InstanceOf<T>()
- {
- return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(typeof(T)));
- }
-#endif
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- [Obsolete("Use InstanceOf(expectedType)")]
- public InstanceOfTypeConstraint InstanceOfType(Type expectedType)
- {
- return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(expectedType));
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- [Obsolete("Use InstanceOf<T>()")]
- public InstanceOfTypeConstraint InstanceOfType<T>()
- {
- return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(typeof(T)));
- }
-#endif
-
- #endregion
-
- #region AssignableFrom
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableFromConstraint AssignableFrom(Type expectedType)
- {
- return (AssignableFromConstraint)this.Append(new AssignableFromConstraint(expectedType));
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableFromConstraint AssignableFrom<T>()
- {
- return (AssignableFromConstraint)this.Append(new AssignableFromConstraint(typeof(T)));
- }
-#endif
-
- #endregion
-
- #region AssignableTo
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableToConstraint AssignableTo(Type expectedType)
- {
- return (AssignableToConstraint)this.Append(new AssignableToConstraint(expectedType));
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableToConstraint AssignableTo<T>()
- {
- return (AssignableToConstraint)this.Append(new AssignableToConstraint(typeof(T)));
- }
-#endif
-
- #endregion
-
- #region EquivalentTo
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is a collection containing the same elements as the
- /// collection supplied as an argument.
- /// </summary>
- public CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
- {
- return (CollectionEquivalentConstraint)this.Append(new CollectionEquivalentConstraint(expected));
- }
-
- #endregion
-
- #region SubsetOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is a subset of the collection supplied as an argument.
- /// </summary>
- public CollectionSubsetConstraint SubsetOf(IEnumerable expected)
- {
- return (CollectionSubsetConstraint)this.Append(new CollectionSubsetConstraint(expected));
- }
-
- #endregion
-
- #region Ordered
-
- /// <summary>
- /// Returns a constraint that tests whether a collection is ordered
- /// </summary>
- public CollectionOrderedConstraint Ordered
- {
- get { return (CollectionOrderedConstraint)this.Append(new CollectionOrderedConstraint()); }
- }
-
- #endregion
-
- #region Member
-
- /// <summary>
- /// Returns a new CollectionContainsConstraint checking for the
- /// presence of a particular object in the collection.
- /// </summary>
- public CollectionContainsConstraint Member(object expected)
- {
- return (CollectionContainsConstraint)this.Append(new CollectionContainsConstraint(expected));
- }
-
- /// <summary>
- /// Returns a new CollectionContainsConstraint checking for the
- /// presence of a particular object in the collection.
- /// </summary>
- public CollectionContainsConstraint Contains(object expected)
- {
- return (CollectionContainsConstraint)this.Append(new CollectionContainsConstraint(expected));
- }
-
- #endregion
-
- #region Contains
-
- /// <summary>
- /// Returns a new ContainsConstraint. This constraint
- /// will, in turn, make use of the appropriate second-level
- /// constraint, depending on the type of the actual argument.
- /// This overload is only used if the item sought is a string,
- /// since any other type implies that we are looking for a
- /// collection member.
- /// </summary>
- public ContainsConstraint Contains(string expected)
- {
- return (ContainsConstraint)this.Append(new ContainsConstraint(expected));
- }
-
- #endregion
-
- #region StringContaining
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- public SubstringConstraint StringContaining(string expected)
- {
- return (SubstringConstraint)this.Append(new SubstringConstraint(expected));
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- public SubstringConstraint ContainsSubstring(string expected)
- {
- return (SubstringConstraint)this.Append(new SubstringConstraint(expected));
- }
-
- #endregion
-
- #region StartsWith
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public StartsWithConstraint StartsWith(string expected)
- {
- return (StartsWithConstraint)this.Append(new StartsWithConstraint(expected));
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public StartsWithConstraint StringStarting(string expected)
- {
- return (StartsWithConstraint)this.Append(new StartsWithConstraint(expected));
- }
-
- #endregion
-
- #region EndsWith
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public EndsWithConstraint EndsWith(string expected)
- {
- return (EndsWithConstraint)this.Append(new EndsWithConstraint(expected));
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public EndsWithConstraint StringEnding(string expected)
- {
- return (EndsWithConstraint)this.Append(new EndsWithConstraint(expected));
- }
-
- #endregion
-
- #region Matches
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value matches the regular expression supplied as an argument.
- /// </summary>
- public RegexConstraint Matches(string pattern)
- {
- return (RegexConstraint)this.Append(new RegexConstraint(pattern));
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value matches the regular expression supplied as an argument.
- /// </summary>
- public RegexConstraint StringMatching(string pattern)
- {
- return (RegexConstraint)this.Append(new RegexConstraint(pattern));
- }
-#endif
-
- #endregion
-
- #region SamePath
-
- /// <summary>
- /// Returns a constraint that tests whether the path provided
- /// is the same as an expected path after canonicalization.
- /// </summary>
- public SamePathConstraint SamePath(string expected)
- {
- return (SamePathConstraint)this.Append(new SamePathConstraint(expected));
- }
-
- #endregion
-
- #region SamePathOrUnder
-
- /// <summary>
- /// Returns a constraint that tests whether the path provided
- /// is the same path or under an expected path after canonicalization.
- /// </summary>
- public SamePathOrUnderConstraint SamePathOrUnder(string expected)
- {
- return (SamePathOrUnderConstraint)this.Append(new SamePathOrUnderConstraint(expected));
- }
-
- #endregion
-
- #region InRange
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value falls
- /// within a specified range.
- /// </summary>
- public RangeConstraint InRange(IComparable from, IComparable to)
- {
- return (RangeConstraint)this.Append(new RangeConstraint(from, to));
- }
-
- #endregion
-
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// ConstraintExpression represents a compound constraint in the
+ /// process of being constructed from a series of syntactic elements.
+ ///
+ /// Individual elements are appended to the expression as they are
+ /// reognized. Once an actual Constraint is appended, the expression
+ /// returns a resolvable Constraint.
+ /// </summary>
+ public class ConstraintExpression : ConstraintExpressionBase
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:ConstraintExpression"/> class.
+ /// </summary>
+ public ConstraintExpression() { }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:ConstraintExpression"/>
+ /// class passing in a ConstraintBuilder, which may be pre-populated.
+ /// </summary>
+ /// <param name="builder">The builder.</param>
+ public ConstraintExpression(ConstraintBuilder builder)
+ : base( builder ) { }
+
+ #region Not
+
+ /// <summary>
+ /// Returns a ConstraintExpression that negates any
+ /// following constraint.
+ /// </summary>
+public ConstraintExpression Not
+ {
+ get { return this.Append(new NotOperator()); }
+ }
+
+ /// <summary>
+ /// Returns a ConstraintExpression that negates any
+ /// following constraint.
+ /// </summary>
+public ConstraintExpression No
+ {
+ get { return this.Append(new NotOperator()); }
+ }
+
+ #endregion
+
+ #region All
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+public ConstraintExpression All
+ {
+ get { return this.Append(new AllOperator()); }
+ }
+
+ #endregion
+
+ #region Some
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if at least one of them succeeds.
+ /// </summary>
+public ConstraintExpression Some
+ {
+ get { return this.Append(new SomeOperator()); }
+ }
+
+ #endregion
+
+ #region None
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them fail.
+ /// </summary>
+public ConstraintExpression None
+ {
+ get { return this.Append(new NoneOperator()); }
+ }
+
+ #endregion
+
+ #region Property
+
+ /// <summary>
+ /// Returns a new PropertyConstraintExpression, which will either
+ /// test for the existence of the named property on the object
+ /// being tested or apply any following constraint to that property.
+ /// </summary>
+public ResolvableConstraintExpression Property(string name)
+ {
+ return this.Append(new PropOperator(name));
+ }
+
+ #endregion
+
+ #region Length
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Length property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression Length
+ {
+ get { return Property("Length"); }
+ }
+
+ #endregion
+
+ #region Count
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Count property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression Count
+ {
+ get { return Property("Count"); }
+ }
+
+ #endregion
+
+ #region Message
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Message property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression Message
+ {
+ get { return Property("Message"); }
+ }
+
+ #endregion
+
+ #region InnerException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the InnerException property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression InnerException
+ {
+ get { return Property("InnerException"); }
+ }
+#endif
+
+ #endregion
+
+ #region Attribute
+
+ /// <summary>
+ /// Returns a new AttributeConstraint checking for the
+ /// presence of a particular attribute on an object.
+ /// </summary>
+public ResolvableConstraintExpression Attribute(Type expectedType)
+ {
+ return this.Append(new AttributeOperator(expectedType));
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a new AttributeConstraint checking for the
+ /// presence of a particular attribute on an object.
+ /// </summary>
+public ResolvableConstraintExpression Attribute<T>()
+ {
+ return Attribute(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region With
+
+ /// <summary>
+ /// With is currently a NOP - reserved for future use.
+ /// </summary>
+public ConstraintExpression With
+ {
+ get { return this.Append(new WithOperator()); }
+ }
+
+ #endregion
+
+ #region Matches
+
+#if !NUNITLITE
+ /// <summary>
+ /// Returns the constraint provided as an argument - used to allow custom
+ /// custom constraints to easily participate in the syntax.
+ /// </summary>
+public Constraint Matches(Constraint constraint)
+ {
+ return this.Append(constraint);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns the constraint provided as an argument - used to allow custom
+ /// custom constraints to easily participate in the syntax.
+ /// </summary>
+public Constraint Matches<T>(Predicate<T> predicate)
+ {
+ return this.Append(new PredicateConstraint<T>(predicate));
+ }
+#endif
+#endif
+
+ #endregion
+
+ #region Null
+
+ /// <summary>
+ /// Returns a constraint that tests for null
+ /// </summary>
+public NullConstraint Null
+ {
+ get { return (NullConstraint)this.Append(new NullConstraint()); }
+ }
+
+ #endregion
+
+ #region True
+
+ /// <summary>
+ /// Returns a constraint that tests for True
+ /// </summary>
+public TrueConstraint True
+ {
+ get { return (TrueConstraint)this.Append(new TrueConstraint()); }
+ }
+
+ #endregion
+
+ #region False
+
+ /// <summary>
+ /// Returns a constraint that tests for False
+ /// </summary>
+public FalseConstraint False
+ {
+ get { return (FalseConstraint)this.Append(new FalseConstraint()); }
+ }
+
+ #endregion
+
+ #region NaN
+
+ /// <summary>
+ /// Returns a constraint that tests for NaN
+ /// </summary>
+public NaNConstraint NaN
+ {
+ get { return (NaNConstraint)this.Append(new NaNConstraint()); }
+ }
+
+ #endregion
+
+ #region Empty
+
+ /// <summary>
+ /// Returns a constraint that tests for empty
+ /// </summary>
+public EmptyConstraint Empty
+ {
+ get { return (EmptyConstraint)this.Append(new EmptyConstraint()); }
+ }
+
+ #endregion
+
+ #region Unique
+
+ /// <summary>
+ /// Returns a constraint that tests whether a collection
+ /// contains all unique items.
+ /// </summary>
+public UniqueItemsConstraint Unique
+ {
+ get { return (UniqueItemsConstraint)this.Append(new UniqueItemsConstraint()); }
+ }
+
+ #endregion
+
+ #region BinarySerializable
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that tests whether an object graph is serializable in binary format.
+ /// </summary>
+public BinarySerializableConstraint BinarySerializable
+ {
+ get { return (BinarySerializableConstraint)this.Append(new BinarySerializableConstraint()); }
+ }
+#endif
+
+ #endregion
+
+ #region XmlSerializable
+
+#if !NETCF_1_0
+ /// <summary>
+ /// Returns a constraint that tests whether an object graph is serializable in xml format.
+ /// </summary>
+public XmlSerializableConstraint XmlSerializable
+ {
+ get { return (XmlSerializableConstraint)this.Append(new XmlSerializableConstraint()); }
+ }
+#endif
+
+ #endregion
+
+ #region EqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests two items for equality
+ /// </summary>
+public EqualConstraint EqualTo(object expected)
+ {
+ return (EqualConstraint)this.Append(new EqualConstraint(expected));
+ }
+
+ #endregion
+
+ #region SameAs
+
+ /// <summary>
+ /// Returns a constraint that tests that two references are the same object
+ /// </summary>
+public SameAsConstraint SameAs(object expected)
+ {
+ return (SameAsConstraint)this.Append(new SameAsConstraint(expected));
+ }
+
+ #endregion
+
+ #region GreaterThan
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than the suppled argument
+ /// </summary>
+public GreaterThanConstraint GreaterThan(object expected)
+ {
+ return (GreaterThanConstraint)this.Append(new GreaterThanConstraint(expected));
+ }
+
+ #endregion
+
+ #region GreaterThanOrEqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+public GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
+ {
+ return (GreaterThanOrEqualConstraint)this.Append(new GreaterThanOrEqualConstraint(expected));
+ }
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+public GreaterThanOrEqualConstraint AtLeast(object expected)
+ {
+ return (GreaterThanOrEqualConstraint)this.Append(new GreaterThanOrEqualConstraint(expected));
+ }
+
+ #endregion
+
+ #region LessThan
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than the suppled argument
+ /// </summary>
+public LessThanConstraint LessThan(object expected)
+ {
+ return (LessThanConstraint)this.Append(new LessThanConstraint(expected));
+ }
+
+ #endregion
+
+ #region LessThanOrEqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+public LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
+ {
+ return (LessThanOrEqualConstraint)this.Append(new LessThanOrEqualConstraint(expected));
+ }
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+public LessThanOrEqualConstraint AtMost(object expected)
+ {
+ return (LessThanOrEqualConstraint)this.Append(new LessThanOrEqualConstraint(expected));
+ }
+
+ #endregion
+
+ #region TypeOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+public ExactTypeConstraint TypeOf(Type expectedType)
+ {
+ return (ExactTypeConstraint)this.Append(new ExactTypeConstraint(expectedType));
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+public ExactTypeConstraint TypeOf<T>()
+ {
+ return (ExactTypeConstraint)this.Append(new ExactTypeConstraint(typeof(T)));
+ }
+#endif
+
+ #endregion
+
+ #region InstanceOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+public InstanceOfTypeConstraint InstanceOf(Type expectedType)
+ {
+ return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(expectedType));
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+public InstanceOfTypeConstraint InstanceOf<T>()
+ {
+ return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(typeof(T)));
+ }
+#endif
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+ [Obsolete("Use InstanceOf(expectedType)")]
+public InstanceOfTypeConstraint InstanceOfType(Type expectedType)
+ {
+ return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(expectedType));
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+ [Obsolete("Use InstanceOf<T>()")]
+public InstanceOfTypeConstraint InstanceOfType<T>()
+ {
+ return (InstanceOfTypeConstraint)this.Append(new InstanceOfTypeConstraint(typeof(T)));
+ }
+#endif
+
+ #endregion
+
+ #region AssignableFrom
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableFromConstraint AssignableFrom(Type expectedType)
+ {
+ return (AssignableFromConstraint)this.Append(new AssignableFromConstraint(expectedType));
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableFromConstraint AssignableFrom<T>()
+ {
+ return (AssignableFromConstraint)this.Append(new AssignableFromConstraint(typeof(T)));
+ }
+#endif
+
+ #endregion
+
+ #region AssignableTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableToConstraint AssignableTo(Type expectedType)
+ {
+ return (AssignableToConstraint)this.Append(new AssignableToConstraint(expectedType));
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableToConstraint AssignableTo<T>()
+ {
+ return (AssignableToConstraint)this.Append(new AssignableToConstraint(typeof(T)));
+ }
+#endif
+
+ #endregion
+
+ #region EquivalentTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is a collection containing the same elements as the
+ /// collection supplied as an argument.
+ /// </summary>
+public CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
+ {
+ return (CollectionEquivalentConstraint)this.Append(new CollectionEquivalentConstraint(expected));
+ }
+
+ #endregion
+
+ #region SubsetOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is a subset of the collection supplied as an argument.
+ /// </summary>
+public CollectionSubsetConstraint SubsetOf(IEnumerable expected)
+ {
+ return (CollectionSubsetConstraint)this.Append(new CollectionSubsetConstraint(expected));
+ }
+
+ #endregion
+
+ #region Ordered
+
+ /// <summary>
+ /// Returns a constraint that tests whether a collection is ordered
+ /// </summary>
+public CollectionOrderedConstraint Ordered
+ {
+ get { return (CollectionOrderedConstraint)this.Append(new CollectionOrderedConstraint()); }
+ }
+
+ #endregion
+
+ #region Member
+
+ /// <summary>
+ /// Returns a new CollectionContainsConstraint checking for the
+ /// presence of a particular object in the collection.
+ /// </summary>
+public CollectionContainsConstraint Member(object expected)
+ {
+ return (CollectionContainsConstraint)this.Append(new CollectionContainsConstraint(expected));
+ }
+
+ /// <summary>
+ /// Returns a new CollectionContainsConstraint checking for the
+ /// presence of a particular object in the collection.
+ /// </summary>
+public CollectionContainsConstraint Contains(object expected)
+ {
+ return (CollectionContainsConstraint)this.Append(new CollectionContainsConstraint(expected));
+ }
+
+ #endregion
+
+ #region Contains
+
+ /// <summary>
+ /// Returns a new ContainsConstraint. This constraint
+ /// will, in turn, make use of the appropriate second-level
+ /// constraint, depending on the type of the actual argument.
+ /// This overload is only used if the item sought is a string,
+ /// since any other type implies that we are looking for a
+ /// collection member.
+ /// </summary>
+public ContainsConstraint Contains(string expected)
+ {
+ return (ContainsConstraint)this.Append(new ContainsConstraint(expected));
+ }
+
+ #endregion
+
+ #region StringContaining
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+public SubstringConstraint StringContaining(string expected)
+ {
+ return (SubstringConstraint)this.Append(new SubstringConstraint(expected));
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+public SubstringConstraint ContainsSubstring(string expected)
+ {
+ return (SubstringConstraint)this.Append(new SubstringConstraint(expected));
+ }
+
+ #endregion
+
+ #region StartsWith
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public StartsWithConstraint StartsWith(string expected)
+ {
+ return (StartsWithConstraint)this.Append(new StartsWithConstraint(expected));
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public StartsWithConstraint StringStarting(string expected)
+ {
+ return (StartsWithConstraint)this.Append(new StartsWithConstraint(expected));
+ }
+
+ #endregion
+
+ #region EndsWith
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public EndsWithConstraint EndsWith(string expected)
+ {
+ return (EndsWithConstraint)this.Append(new EndsWithConstraint(expected));
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public EndsWithConstraint StringEnding(string expected)
+ {
+ return (EndsWithConstraint)this.Append(new EndsWithConstraint(expected));
+ }
+
+ #endregion
+
+ #region Matches
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value matches the regular expression supplied as an argument.
+ /// </summary>
+public RegexConstraint Matches(string pattern)
+ {
+ return (RegexConstraint)this.Append(new RegexConstraint(pattern));
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value matches the regular expression supplied as an argument.
+ /// </summary>
+public RegexConstraint StringMatching(string pattern)
+ {
+ return (RegexConstraint)this.Append(new RegexConstraint(pattern));
+ }
+#endif
+
+ #endregion
+
+ #region SamePath
+
+ /// <summary>
+ /// Returns a constraint that tests whether the path provided
+ /// is the same as an expected path after canonicalization.
+ /// </summary>
+public SamePathConstraint SamePath(string expected)
+ {
+ return (SamePathConstraint)this.Append(new SamePathConstraint(expected));
+ }
+
+ #endregion
+
+ #region SamePathOrUnder
+
+ /// <summary>
+ /// Returns a constraint that tests whether the path provided
+ /// is the same path or under an expected path after canonicalization.
+ /// </summary>
+public SamePathOrUnderConstraint SamePathOrUnder(string expected)
+ {
+ return (SamePathOrUnderConstraint)this.Append(new SamePathOrUnderConstraint(expected));
+ }
+
+ #endregion
+
+ #region InRange
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value falls
+ /// within a specified range.
+ /// </summary>
+public RangeConstraint InRange(IComparable from, IComparable to)
+ {
+ return (RangeConstraint)this.Append(new RangeConstraint(from, to));
+ }
+
+ #endregion
+
+ }
+}
=== modified file 'src/framework/Shared/Framework/Constraints/ConstraintFactory.cs'
--- src/framework/Shared/Framework/Constraints/ConstraintFactory.cs 2009-09-22 01:07:21 +0000
+++ src/framework/Shared/Framework/Constraints/ConstraintFactory.cs 2009-09-27 21:25:19 +0000
@@ -1,774 +1,774 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-
-namespace NUnit.Framework.Constraints
-{
- /// <summary>
- /// Helper class with properties and methods that supply
- /// a number of constraints used in Asserts.
- /// </summary>
- public class ConstraintFactory
- {
- #region Not
-
- /// <summary>
- /// Returns a ConstraintExpression that negates any
- /// following constraint.
- /// </summary>
- public ConstraintExpression Not
- {
- get { return Is.Not; }
- }
-
- /// <summary>
- /// Returns a ConstraintExpression that negates any
- /// following constraint.
- /// </summary>
- public ConstraintExpression No
- {
- get { return Has.No; }
- }
-
- #endregion
-
- #region All
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them succeed.
- /// </summary>
- public ConstraintExpression All
- {
- get { return Is.All; }
- }
-
- #endregion
-
- #region Some
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if at least one of them succeeds.
- /// </summary>
- public ConstraintExpression Some
- {
- get { return Has.Some; }
- }
-
- #endregion
-
- #region None
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them fail.
- /// </summary>
- public ConstraintExpression None
- {
- get { return Has.None; }
- }
-
- #endregion
-
- #region Property
-
- /// <summary>
- /// Returns a new PropertyConstraintExpression, which will either
- /// test for the existence of the named property on the object
- /// being tested or apply any following constraint to that property.
- /// </summary>
- public ResolvableConstraintExpression Property(string name)
- {
- return Has.Property(name);
- }
-
- #endregion
-
- #region Length
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Length property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression Length
- {
- get { return Has.Length; }
- }
-
- #endregion
-
- #region Count
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Count property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression Count
- {
- get { return Has.Count; }
- }
-
- #endregion
-
- #region Message
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Message property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression Message
- {
- get { return Has.Message; }
- }
-
- #endregion
-
- #region InnerException
-
-#if !NUNITLITE
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the InnerException property of the object being tested.
- /// </summary>
- public ResolvableConstraintExpression InnerException
- {
- get { return Has.InnerException; }
- }
-#endif
-
- #endregion
-
- #region Attribute
-
- /// <summary>
- /// Returns a new AttributeConstraint checking for the
- /// presence of a particular attribute on an object.
- /// </summary>
- public ResolvableConstraintExpression Attribute(Type expectedType)
- {
- return Has.Attribute(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a new AttributeConstraint checking for the
- /// presence of a particular attribute on an object.
- /// </summary>
- public ResolvableConstraintExpression Attribute<T>()
- {
- return Attribute(typeof(T));
- }
-#endif
-
- #endregion
-
- #region Null
-
- /// <summary>
- /// Returns a constraint that tests for null
- /// </summary>
- public NullConstraint Null
- {
- get { return new NullConstraint(); }
- }
-
- #endregion
-
- #region True
-
- /// <summary>
- /// Returns a constraint that tests for True
- /// </summary>
- public TrueConstraint True
- {
- get { return new TrueConstraint(); }
- }
-
- #endregion
-
- #region False
-
- /// <summary>
- /// Returns a constraint that tests for False
- /// </summary>
- public FalseConstraint False
- {
- get { return new FalseConstraint(); }
- }
-
- #endregion
-
- #region NaN
-
- /// <summary>
- /// Returns a constraint that tests for NaN
- /// </summary>
- public NaNConstraint NaN
- {
- get { return new NaNConstraint(); }
- }
-
- #endregion
-
- #region Empty
-
- /// <summary>
- /// Returns a constraint that tests for empty
- /// </summary>
- public EmptyConstraint Empty
- {
- get { return new EmptyConstraint(); }
- }
-
- #endregion
-
- #region Unique
-
- /// <summary>
- /// Returns a constraint that tests whether a collection
- /// contains all unique items.
- /// </summary>
- public UniqueItemsConstraint Unique
- {
- get { return new UniqueItemsConstraint(); }
- }
-
- #endregion
-
- #region BinarySerializable
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that tests whether an object graph is serializable in binary format.
- /// </summary>
- public BinarySerializableConstraint BinarySerializable
- {
- get { return new BinarySerializableConstraint(); }
- }
-#endif
-
- #endregion
-
- #region XmlSerializable
-
-#if !NETCF_1_0
- /// <summary>
- /// Returns a constraint that tests whether an object graph is serializable in xml format.
- /// </summary>
- public XmlSerializableConstraint XmlSerializable
- {
- get { return new XmlSerializableConstraint(); }
- }
-#endif
-
- #endregion
-
- #region EqualTo
-
- /// <summary>
- /// Returns a constraint that tests two items for equality
- /// </summary>
- public EqualConstraint EqualTo(object expected)
- {
- return new EqualConstraint(expected);
- }
-
- #endregion
-
- #region SameAs
-
- /// <summary>
- /// Returns a constraint that tests that two references are the same object
- /// </summary>
- public SameAsConstraint SameAs(object expected)
- {
- return new SameAsConstraint(expected);
- }
-
- #endregion
-
- #region GreaterThan
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than the suppled argument
- /// </summary>
- public GreaterThanConstraint GreaterThan(object expected)
- {
- return new GreaterThanConstraint(expected);
- }
-
- #endregion
-
- #region GreaterThanOrEqualTo
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than or equal to the suppled argument
- /// </summary>
- public GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
- {
- return new GreaterThanOrEqualConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than or equal to the suppled argument
- /// </summary>
- public GreaterThanOrEqualConstraint AtLeast(object expected)
- {
- return new GreaterThanOrEqualConstraint(expected);
- }
-
- #endregion
-
- #region LessThan
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than the suppled argument
- /// </summary>
- public LessThanConstraint LessThan(object expected)
- {
- return new LessThanConstraint(expected);
- }
-
- #endregion
-
- #region LessThanOrEqualTo
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than or equal to the suppled argument
- /// </summary>
- public LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
- {
- return new LessThanOrEqualConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than or equal to the suppled argument
- /// </summary>
- public LessThanOrEqualConstraint AtMost(object expected)
- {
- return new LessThanOrEqualConstraint(expected);
- }
-
- #endregion
-
- #region TypeOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual
- /// value is of the exact type supplied as an argument.
- /// </summary>
- public ExactTypeConstraint TypeOf(Type expectedType)
- {
- return new ExactTypeConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual
- /// value is of the exact type supplied as an argument.
- /// </summary>
- public ExactTypeConstraint TypeOf<T>()
- {
- return new ExactTypeConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region InstanceOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- public InstanceOfTypeConstraint InstanceOf(Type expectedType)
- {
- return new InstanceOfTypeConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- public InstanceOfTypeConstraint InstanceOf<T>()
- {
- return new InstanceOfTypeConstraint(typeof(T));
- }
-#endif
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- [Obsolete("Use InstanceOf(expectedType)")]
- public InstanceOfTypeConstraint InstanceOfType(Type expectedType)
- {
- return new InstanceOfTypeConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- [Obsolete("Use InstanceOf<T>()")]
- public InstanceOfTypeConstraint InstanceOfType<T>()
- {
- return new InstanceOfTypeConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region AssignableFrom
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableFromConstraint AssignableFrom(Type expectedType)
- {
- return new AssignableFromConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableFromConstraint AssignableFrom<T>()
- {
- return new AssignableFromConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region AssignableTo
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableToConstraint AssignableTo(Type expectedType)
- {
- return new AssignableToConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public AssignableToConstraint AssignableTo<T>()
- {
- return new AssignableToConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region EquivalentTo
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is a collection containing the same elements as the
- /// collection supplied as an argument.
- /// </summary>
- public CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
- {
- return new CollectionEquivalentConstraint(expected);
- }
-
- #endregion
-
- #region SubsetOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is a subset of the collection supplied as an argument.
- /// </summary>
- public CollectionSubsetConstraint SubsetOf(IEnumerable expected)
- {
- return new CollectionSubsetConstraint(expected);
- }
-
- #endregion
-
- #region Ordered
-
- /// <summary>
- /// Returns a constraint that tests whether a collection is ordered
- /// </summary>
- public CollectionOrderedConstraint Ordered
- {
- get { return new CollectionOrderedConstraint(); }
- }
-
- #endregion
-
- #region Member
-
- /// <summary>
- /// Returns a new CollectionContainsConstraint checking for the
- /// presence of a particular object in the collection.
- /// </summary>
- public CollectionContainsConstraint Member(object expected)
- {
- return new CollectionContainsConstraint(expected);
- }
-
- /// <summary>
- /// Returns a new CollectionContainsConstraint checking for the
- /// presence of a particular object in the collection.
- /// </summary>
- public CollectionContainsConstraint Contains(object expected)
- {
- return new CollectionContainsConstraint(expected);
- }
-
- #endregion
-
- #region Contains
-
- /// <summary>
- /// Returns a new ContainsConstraint. This constraint
- /// will, in turn, make use of the appropriate second-level
- /// constraint, depending on the type of the actual argument.
- /// This overload is only used if the item sought is a string,
- /// since any other type implies that we are looking for a
- /// collection member.
- /// </summary>
- public ContainsConstraint Contains(string expected)
- {
- return new ContainsConstraint(expected);
- }
-
- #endregion
-
- #region StringContaining
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- public SubstringConstraint StringContaining(string expected)
- {
- return new SubstringConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- public SubstringConstraint ContainsSubstring(string expected)
- {
- return new SubstringConstraint(expected);
- }
-
- #endregion
-
- #region DoesNotContain
-
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- public SubstringConstraint DoesNotContain(string expected)
- {
- return new ConstraintExpression().Not.ContainsSubstring(expected);
- }
-
- #endregion
-
- #region StartsWith
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public StartsWithConstraint StartsWith(string expected)
- {
- return new StartsWithConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public StartsWithConstraint StringStarting(string expected)
- {
- return new StartsWithConstraint(expected);
- }
-
- #endregion
-
- #region DoesNotStartWith
-
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public StartsWithConstraint DoesNotStartWith(string expected)
- {
- return new ConstraintExpression().Not.StartsWith(expected);
- }
-
- #endregion
-
- #region EndsWith
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public EndsWithConstraint EndsWith(string expected)
- {
- return new EndsWithConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public EndsWithConstraint StringEnding(string expected)
- {
- return new EndsWithConstraint(expected);
- }
-
- #endregion
-
- #region DoesNotEndWith
-
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public EndsWithConstraint DoesNotEndWith(string expected)
- {
- return new ConstraintExpression().Not.EndsWith(expected);
- }
-
- #endregion
-
- #region Matches
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value matches the regular expression supplied as an argument.
- /// </summary>
- public RegexConstraint Matches(string pattern)
- {
- return new RegexConstraint(pattern);
- }
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value matches the regular expression supplied as an argument.
- /// </summary>
- public RegexConstraint StringMatching(string pattern)
- {
- return new RegexConstraint(pattern);
- }
-#endif
-
- #endregion
-
- #region DoesNotMatch
-
-#if !NUNITLITE
- /// <summary>
- /// Returns a constraint that fails if the actual
- /// value matches the pattern supplied as an argument.
- /// </summary>
- public RegexConstraint DoesNotMatch(string pattern)
- {
- return new ConstraintExpression().Not.Matches(pattern);
- }
-#endif
-
- #endregion
-
- #region SamePath
-
- /// <summary>
- /// Returns a constraint that tests whether the path provided
- /// is the same as an expected path after canonicalization.
- /// </summary>
- public SamePathConstraint SamePath(string expected)
- {
- return new SamePathConstraint(expected);
- }
-
- #endregion
-
- #region SamePathOrUnder
-
- /// <summary>
- /// Returns a constraint that tests whether the path provided
- /// is the same path or under an expected path after canonicalization.
- /// </summary>
- public SamePathOrUnderConstraint SamePathOrUnder(string expected)
- {
- return new SamePathOrUnderConstraint(expected);
- }
-
- #endregion
-
- #region InRange
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value falls
- /// within a specified range.
- /// </summary>
- public RangeConstraint InRange(IComparable from, IComparable to)
- {
- return new RangeConstraint(from, to);
- }
-
- #endregion
-
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+
+namespace NUnit.Framework.Constraints
+{
+ /// <summary>
+ /// Helper class with properties and methods that supply
+ /// a number of constraints used in Asserts.
+ /// </summary>
+ public class ConstraintFactory
+ {
+ #region Not
+
+ /// <summary>
+ /// Returns a ConstraintExpression that negates any
+ /// following constraint.
+ /// </summary>
+public ConstraintExpression Not
+ {
+ get { return Is.Not; }
+ }
+
+ /// <summary>
+ /// Returns a ConstraintExpression that negates any
+ /// following constraint.
+ /// </summary>
+public ConstraintExpression No
+ {
+ get { return Has.No; }
+ }
+
+ #endregion
+
+ #region All
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+public ConstraintExpression All
+ {
+ get { return Is.All; }
+ }
+
+ #endregion
+
+ #region Some
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if at least one of them succeeds.
+ /// </summary>
+public ConstraintExpression Some
+ {
+ get { return Has.Some; }
+ }
+
+ #endregion
+
+ #region None
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them fail.
+ /// </summary>
+public ConstraintExpression None
+ {
+ get { return Has.None; }
+ }
+
+ #endregion
+
+ #region Property
+
+ /// <summary>
+ /// Returns a new PropertyConstraintExpression, which will either
+ /// test for the existence of the named property on the object
+ /// being tested or apply any following constraint to that property.
+ /// </summary>
+public ResolvableConstraintExpression Property(string name)
+ {
+ return Has.Property(name);
+ }
+
+ #endregion
+
+ #region Length
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Length property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression Length
+ {
+ get { return Has.Length; }
+ }
+
+ #endregion
+
+ #region Count
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Count property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression Count
+ {
+ get { return Has.Count; }
+ }
+
+ #endregion
+
+ #region Message
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Message property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression Message
+ {
+ get { return Has.Message; }
+ }
+
+ #endregion
+
+ #region InnerException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the InnerException property of the object being tested.
+ /// </summary>
+public ResolvableConstraintExpression InnerException
+ {
+ get { return Has.InnerException; }
+ }
+#endif
+
+ #endregion
+
+ #region Attribute
+
+ /// <summary>
+ /// Returns a new AttributeConstraint checking for the
+ /// presence of a particular attribute on an object.
+ /// </summary>
+public ResolvableConstraintExpression Attribute(Type expectedType)
+ {
+ return Has.Attribute(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a new AttributeConstraint checking for the
+ /// presence of a particular attribute on an object.
+ /// </summary>
+public ResolvableConstraintExpression Attribute<T>()
+ {
+ return Attribute(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region Null
+
+ /// <summary>
+ /// Returns a constraint that tests for null
+ /// </summary>
+public NullConstraint Null
+ {
+ get { return new NullConstraint(); }
+ }
+
+ #endregion
+
+ #region True
+
+ /// <summary>
+ /// Returns a constraint that tests for True
+ /// </summary>
+public TrueConstraint True
+ {
+ get { return new TrueConstraint(); }
+ }
+
+ #endregion
+
+ #region False
+
+ /// <summary>
+ /// Returns a constraint that tests for False
+ /// </summary>
+public FalseConstraint False
+ {
+ get { return new FalseConstraint(); }
+ }
+
+ #endregion
+
+ #region NaN
+
+ /// <summary>
+ /// Returns a constraint that tests for NaN
+ /// </summary>
+public NaNConstraint NaN
+ {
+ get { return new NaNConstraint(); }
+ }
+
+ #endregion
+
+ #region Empty
+
+ /// <summary>
+ /// Returns a constraint that tests for empty
+ /// </summary>
+public EmptyConstraint Empty
+ {
+ get { return new EmptyConstraint(); }
+ }
+
+ #endregion
+
+ #region Unique
+
+ /// <summary>
+ /// Returns a constraint that tests whether a collection
+ /// contains all unique items.
+ /// </summary>
+public UniqueItemsConstraint Unique
+ {
+ get { return new UniqueItemsConstraint(); }
+ }
+
+ #endregion
+
+ #region BinarySerializable
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that tests whether an object graph is serializable in binary format.
+ /// </summary>
+public BinarySerializableConstraint BinarySerializable
+ {
+ get { return new BinarySerializableConstraint(); }
+ }
+#endif
+
+ #endregion
+
+ #region XmlSerializable
+
+#if !NETCF_1_0
+ /// <summary>
+ /// Returns a constraint that tests whether an object graph is serializable in xml format.
+ /// </summary>
+public XmlSerializableConstraint XmlSerializable
+ {
+ get { return new XmlSerializableConstraint(); }
+ }
+#endif
+
+ #endregion
+
+ #region EqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests two items for equality
+ /// </summary>
+public EqualConstraint EqualTo(object expected)
+ {
+ return new EqualConstraint(expected);
+ }
+
+ #endregion
+
+ #region SameAs
+
+ /// <summary>
+ /// Returns a constraint that tests that two references are the same object
+ /// </summary>
+public SameAsConstraint SameAs(object expected)
+ {
+ return new SameAsConstraint(expected);
+ }
+
+ #endregion
+
+ #region GreaterThan
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than the suppled argument
+ /// </summary>
+public GreaterThanConstraint GreaterThan(object expected)
+ {
+ return new GreaterThanConstraint(expected);
+ }
+
+ #endregion
+
+ #region GreaterThanOrEqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+public GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
+ {
+ return new GreaterThanOrEqualConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+public GreaterThanOrEqualConstraint AtLeast(object expected)
+ {
+ return new GreaterThanOrEqualConstraint(expected);
+ }
+
+ #endregion
+
+ #region LessThan
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than the suppled argument
+ /// </summary>
+public LessThanConstraint LessThan(object expected)
+ {
+ return new LessThanConstraint(expected);
+ }
+
+ #endregion
+
+ #region LessThanOrEqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+public LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
+ {
+ return new LessThanOrEqualConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+public LessThanOrEqualConstraint AtMost(object expected)
+ {
+ return new LessThanOrEqualConstraint(expected);
+ }
+
+ #endregion
+
+ #region TypeOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+public ExactTypeConstraint TypeOf(Type expectedType)
+ {
+ return new ExactTypeConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+public ExactTypeConstraint TypeOf<T>()
+ {
+ return new ExactTypeConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region InstanceOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+public InstanceOfTypeConstraint InstanceOf(Type expectedType)
+ {
+ return new InstanceOfTypeConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+public InstanceOfTypeConstraint InstanceOf<T>()
+ {
+ return new InstanceOfTypeConstraint(typeof(T));
+ }
+#endif
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+ [Obsolete("Use InstanceOf(expectedType)")]
+public InstanceOfTypeConstraint InstanceOfType(Type expectedType)
+ {
+ return new InstanceOfTypeConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+ [Obsolete("Use InstanceOf<T>()")]
+public InstanceOfTypeConstraint InstanceOfType<T>()
+ {
+ return new InstanceOfTypeConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region AssignableFrom
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableFromConstraint AssignableFrom(Type expectedType)
+ {
+ return new AssignableFromConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableFromConstraint AssignableFrom<T>()
+ {
+ return new AssignableFromConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region AssignableTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableToConstraint AssignableTo(Type expectedType)
+ {
+ return new AssignableToConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public AssignableToConstraint AssignableTo<T>()
+ {
+ return new AssignableToConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region EquivalentTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is a collection containing the same elements as the
+ /// collection supplied as an argument.
+ /// </summary>
+public CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
+ {
+ return new CollectionEquivalentConstraint(expected);
+ }
+
+ #endregion
+
+ #region SubsetOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is a subset of the collection supplied as an argument.
+ /// </summary>
+public CollectionSubsetConstraint SubsetOf(IEnumerable expected)
+ {
+ return new CollectionSubsetConstraint(expected);
+ }
+
+ #endregion
+
+ #region Ordered
+
+ /// <summary>
+ /// Returns a constraint that tests whether a collection is ordered
+ /// </summary>
+public CollectionOrderedConstraint Ordered
+ {
+ get { return new CollectionOrderedConstraint(); }
+ }
+
+ #endregion
+
+ #region Member
+
+ /// <summary>
+ /// Returns a new CollectionContainsConstraint checking for the
+ /// presence of a particular object in the collection.
+ /// </summary>
+public CollectionContainsConstraint Member(object expected)
+ {
+ return new CollectionContainsConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a new CollectionContainsConstraint checking for the
+ /// presence of a particular object in the collection.
+ /// </summary>
+public CollectionContainsConstraint Contains(object expected)
+ {
+ return new CollectionContainsConstraint(expected);
+ }
+
+ #endregion
+
+ #region Contains
+
+ /// <summary>
+ /// Returns a new ContainsConstraint. This constraint
+ /// will, in turn, make use of the appropriate second-level
+ /// constraint, depending on the type of the actual argument.
+ /// This overload is only used if the item sought is a string,
+ /// since any other type implies that we are looking for a
+ /// collection member.
+ /// </summary>
+public ContainsConstraint Contains(string expected)
+ {
+ return new ContainsConstraint(expected);
+ }
+
+ #endregion
+
+ #region StringContaining
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+public SubstringConstraint StringContaining(string expected)
+ {
+ return new SubstringConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+public SubstringConstraint ContainsSubstring(string expected)
+ {
+ return new SubstringConstraint(expected);
+ }
+
+ #endregion
+
+ #region DoesNotContain
+
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+public SubstringConstraint DoesNotContain(string expected)
+ {
+ return new ConstraintExpression().Not.ContainsSubstring(expected);
+ }
+
+ #endregion
+
+ #region StartsWith
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public StartsWithConstraint StartsWith(string expected)
+ {
+ return new StartsWithConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public StartsWithConstraint StringStarting(string expected)
+ {
+ return new StartsWithConstraint(expected);
+ }
+
+ #endregion
+
+ #region DoesNotStartWith
+
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public StartsWithConstraint DoesNotStartWith(string expected)
+ {
+ return new ConstraintExpression().Not.StartsWith(expected);
+ }
+
+ #endregion
+
+ #region EndsWith
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public EndsWithConstraint EndsWith(string expected)
+ {
+ return new EndsWithConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public EndsWithConstraint StringEnding(string expected)
+ {
+ return new EndsWithConstraint(expected);
+ }
+
+ #endregion
+
+ #region DoesNotEndWith
+
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public EndsWithConstraint DoesNotEndWith(string expected)
+ {
+ return new ConstraintExpression().Not.EndsWith(expected);
+ }
+
+ #endregion
+
+ #region Matches
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value matches the regular expression supplied as an argument.
+ /// </summary>
+public RegexConstraint Matches(string pattern)
+ {
+ return new RegexConstraint(pattern);
+ }
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value matches the regular expression supplied as an argument.
+ /// </summary>
+public RegexConstraint StringMatching(string pattern)
+ {
+ return new RegexConstraint(pattern);
+ }
+#endif
+
+ #endregion
+
+ #region DoesNotMatch
+
+#if !NUNITLITE
+ /// <summary>
+ /// Returns a constraint that fails if the actual
+ /// value matches the pattern supplied as an argument.
+ /// </summary>
+public RegexConstraint DoesNotMatch(string pattern)
+ {
+ return new ConstraintExpression().Not.Matches(pattern);
+ }
+#endif
+
+ #endregion
+
+ #region SamePath
+
+ /// <summary>
+ /// Returns a constraint that tests whether the path provided
+ /// is the same as an expected path after canonicalization.
+ /// </summary>
+public SamePathConstraint SamePath(string expected)
+ {
+ return new SamePathConstraint(expected);
+ }
+
+ #endregion
+
+ #region SamePathOrUnder
+
+ /// <summary>
+ /// Returns a constraint that tests whether the path provided
+ /// is the same path or under an expected path after canonicalization.
+ /// </summary>
+public SamePathOrUnderConstraint SamePathOrUnder(string expected)
+ {
+ return new SamePathOrUnderConstraint(expected);
+ }
+
+ #endregion
+
+ #region InRange
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value falls
+ /// within a specified range.
+ /// </summary>
+public RangeConstraint InRange(IComparable from, IComparable to)
+ {
+ return new RangeConstraint(from, to);
+ }
+
+ #endregion
+
+ }
+}
=== modified file 'src/framework/Shared/Framework/Constraints/PathConstraints.cs'
--- src/framework/Shared/Framework/Constraints/PathConstraints.cs 2009-09-06 20:54:07 +0000
+++ src/framework/Shared/Framework/Constraints/PathConstraints.cs 2009-09-27 21:25:19 +0000
@@ -33,7 +33,9 @@
/// that operate on paths and provides several helper methods.
/// </summary>
public abstract class PathConstraint : Constraint
- {
+ {
+ private static readonly char[] DirectorySeparatorChars = new char[] { '\\', '/' };
+
/// <summary>
/// The expected path used in the constraint
/// </summary>
@@ -87,8 +89,7 @@
/// <returns>The path in standardized form</returns>
protected string Canonicalize( string path )
{
- ArrayList parts = new ArrayList(
- path.Split( Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar ) );
+ ArrayList parts = new ArrayList( path.Split( DirectorySeparatorChars ) );
for( int index = 0; index < parts.Count; )
{
=== modified file 'src/framework/Shared/Framework/Has.cs'
--- src/framework/Shared/Framework/Has.cs 2009-09-22 01:07:21 +0000
+++ src/framework/Shared/Framework/Has.cs 2009-09-27 21:25:19 +0000
@@ -1,205 +1,205 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-using NUnit.Framework.Constraints;
-
-namespace NUnit.Framework
-{
- /// <summary>
- /// Helper class with properties and methods that supply
- /// a number of constraints used in Asserts.
- /// </summary>
- public class Has
- {
- #region No
-
- /// <summary>
- /// Returns a ConstraintExpression that negates any
- /// following constraint.
- /// </summary>
- public static ConstraintExpression No
- {
- get { return new ConstraintExpression().Not; }
- }
-
- #endregion
-
- #region All
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them succeed.
- /// </summary>
- public static ConstraintExpression All
- {
- get { return new ConstraintExpression().All; }
- }
-
- #endregion
-
- #region Some
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if at least one of them succeeds.
- /// </summary>
- public static ConstraintExpression Some
- {
- get { return new ConstraintExpression().Some; }
- }
-
- #endregion
-
- #region None
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them fail.
- /// </summary>
- public static ConstraintExpression None
- {
- get { return new ConstraintExpression().None; }
- }
-
- #endregion
-
- #region Property
-
- /// <summary>
- /// Returns a new PropertyConstraintExpression, which will either
- /// test for the existence of the named property on the object
- /// being tested or apply any following constraint to that property.
- /// </summary>
- public static ResolvableConstraintExpression Property(string name)
- {
- return new ConstraintExpression().Property(name);
- }
-
- #endregion
-
- #region Length
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Length property of the object being tested.
- /// </summary>
- public static ResolvableConstraintExpression Length
- {
- get { return Property("Length"); }
- }
-
- #endregion
-
- #region Count
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Count property of the object being tested.
- /// </summary>
- public static ResolvableConstraintExpression Count
- {
- get { return Property("Count"); }
- }
-
- #endregion
-
- #region Message
-
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the Message property of the object being tested.
- /// </summary>
- public static ResolvableConstraintExpression Message
- {
- get { return Property("Message"); }
- }
-
- #endregion
-
- #region InnerException
-
-#if !NUNITLITE
- /// <summary>
- /// Returns a new ConstraintExpression, which will apply the following
- /// constraint to the InnerException property of the object being tested.
- /// </summary>
- public static ResolvableConstraintExpression InnerException
- {
- get { return Property("InnerException"); }
- }
-#endif
-
- #endregion
-
- #region Attribute
-
- /// <summary>
- /// Returns a new AttributeConstraint checking for the
- /// presence of a particular attribute on an object.
- /// </summary>
- public static ResolvableConstraintExpression Attribute(Type expectedType)
- {
- return new ConstraintExpression().Attribute(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a new AttributeConstraint checking for the
- /// presence of a particular attribute on an object.
- /// </summary>
- public static ResolvableConstraintExpression Attribute<T>()
- {
- return Attribute(typeof(T));
- }
-#endif
-
- #endregion
-
- #region Member
-
- /// <summary>
- /// Returns a new CollectionContainsConstraint checking for the
- /// presence of a particular object in the collection.
- /// </summary>
- public static CollectionContainsConstraint Member(object expected)
- {
- return new CollectionContainsConstraint(expected);
- }
-
- #endregion
-
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Helper class with properties and methods that supply
+ /// a number of constraints used in Asserts.
+ /// </summary>
+ public class Has
+ {
+ #region No
+
+ /// <summary>
+ /// Returns a ConstraintExpression that negates any
+ /// following constraint.
+ /// </summary>
+public static ConstraintExpression No
+ {
+ get { return new ConstraintExpression().Not; }
+ }
+
+ #endregion
+
+ #region All
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+public static ConstraintExpression All
+ {
+ get { return new ConstraintExpression().All; }
+ }
+
+ #endregion
+
+ #region Some
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if at least one of them succeeds.
+ /// </summary>
+public static ConstraintExpression Some
+ {
+ get { return new ConstraintExpression().Some; }
+ }
+
+ #endregion
+
+ #region None
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them fail.
+ /// </summary>
+public static ConstraintExpression None
+ {
+ get { return new ConstraintExpression().None; }
+ }
+
+ #endregion
+
+ #region Property
+
+ /// <summary>
+ /// Returns a new PropertyConstraintExpression, which will either
+ /// test for the existence of the named property on the object
+ /// being tested or apply any following constraint to that property.
+ /// </summary>
+public static ResolvableConstraintExpression Property(string name)
+ {
+ return new ConstraintExpression().Property(name);
+ }
+
+ #endregion
+
+ #region Length
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Length property of the object being tested.
+ /// </summary>
+public static ResolvableConstraintExpression Length
+ {
+ get { return Property("Length"); }
+ }
+
+ #endregion
+
+ #region Count
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Count property of the object being tested.
+ /// </summary>
+public static ResolvableConstraintExpression Count
+ {
+ get { return Property("Count"); }
+ }
+
+ #endregion
+
+ #region Message
+
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the Message property of the object being tested.
+ /// </summary>
+public static ResolvableConstraintExpression Message
+ {
+ get { return Property("Message"); }
+ }
+
+ #endregion
+
+ #region InnerException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Returns a new ConstraintExpression, which will apply the following
+ /// constraint to the InnerException property of the object being tested.
+ /// </summary>
+public static ResolvableConstraintExpression InnerException
+ {
+ get { return Property("InnerException"); }
+ }
+#endif
+
+ #endregion
+
+ #region Attribute
+
+ /// <summary>
+ /// Returns a new AttributeConstraint checking for the
+ /// presence of a particular attribute on an object.
+ /// </summary>
+public static ResolvableConstraintExpression Attribute(Type expectedType)
+ {
+ return new ConstraintExpression().Attribute(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a new AttributeConstraint checking for the
+ /// presence of a particular attribute on an object.
+ /// </summary>
+public static ResolvableConstraintExpression Attribute<T>()
+ {
+ return Attribute(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region Member
+
+ /// <summary>
+ /// Returns a new CollectionContainsConstraint checking for the
+ /// presence of a particular object in the collection.
+ /// </summary>
+public static CollectionContainsConstraint Member(object expected)
+ {
+ return new CollectionContainsConstraint(expected);
+ }
+
+ #endregion
+
+ }
+}
=== modified file 'src/framework/Shared/Framework/Is.cs'
--- src/framework/Shared/Framework/Is.cs 2009-09-22 01:07:21 +0000
+++ src/framework/Shared/Framework/Is.cs 2009-09-27 21:25:19 +0000
@@ -1,517 +1,517 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-using NUnit.Framework.Constraints;
-
-namespace NUnit.Framework
-{
- /// <summary>
- /// Helper class with properties and methods that supply
- /// a number of constraints used in Asserts.
- /// </summary>
- public class Is
- {
- #region Not
-
- /// <summary>
- /// Returns a ConstraintExpression that negates any
- /// following constraint.
- /// </summary>
- public static ConstraintExpression Not
- {
- get { return new ConstraintExpression().Not; }
- }
-
- #endregion
-
- #region All
-
- /// <summary>
- /// Returns a ConstraintExpression, which will apply
- /// the following constraint to all members of a collection,
- /// succeeding if all of them succeed.
- /// </summary>
- public static ConstraintExpression All
- {
- get { return new ConstraintExpression().All; }
- }
-
- #endregion
-
- #region Null
-
- /// <summary>
- /// Returns a constraint that tests for null
- /// </summary>
- public static NullConstraint Null
- {
- get { return new NullConstraint(); }
- }
-
- #endregion
-
- #region True
-
- /// <summary>
- /// Returns a constraint that tests for True
- /// </summary>
- public static TrueConstraint True
- {
- get { return new TrueConstraint(); }
- }
-
- #endregion
-
- #region False
-
- /// <summary>
- /// Returns a constraint that tests for False
- /// </summary>
- public static FalseConstraint False
- {
- get { return new FalseConstraint(); }
- }
-
- #endregion
-
- #region NaN
-
- /// <summary>
- /// Returns a constraint that tests for NaN
- /// </summary>
- public static NaNConstraint NaN
- {
- get { return new NaNConstraint(); }
- }
-
- #endregion
-
- #region Empty
-
- /// <summary>
- /// Returns a constraint that tests for empty
- /// </summary>
- public static EmptyConstraint Empty
- {
- get { return new EmptyConstraint(); }
- }
-
- #endregion
-
- #region Unique
-
- /// <summary>
- /// Returns a constraint that tests whether a collection
- /// contains all unique items.
- /// </summary>
- public static UniqueItemsConstraint Unique
- {
- get { return new UniqueItemsConstraint(); }
- }
-
- #endregion
-
- #region BinarySerializable
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that tests whether an object graph is serializable in binary format.
- /// </summary>
- public static BinarySerializableConstraint BinarySerializable
- {
- get { return new BinarySerializableConstraint(); }
- }
-#endif
-
- #endregion
-
- #region XmlSerializable
-
-#if !NETCF_1_0
- /// <summary>
- /// Returns a constraint that tests whether an object graph is serializable in xml format.
- /// </summary>
- public static XmlSerializableConstraint XmlSerializable
- {
- get { return new XmlSerializableConstraint(); }
- }
-#endif
-
- #endregion
-
- #region EqualTo
-
- /// <summary>
- /// Returns a constraint that tests two items for equality
- /// </summary>
- public static EqualConstraint EqualTo(object expected)
- {
- return new EqualConstraint(expected);
- }
-
- #endregion
-
- #region SameAs
-
- /// <summary>
- /// Returns a constraint that tests that two references are the same object
- /// </summary>
- public static SameAsConstraint SameAs(object expected)
- {
- return new SameAsConstraint(expected);
- }
-
- #endregion
-
- #region GreaterThan
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than the suppled argument
- /// </summary>
- public static GreaterThanConstraint GreaterThan(object expected)
- {
- return new GreaterThanConstraint(expected);
- }
-
- #endregion
-
- #region GreaterThanOrEqualTo
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than or equal to the suppled argument
- /// </summary>
- public static GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
- {
- return new GreaterThanOrEqualConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is greater than or equal to the suppled argument
- /// </summary>
- public static GreaterThanOrEqualConstraint AtLeast(object expected)
- {
- return new GreaterThanOrEqualConstraint(expected);
- }
-
- #endregion
-
- #region LessThan
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than the suppled argument
- /// </summary>
- public static LessThanConstraint LessThan(object expected)
- {
- return new LessThanConstraint(expected);
- }
-
- #endregion
-
- #region LessThanOrEqualTo
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than or equal to the suppled argument
- /// </summary>
- public static LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
- {
- return new LessThanOrEqualConstraint(expected);
- }
-
- /// <summary>
- /// Returns a constraint that tests whether the
- /// actual value is less than or equal to the suppled argument
- /// </summary>
- public static LessThanOrEqualConstraint AtMost(object expected)
- {
- return new LessThanOrEqualConstraint(expected);
- }
-
- #endregion
-
- #region TypeOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual
- /// value is of the exact type supplied as an argument.
- /// </summary>
- public static ExactTypeConstraint TypeOf(Type expectedType)
- {
- return new ExactTypeConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual
- /// value is of the exact type supplied as an argument.
- /// </summary>
- public static ExactTypeConstraint TypeOf<T>()
- {
- return new ExactTypeConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region InstanceOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
- {
- return new InstanceOfTypeConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- public static InstanceOfTypeConstraint InstanceOf<T>()
- {
- return new InstanceOfTypeConstraint(typeof(T));
- }
-#endif
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- [Obsolete("Use InstanceOf(expectedType)")]
- public static InstanceOfTypeConstraint InstanceOfType(Type expectedType)
- {
- return new InstanceOfTypeConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is of the type supplied as an argument or a derived type.
- /// </summary>
- [Obsolete("Use InstanceOf<T>()")]
- public static InstanceOfTypeConstraint InstanceOfType<T>()
- {
- return new InstanceOfTypeConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region AssignableFrom
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public static AssignableFromConstraint AssignableFrom(Type expectedType)
- {
- return new AssignableFromConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public static AssignableFromConstraint AssignableFrom<T>()
- {
- return new AssignableFromConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region AssignableTo
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public static AssignableToConstraint AssignableTo(Type expectedType)
- {
- return new AssignableToConstraint(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is assignable from the type supplied as an argument.
- /// </summary>
- public static AssignableToConstraint AssignableTo<T>()
- {
- return new AssignableToConstraint(typeof(T));
- }
-#endif
-
- #endregion
-
- #region EquivalentTo
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is a collection containing the same elements as the
- /// collection supplied as an argument.
- /// </summary>
- public static CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
- {
- return new CollectionEquivalentConstraint(expected);
- }
-
- #endregion
-
- #region SubsetOf
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value
- /// is a subset of the collection supplied as an argument.
- /// </summary>
- public static CollectionSubsetConstraint SubsetOf(IEnumerable expected)
- {
- return new CollectionSubsetConstraint(expected);
- }
-
- #endregion
-
- #region Ordered
-
- /// <summary>
- /// Returns a constraint that tests whether a collection is ordered
- /// </summary>
- public static CollectionOrderedConstraint Ordered
- {
- get { return new CollectionOrderedConstraint(); }
- }
-
- #endregion
-
- #region StringContaining
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value contains the substring supplied as an argument.
- /// </summary>
- public static SubstringConstraint StringContaining(string expected)
- {
- return new SubstringConstraint(expected);
- }
-
- #endregion
-
- #region StringStarting
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value starts with the substring supplied as an argument.
- /// </summary>
- public static StartsWithConstraint StringStarting(string expected)
- {
- return new StartsWithConstraint(expected);
- }
-
- #endregion
-
- #region StringEnding
-
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value ends with the substring supplied as an argument.
- /// </summary>
- public static EndsWithConstraint StringEnding(string expected)
- {
- return new EndsWithConstraint(expected);
- }
-
- #endregion
-
- #region StringMatching
-
-#if !NETCF
- /// <summary>
- /// Returns a constraint that succeeds if the actual
- /// value matches the regular expression supplied as an argument.
- /// </summary>
- public static RegexConstraint StringMatching(string pattern)
- {
- return new RegexConstraint(pattern);
- }
-#endif
-
- #endregion
-
- #region SamePath
-
- /// <summary>
- /// Returns a constraint that tests whether the path provided
- /// is the same as an expected path after canonicalization.
- /// </summary>
- public static SamePathConstraint SamePath(string expected)
- {
- return new SamePathConstraint(expected);
- }
-
- #endregion
-
- #region SamePathOrUnder
-
- /// <summary>
- /// Returns a constraint that tests whether the path provided
- /// is the same path or under an expected path after canonicalization.
- /// </summary>
- public static SamePathOrUnderConstraint SamePathOrUnder(string expected)
- {
- return new SamePathOrUnderConstraint(expected);
- }
-
- #endregion
-
- #region InRange
-
- /// <summary>
- /// Returns a constraint that tests whether the actual value falls
- /// within a specified range.
- /// </summary>
- public static RangeConstraint InRange(IComparable from, IComparable to)
- {
- return new RangeConstraint(from, to);
- }
-
- #endregion
-
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Helper class with properties and methods that supply
+ /// a number of constraints used in Asserts.
+ /// </summary>
+ public class Is
+ {
+ #region Not
+
+ /// <summary>
+ /// Returns a ConstraintExpression that negates any
+ /// following constraint.
+ /// </summary>
+public static ConstraintExpression Not
+ {
+ get { return new ConstraintExpression().Not; }
+ }
+
+ #endregion
+
+ #region All
+
+ /// <summary>
+ /// Returns a ConstraintExpression, which will apply
+ /// the following constraint to all members of a collection,
+ /// succeeding if all of them succeed.
+ /// </summary>
+public static ConstraintExpression All
+ {
+ get { return new ConstraintExpression().All; }
+ }
+
+ #endregion
+
+ #region Null
+
+ /// <summary>
+ /// Returns a constraint that tests for null
+ /// </summary>
+public static NullConstraint Null
+ {
+ get { return new NullConstraint(); }
+ }
+
+ #endregion
+
+ #region True
+
+ /// <summary>
+ /// Returns a constraint that tests for True
+ /// </summary>
+public static TrueConstraint True
+ {
+ get { return new TrueConstraint(); }
+ }
+
+ #endregion
+
+ #region False
+
+ /// <summary>
+ /// Returns a constraint that tests for False
+ /// </summary>
+public static FalseConstraint False
+ {
+ get { return new FalseConstraint(); }
+ }
+
+ #endregion
+
+ #region NaN
+
+ /// <summary>
+ /// Returns a constraint that tests for NaN
+ /// </summary>
+public static NaNConstraint NaN
+ {
+ get { return new NaNConstraint(); }
+ }
+
+ #endregion
+
+ #region Empty
+
+ /// <summary>
+ /// Returns a constraint that tests for empty
+ /// </summary>
+public static EmptyConstraint Empty
+ {
+ get { return new EmptyConstraint(); }
+ }
+
+ #endregion
+
+ #region Unique
+
+ /// <summary>
+ /// Returns a constraint that tests whether a collection
+ /// contains all unique items.
+ /// </summary>
+public static UniqueItemsConstraint Unique
+ {
+ get { return new UniqueItemsConstraint(); }
+ }
+
+ #endregion
+
+ #region BinarySerializable
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that tests whether an object graph is serializable in binary format.
+ /// </summary>
+public static BinarySerializableConstraint BinarySerializable
+ {
+ get { return new BinarySerializableConstraint(); }
+ }
+#endif
+
+ #endregion
+
+ #region XmlSerializable
+
+#if !NETCF_1_0
+ /// <summary>
+ /// Returns a constraint that tests whether an object graph is serializable in xml format.
+ /// </summary>
+public static XmlSerializableConstraint XmlSerializable
+ {
+ get { return new XmlSerializableConstraint(); }
+ }
+#endif
+
+ #endregion
+
+ #region EqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests two items for equality
+ /// </summary>
+public static EqualConstraint EqualTo(object expected)
+ {
+ return new EqualConstraint(expected);
+ }
+
+ #endregion
+
+ #region SameAs
+
+ /// <summary>
+ /// Returns a constraint that tests that two references are the same object
+ /// </summary>
+public static SameAsConstraint SameAs(object expected)
+ {
+ return new SameAsConstraint(expected);
+ }
+
+ #endregion
+
+ #region GreaterThan
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than the suppled argument
+ /// </summary>
+public static GreaterThanConstraint GreaterThan(object expected)
+ {
+ return new GreaterThanConstraint(expected);
+ }
+
+ #endregion
+
+ #region GreaterThanOrEqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+public static GreaterThanOrEqualConstraint GreaterThanOrEqualTo(object expected)
+ {
+ return new GreaterThanOrEqualConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is greater than or equal to the suppled argument
+ /// </summary>
+public static GreaterThanOrEqualConstraint AtLeast(object expected)
+ {
+ return new GreaterThanOrEqualConstraint(expected);
+ }
+
+ #endregion
+
+ #region LessThan
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than the suppled argument
+ /// </summary>
+public static LessThanConstraint LessThan(object expected)
+ {
+ return new LessThanConstraint(expected);
+ }
+
+ #endregion
+
+ #region LessThanOrEqualTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+public static LessThanOrEqualConstraint LessThanOrEqualTo(object expected)
+ {
+ return new LessThanOrEqualConstraint(expected);
+ }
+
+ /// <summary>
+ /// Returns a constraint that tests whether the
+ /// actual value is less than or equal to the suppled argument
+ /// </summary>
+public static LessThanOrEqualConstraint AtMost(object expected)
+ {
+ return new LessThanOrEqualConstraint(expected);
+ }
+
+ #endregion
+
+ #region TypeOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+public static ExactTypeConstraint TypeOf(Type expectedType)
+ {
+ return new ExactTypeConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual
+ /// value is of the exact type supplied as an argument.
+ /// </summary>
+public static ExactTypeConstraint TypeOf<T>()
+ {
+ return new ExactTypeConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region InstanceOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
+ {
+ return new InstanceOfTypeConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+public static InstanceOfTypeConstraint InstanceOf<T>()
+ {
+ return new InstanceOfTypeConstraint(typeof(T));
+ }
+#endif
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+ [Obsolete("Use InstanceOf(expectedType)")]
+public static InstanceOfTypeConstraint InstanceOfType(Type expectedType)
+ {
+ return new InstanceOfTypeConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is of the type supplied as an argument or a derived type.
+ /// </summary>
+ [Obsolete("Use InstanceOf<T>()")]
+public static InstanceOfTypeConstraint InstanceOfType<T>()
+ {
+ return new InstanceOfTypeConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region AssignableFrom
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public static AssignableFromConstraint AssignableFrom(Type expectedType)
+ {
+ return new AssignableFromConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public static AssignableFromConstraint AssignableFrom<T>()
+ {
+ return new AssignableFromConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region AssignableTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public static AssignableToConstraint AssignableTo(Type expectedType)
+ {
+ return new AssignableToConstraint(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is assignable from the type supplied as an argument.
+ /// </summary>
+public static AssignableToConstraint AssignableTo<T>()
+ {
+ return new AssignableToConstraint(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region EquivalentTo
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is a collection containing the same elements as the
+ /// collection supplied as an argument.
+ /// </summary>
+public static CollectionEquivalentConstraint EquivalentTo(IEnumerable expected)
+ {
+ return new CollectionEquivalentConstraint(expected);
+ }
+
+ #endregion
+
+ #region SubsetOf
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value
+ /// is a subset of the collection supplied as an argument.
+ /// </summary>
+public static CollectionSubsetConstraint SubsetOf(IEnumerable expected)
+ {
+ return new CollectionSubsetConstraint(expected);
+ }
+
+ #endregion
+
+ #region Ordered
+
+ /// <summary>
+ /// Returns a constraint that tests whether a collection is ordered
+ /// </summary>
+public static CollectionOrderedConstraint Ordered
+ {
+ get { return new CollectionOrderedConstraint(); }
+ }
+
+ #endregion
+
+ #region StringContaining
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value contains the substring supplied as an argument.
+ /// </summary>
+public static SubstringConstraint StringContaining(string expected)
+ {
+ return new SubstringConstraint(expected);
+ }
+
+ #endregion
+
+ #region StringStarting
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value starts with the substring supplied as an argument.
+ /// </summary>
+public static StartsWithConstraint StringStarting(string expected)
+ {
+ return new StartsWithConstraint(expected);
+ }
+
+ #endregion
+
+ #region StringEnding
+
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value ends with the substring supplied as an argument.
+ /// </summary>
+public static EndsWithConstraint StringEnding(string expected)
+ {
+ return new EndsWithConstraint(expected);
+ }
+
+ #endregion
+
+ #region StringMatching
+
+#if !NETCF
+ /// <summary>
+ /// Returns a constraint that succeeds if the actual
+ /// value matches the regular expression supplied as an argument.
+ /// </summary>
+public static RegexConstraint StringMatching(string pattern)
+ {
+ return new RegexConstraint(pattern);
+ }
+#endif
+
+ #endregion
+
+ #region SamePath
+
+ /// <summary>
+ /// Returns a constraint that tests whether the path provided
+ /// is the same as an expected path after canonicalization.
+ /// </summary>
+public static SamePathConstraint SamePath(string expected)
+ {
+ return new SamePathConstraint(expected);
+ }
+
+ #endregion
+
+ #region SamePathOrUnder
+
+ /// <summary>
+ /// Returns a constraint that tests whether the path provided
+ /// is the same path or under an expected path after canonicalization.
+ /// </summary>
+public static SamePathOrUnderConstraint SamePathOrUnder(string expected)
+ {
+ return new SamePathOrUnderConstraint(expected);
+ }
+
+ #endregion
+
+ #region InRange
+
+ /// <summary>
+ /// Returns a constraint that tests whether the actual value falls
+ /// within a specified range.
+ /// </summary>
+public static RangeConstraint InRange(IComparable from, IComparable to)
+ {
+ return new RangeConstraint(from, to);
+ }
+
+ #endregion
+
+ }
+}
=== modified file 'src/framework/Shared/Framework/Throws.cs'
--- src/framework/Shared/Framework/Throws.cs 2009-09-22 01:07:21 +0000
+++ src/framework/Shared/Framework/Throws.cs 2009-09-27 21:25:19 +0000
@@ -1,169 +1,169 @@
-// ***********************************************************************
-// Copyright (c) 2009 Charlie Poole
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-// ***********************************************************************
-
-// ****************************************************************
-// Generated by the NUnit Syntax Generator
-//
-// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
-//
-// DO NOT MODIFY THIS FILE DIRECTLY
-// ****************************************************************
-
-using System;
-using System.Collections;
-using NUnit.Framework.Constraints;
-
-namespace NUnit.Framework
-{
- /// <summary>
- /// Helper class with properties and methods that supply
- /// constraints that operate on exceptions.
- /// </summary>
- public class Throws
- {
- #region Exception
-
- /// <summary>
- /// Creates a constraint specifying an expected exception
- /// </summary>
- public static ResolvableConstraintExpression Exception
- {
- get { return new ConstraintExpression().Append(new ThrowsOperator()); }
- }
-
- #endregion
-
- #region InnerException
-
-#if !NUNITLITE
- /// <summary>
- /// Creates a constraint specifying an exception with a given InnerException
- /// </summary>
- public static ResolvableConstraintExpression InnerException
- {
- get { return Exception.InnerException; }
- }
-#endif
-
- #endregion
-
- #region TargetInvocationException
-
-#if !NUNITLITE
- /// <summary>
- /// Creates a constraint specifying an expected TargetInvocationException
- /// </summary>
- public static ExactTypeConstraint TargetInvocationException
- {
- get { return TypeOf(typeof(System.Reflection.TargetInvocationException)); }
- }
-#endif
-
- #endregion
-
- #region ArgumentException
-
-#if !NUNITLITE
- /// <summary>
- /// Creates a constraint specifying an expected TargetInvocationException
- /// </summary>
- public static ExactTypeConstraint ArgumentException
- {
- get { return TypeOf(typeof(System.ArgumentException)); }
- }
-#endif
-
- #endregion
-
- #region InvalidOperationException
-
-#if !NUNITLITE
- /// <summary>
- /// Creates a constraint specifying an expected TargetInvocationException
- /// </summary>
- public static ExactTypeConstraint InvalidOperationException
- {
- get { return TypeOf(typeof(System.InvalidOperationException)); }
- }
-#endif
-
- #endregion
-
- #region Nothing
-
- /// <summary>
- /// Creates a constraint specifying that no exception is thrown
- /// </summary>
- public static ThrowsNothingConstraint Nothing
- {
- get { return new ThrowsNothingConstraint(); }
- }
-
- #endregion
-
- #region TypeOf
-
- /// <summary>
- /// Creates a constraint specifying the exact type of exception expected
- /// </summary>
- public static ExactTypeConstraint TypeOf(Type expectedType)
- {
- return Exception.TypeOf(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Creates a constraint specifying the exact type of exception expected
- /// </summary>
- public static ExactTypeConstraint TypeOf<T>()
- {
- return TypeOf(typeof(T));
- }
-#endif
-
- #endregion
-
- #region InstanceOf
-
- /// <summary>
- /// Creates a constraint specifying the type of exception expected
- /// </summary>
- public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
- {
- return Exception.InstanceOf(expectedType);
- }
-
-#if CLR_2_0
- /// <summary>
- /// Creates a constraint specifying the type of exception expected
- /// </summary>
- public static InstanceOfTypeConstraint InstanceOf<T>()
- {
- return InstanceOf(typeof(T));
- }
-#endif
-
- #endregion
-
- }
-}
+// ***********************************************************************
+// Copyright (c) 2009 Charlie Poole
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ***********************************************************************
+
+// ****************************************************************
+// Generated by the NUnit Syntax Generator
+//
+// Command Line: GenSyntax.exe -syntax:SyntaxElements.txt Shared/Framework/Is.cs Shared/Framework/Has.cs NUnit/Framework/Text.cs Shared/Framework/Throws.cs Shared/Framework/Constraints/ConstraintFactory.cs Shared/Framework/Constraints/ConstraintExpression.cs Shared/Framework/Assert.cs
+//
+// DO NOT MODIFY THIS FILE DIRECTLY
+// ****************************************************************
+
+using System;
+using System.Collections;
+using NUnit.Framework.Constraints;
+
+namespace NUnit.Framework
+{
+ /// <summary>
+ /// Helper class with properties and methods that supply
+ /// constraints that operate on exceptions.
+ /// </summary>
+ public class Throws
+ {
+ #region Exception
+
+ /// <summary>
+ /// Creates a constraint specifying an expected exception
+ /// </summary>
+public static ResolvableConstraintExpression Exception
+ {
+ get { return new ConstraintExpression().Append(new ThrowsOperator()); }
+ }
+
+ #endregion
+
+ #region InnerException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Creates a constraint specifying an exception with a given InnerException
+ /// </summary>
+public static ResolvableConstraintExpression InnerException
+ {
+ get { return Exception.InnerException; }
+ }
+#endif
+
+ #endregion
+
+ #region TargetInvocationException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Creates a constraint specifying an expected TargetInvocationException
+ /// </summary>
+public static ExactTypeConstraint TargetInvocationException
+ {
+ get { return TypeOf(typeof(System.Reflection.TargetInvocationException)); }
+ }
+#endif
+
+ #endregion
+
+ #region ArgumentException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Creates a constraint specifying an expected TargetInvocationException
+ /// </summary>
+public static ExactTypeConstraint ArgumentException
+ {
+ get { return TypeOf(typeof(System.ArgumentException)); }
+ }
+#endif
+
+ #endregion
+
+ #region InvalidOperationException
+
+#if !NUNITLITE
+ /// <summary>
+ /// Creates a constraint specifying an expected TargetInvocationException
+ /// </summary>
+public static ExactTypeConstraint InvalidOperationException
+ {
+ get { return TypeOf(typeof(System.InvalidOperationException)); }
+ }
+#endif
+
+ #endregion
+
+ #region Nothing
+
+ /// <summary>
+ /// Creates a constraint specifying that no exception is thrown
+ /// </summary>
+public static ThrowsNothingConstraint Nothing
+ {
+ get { return new ThrowsNothingConstraint(); }
+ }
+
+ #endregion
+
+ #region TypeOf
+
+ /// <summary>
+ /// Creates a constraint specifying the exact type of exception expected
+ /// </summary>
+public static ExactTypeConstraint TypeOf(Type expectedType)
+ {
+ return Exception.TypeOf(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Creates a constraint specifying the exact type of exception expected
+ /// </summary>
+public static ExactTypeConstraint TypeOf<T>()
+ {
+ return TypeOf(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ #region InstanceOf
+
+ /// <summary>
+ /// Creates a constraint specifying the type of exception expected
+ /// </summary>
+public static InstanceOfTypeConstraint InstanceOf(Type expectedType)
+ {
+ return Exception.InstanceOf(expectedType);
+ }
+
+#if CLR_2_0
+ /// <summary>
+ /// Creates a constraint specifying the type of exception expected
+ /// </summary>
+public static InstanceOfTypeConstraint InstanceOf<T>()
+ {
+ return InstanceOf(typeof(T));
+ }
+#endif
+
+ #endregion
+
+ }
+}
=== modified file 'src/tests/NUnit/Framework/RangeTests.cs'
--- src/tests/NUnit/Framework/RangeTests.cs 2009-09-07 17:36:10 +0000
+++ src/tests/NUnit/Framework/RangeTests.cs 2009-09-27 21:25:19 +0000
@@ -41,14 +41,13 @@
[Test]
public void InRangeFails()
{
- string expectedMessage =
-@" Expected: in range (5,10)
- But was: 12
-";
+ string expectedMessage = string.Format(" Expected: in range (5,10){0} But was: 12{0}",
+ Environment.NewLine);
+
Assert.That(
new TestDelegate( FailingInRangeMethod ),
Throws.TypeOf(typeof(AssertionException)).With.Message.EqualTo(expectedMessage));
- }
+ }
private void FailingInRangeMethod()
{
@@ -65,10 +64,9 @@
[Test]
public void NotInRangeFails()
{
- string expectedMessage =
-@" Expected: not in range (5,10)
- But was: 7
-";
+ string expectedMessage = string.Format(" Expected: not in range (5,10){0} But was: 7{0}",
+ Environment.NewLine);
+
Assert.That(
new TestDelegate(FailingNotInRangeMethod),
Throws.TypeOf(typeof(AssertionException)).With.Message.EqualTo(expectedMessage));
Follow ups