PageRenderTime 299ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/src/NUnit.Silverlight.Framework/Assert.cs

https://bitbucket.org/jesperll/nunit-silverlight
C# | 3789 lines | 1384 code | 384 blank | 2021 comment | 30 complexity | 1ff03d0813cd4880e65ee6333c1ea8ed MD5 | raw file
  1. // ****************************************************************
  2. // Copyright 2009, Charlie Poole
  3. // This is free software licensed under the NUnit license. You may
  4. // obtain a copy of the license at http://nunit.org
  5. // ****************************************************************
  6. // ****************************************************************
  7. // Generated by the NUnit Syntax Generator
  8. //
  9. // Command Line: GenSyntax.exe SyntaxElements.txt
  10. //
  11. // DO NOT MODIFY THIS FILE DIRECTLY
  12. // ****************************************************************
  13. using System;
  14. using System.Collections;
  15. using System.ComponentModel;
  16. using NUnit.Framework.Constraints;
  17. namespace NUnit.Framework
  18. {
  19. /// <summary>
  20. /// Delegate used by tests that execute code and
  21. /// capture any thrown exception.
  22. /// </summary>
  23. public delegate void TestDelegate();
  24. /// <summary>
  25. /// The Assert class contains a collection of static methods that
  26. /// implement the most common assertions used in NUnit.
  27. /// </summary>
  28. public class Assert
  29. {
  30. #region Constructor
  31. /// <summary>
  32. /// We don't actually want any instances of this object, but some people
  33. /// like to inherit from it to add other static methods. Hence, the
  34. /// protected constructor disallows any instances of this object.
  35. /// </summary>
  36. protected Assert() { }
  37. #endregion
  38. #region Assert Counting
  39. private static int counter = 0;
  40. /// <summary>
  41. /// Gets the number of assertions executed so far and
  42. /// resets the counter to zero.
  43. /// </summary>
  44. public static int Counter
  45. {
  46. get
  47. {
  48. int cnt = counter;
  49. counter = 0;
  50. return cnt;
  51. }
  52. }
  53. private static void IncrementAssertCount()
  54. {
  55. ++counter;
  56. }
  57. #endregion
  58. #region Equals and ReferenceEquals
  59. /// <summary>
  60. /// The Equals method throws an AssertionException. This is done
  61. /// to make sure there is no mistake by calling this function.
  62. /// </summary>
  63. /// <param name="a"></param>
  64. /// <param name="b"></param>
  65. [EditorBrowsable(EditorBrowsableState.Never)]
  66. public static new bool Equals(object a, object b)
  67. {
  68. // TODO: This should probably be InvalidOperationException
  69. throw new AssertionException("Assert.Equals should not be used for Assertions");
  70. }
  71. /// <summary>
  72. /// override the default ReferenceEquals to throw an AssertionException. This
  73. /// implementation makes sure there is no mistake in calling this function
  74. /// as part of Assert.
  75. /// </summary>
  76. /// <param name="a"></param>
  77. /// <param name="b"></param>
  78. public static new void ReferenceEquals(object a, object b)
  79. {
  80. throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
  81. }
  82. #endregion
  83. #region Helper Methods
  84. /// <summary>
  85. /// Helper for Assert.AreEqual(double expected, double actual, ...)
  86. /// allowing code generation to work consistently.
  87. /// </summary>
  88. /// <param name="expected">The expected value</param>
  89. /// <param name="actual">The actual value</param>
  90. /// <param name="delta">The maximum acceptable difference between the
  91. /// the expected and the actual</param>
  92. /// <param name="message">The message to display in case of failure</param>
  93. /// <param name="args">Array of objects to be used in formatting the message</param>
  94. protected static void AssertDoublesAreEqual(double expected, double actual, double delta, string message, object[] args)
  95. {
  96. if (double.IsNaN(expected) || double.IsInfinity(expected))
  97. Assert.That(actual, Is.EqualTo(expected), message, args);
  98. else
  99. Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
  100. }
  101. #endregion
  102. #region Utility Asserts
  103. #region Pass
  104. /// <summary>
  105. /// Throws a <see cref="SuccessException"/> with the message and arguments
  106. /// that are passed in. This allows a test to be cut short, with a result
  107. /// of success returned to NUnit.
  108. /// </summary>
  109. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  110. /// <param name="args">Arguments to be used in formatting the message</param>
  111. static public void Pass(string message, params object[] args)
  112. {
  113. if (message == null) message = string.Empty;
  114. else if (args != null && args.Length > 0)
  115. message = string.Format(message, args);
  116. throw new SuccessException(message);
  117. }
  118. /// <summary>
  119. /// Throws a <see cref="SuccessException"/> with the message and arguments
  120. /// that are passed in. This allows a test to be cut short, with a result
  121. /// of success returned to NUnit.
  122. /// </summary>
  123. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  124. static public void Pass(string message)
  125. {
  126. Assert.Pass(message, null);
  127. }
  128. /// <summary>
  129. /// Throws a <see cref="SuccessException"/> with the message and arguments
  130. /// that are passed in. This allows a test to be cut short, with a result
  131. /// of success returned to NUnit.
  132. /// </summary>
  133. static public void Pass()
  134. {
  135. Assert.Pass(string.Empty, null);
  136. }
  137. #endregion
  138. #region Fail
  139. /// <summary>
  140. /// Throws an <see cref="AssertionException"/> with the message and arguments
  141. /// that are passed in. This is used by the other Assert functions.
  142. /// </summary>
  143. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  144. /// <param name="args">Arguments to be used in formatting the message</param>
  145. static public void Fail(string message, params object[] args)
  146. {
  147. if (message == null) message = string.Empty;
  148. else if (args != null && args.Length > 0)
  149. message = string.Format(message, args);
  150. throw new AssertionException(message);
  151. }
  152. /// <summary>
  153. /// Throws an <see cref="AssertionException"/> with the message that is
  154. /// passed in. This is used by the other Assert functions.
  155. /// </summary>
  156. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  157. static public void Fail(string message)
  158. {
  159. Assert.Fail(message, null);
  160. }
  161. /// <summary>
  162. /// Throws an <see cref="AssertionException"/>.
  163. /// This is used by the other Assert functions.
  164. /// </summary>
  165. static public void Fail()
  166. {
  167. Assert.Fail(string.Empty, null);
  168. }
  169. #endregion
  170. #region Ignore
  171. /// <summary>
  172. /// Throws an <see cref="IgnoreException"/> with the message and arguments
  173. /// that are passed in. This causes the test to be reported as ignored.
  174. /// </summary>
  175. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  176. /// <param name="args">Arguments to be used in formatting the message</param>
  177. static public void Ignore(string message, params object[] args)
  178. {
  179. if (message == null) message = string.Empty;
  180. else if (args != null && args.Length > 0)
  181. message = string.Format(message, args);
  182. throw new IgnoreException(message);
  183. }
  184. /// <summary>
  185. /// Throws an <see cref="IgnoreException"/> with the message that is
  186. /// passed in. This causes the test to be reported as ignored.
  187. /// </summary>
  188. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  189. static public void Ignore(string message)
  190. {
  191. Assert.Ignore(message, null);
  192. }
  193. /// <summary>
  194. /// Throws an <see cref="IgnoreException"/>.
  195. /// This causes the test to be reported as ignored.
  196. /// </summary>
  197. static public void Ignore()
  198. {
  199. Assert.Ignore(string.Empty, null);
  200. }
  201. #endregion
  202. #region InConclusive
  203. /// <summary>
  204. /// Throws an <see cref="InconclusiveException"/> with the message and arguments
  205. /// that are passed in. This causes the test to be reported as inconclusive.
  206. /// </summary>
  207. /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param>
  208. /// <param name="args">Arguments to be used in formatting the message</param>
  209. static public void Inconclusive(string message, params object[] args)
  210. {
  211. if (message == null) message = string.Empty;
  212. else if (args != null && args.Length > 0)
  213. message = string.Format(message, args);
  214. throw new InconclusiveException(message);
  215. }
  216. /// <summary>
  217. /// Throws an <see cref="InconclusiveException"/> with the message that is
  218. /// passed in. This causes the test to be reported as inconclusive.
  219. /// </summary>
  220. /// <param name="message">The message to initialize the <see cref="InconclusiveException"/> with.</param>
  221. static public void Inconclusive(string message)
  222. {
  223. Assert.Inconclusive(message, null);
  224. }
  225. /// <summary>
  226. /// Throws an <see cref="InconclusiveException"/>.
  227. /// This causes the test to be reported as Inconclusive.
  228. /// </summary>
  229. static public void Inconclusive()
  230. {
  231. Assert.Inconclusive(string.Empty, null);
  232. }
  233. #endregion
  234. #endregion
  235. #region Assert.That
  236. #region Object
  237. /// <summary>
  238. /// Apply a constraint to an actual value, succeeding if the constraint
  239. /// is satisfied and throwing an assertion exception on failure.
  240. /// </summary>
  241. /// <param name="expression">A Constraint to be applied</param>
  242. /// <param name="actual">The actual value to test</param>
  243. static public void That(object actual, IResolveConstraint expression)
  244. {
  245. Assert.That(actual, expression, null, null);
  246. }
  247. /// <summary>
  248. /// Apply a constraint to an actual value, succeeding if the constraint
  249. /// is satisfied and throwing an assertion exception on failure.
  250. /// </summary>
  251. /// <param name="expression">A Constraint to be applied</param>
  252. /// <param name="actual">The actual value to test</param>
  253. /// <param name="message">The message that will be displayed on failure</param>
  254. static public void That(object actual, IResolveConstraint expression, string message)
  255. {
  256. Assert.That(actual, expression, message, null);
  257. }
  258. /// <summary>
  259. /// Apply a constraint to an actual value, succeeding if the constraint
  260. /// is satisfied and throwing an assertion exception on failure.
  261. /// </summary>
  262. /// <param name="expression">A Constraint expression to be applied</param>
  263. /// <param name="actual">The actual value to test</param>
  264. /// <param name="message">The message that will be displayed on failure</param>
  265. /// <param name="args">Arguments to be used in formatting the message</param>
  266. static public void That(object actual, IResolveConstraint expression, string message, params object[] args)
  267. {
  268. Constraint constraint = expression.Resolve();
  269. Assert.IncrementAssertCount();
  270. if (!constraint.Matches(actual))
  271. {
  272. MessageWriter writer = new TextMessageWriter(message, args);
  273. constraint.WriteMessageTo(writer);
  274. throw new AssertionException(writer.ToString());
  275. }
  276. }
  277. #endregion
  278. #region ActualValueDelegate
  279. /// <summary>
  280. /// Apply a constraint to an actual value, succeeding if the constraint
  281. /// is satisfied and throwing an assertion exception on failure.
  282. /// </summary>
  283. /// <param name="expr">A Constraint expression to be applied</param>
  284. /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
  285. static public void That(ActualValueDelegate del, IResolveConstraint expr)
  286. {
  287. Assert.That(del, expr.Resolve(), null, null);
  288. }
  289. /// <summary>
  290. /// Apply a constraint to an actual value, succeeding if the constraint
  291. /// is satisfied and throwing an assertion exception on failure.
  292. /// </summary>
  293. /// <param name="expr">A Constraint expression to be applied</param>
  294. /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
  295. /// <param name="message">The message that will be displayed on failure</param>
  296. static public void That(ActualValueDelegate del, IResolveConstraint expr, string message)
  297. {
  298. Assert.That(del, expr.Resolve(), message, null);
  299. }
  300. /// <summary>
  301. /// Apply a constraint to an actual value, succeeding if the constraint
  302. /// is satisfied and throwing an assertion exception on failure.
  303. /// </summary>
  304. /// <param name="del">An ActualValueDelegate returning the value to be tested</param>
  305. /// <param name="expr">A Constraint expression to be applied</param>
  306. /// <param name="message">The message that will be displayed on failure</param>
  307. /// <param name="args">Arguments to be used in formatting the message</param>
  308. static public void That(ActualValueDelegate del, IResolveConstraint expr, string message, params object[] args)
  309. {
  310. Constraint constraint = expr.Resolve();
  311. Assert.IncrementAssertCount();
  312. if (!constraint.Matches(del))
  313. {
  314. MessageWriter writer = new TextMessageWriter(message, args);
  315. constraint.WriteMessageTo(writer);
  316. throw new AssertionException(writer.ToString());
  317. }
  318. }
  319. #endregion
  320. #region ref Object
  321. #if NET_2_0
  322. /// <summary>
  323. /// Apply a constraint to a referenced value, succeeding if the constraint
  324. /// is satisfied and throwing an assertion exception on failure.
  325. /// </summary>
  326. /// <param name="expression">A Constraint to be applied</param>
  327. /// <param name="actual">The actual value to test</param>
  328. static public void That<T>(ref T actual, IResolveConstraint expression)
  329. {
  330. Assert.That(ref actual, expression.Resolve(), null, null);
  331. }
  332. /// <summary>
  333. /// Apply a constraint to a referenced value, succeeding if the constraint
  334. /// is satisfied and throwing an assertion exception on failure.
  335. /// </summary>
  336. /// <param name="expression">A Constraint to be applied</param>
  337. /// <param name="actual">The actual value to test</param>
  338. /// <param name="message">The message that will be displayed on failure</param>
  339. static public void That<T>(ref T actual, IResolveConstraint expression, string message)
  340. {
  341. Assert.That(ref actual, expression.Resolve(), message, null);
  342. }
  343. /// <summary>
  344. /// Apply a constraint to a referenced value, succeeding if the constraint
  345. /// is satisfied and throwing an assertion exception on failure.
  346. /// </summary>
  347. /// <param name="expression">A Constraint to be applied</param>
  348. /// <param name="actual">The actual value to test</param>
  349. /// <param name="message">The message that will be displayed on failure</param>
  350. /// <param name="args">Arguments to be used in formatting the message</param>
  351. static public void That<T>(ref T actual, IResolveConstraint expression, string message, params object[] args)
  352. {
  353. Constraint constraint = expression.Resolve();
  354. Assert.IncrementAssertCount();
  355. if (!constraint.Matches(ref actual))
  356. {
  357. MessageWriter writer = new TextMessageWriter(message, args);
  358. constraint.WriteMessageTo(writer);
  359. throw new AssertionException(writer.ToString());
  360. }
  361. }
  362. #else
  363. /// <summary>
  364. /// Apply a constraint to a referenced boolean, succeeding if the constraint
  365. /// is satisfied and throwing an assertion exception on failure.
  366. /// </summary>
  367. /// <param name="constraint">A Constraint to be applied</param>
  368. /// <param name="actual">The actual value to test</param>
  369. static public void That(ref bool actual, IResolveConstraint constraint)
  370. {
  371. Assert.That(ref actual, constraint.Resolve(), null, null);
  372. }
  373. /// <summary>
  374. /// Apply a constraint to a referenced value, succeeding if the constraint
  375. /// is satisfied and throwing an assertion exception on failure.
  376. /// </summary>
  377. /// <param name="constraint">A Constraint to be applied</param>
  378. /// <param name="actual">The actual value to test</param>
  379. /// <param name="message">The message that will be displayed on failure</param>
  380. static public void That(ref bool actual, IResolveConstraint constraint, string message)
  381. {
  382. Assert.That(ref actual, constraint.Resolve(), message, null);
  383. }
  384. /// <summary>
  385. /// Apply a constraint to a referenced value, succeeding if the constraint
  386. /// is satisfied and throwing an assertion exception on failure.
  387. /// </summary>
  388. /// <param name="constraint">A Constraint to be applied</param>
  389. /// <param name="actual">The actual value to test</param>
  390. /// <param name="message">The message that will be displayed on failure</param>
  391. /// <param name="args">Arguments to be used in formatting the message</param>
  392. static public void That(ref bool actual, IResolveConstraint expression, string message, params object[] args)
  393. {
  394. Constraint constraint = expression.Resolve();
  395. Assert.IncrementAssertCount();
  396. if (!constraint.Matches(ref actual))
  397. {
  398. MessageWriter writer = new TextMessageWriter(message, args);
  399. constraint.WriteMessageTo(writer);
  400. throw new AssertionException(writer.ToString());
  401. }
  402. }
  403. #endif
  404. #endregion
  405. #region Boolean
  406. /// <summary>
  407. /// Asserts that a condition is true. If the condition is false the method throws
  408. /// an <see cref="AssertionException"/>.
  409. /// </summary>
  410. /// <param name="condition">The evaluated condition</param>
  411. /// <param name="message">The message to display if the condition is false</param>
  412. /// <param name="args">Arguments to be used in formatting the message</param>
  413. static public void That(bool condition, string message, params object[] args)
  414. {
  415. Assert.That(condition, Is.True, message, args);
  416. }
  417. /// <summary>
  418. /// Asserts that a condition is true. If the condition is false the method throws
  419. /// an <see cref="AssertionException"/>.
  420. /// </summary>
  421. /// <param name="condition">The evaluated condition</param>
  422. /// <param name="message">The message to display if the condition is false</param>
  423. static public void That(bool condition, string message)
  424. {
  425. Assert.That(condition, Is.True, message, null);
  426. }
  427. /// <summary>
  428. /// Asserts that a condition is true. If the condition is false the method throws
  429. /// an <see cref="AssertionException"/>.
  430. /// </summary>
  431. /// <param name="condition">The evaluated condition</param>
  432. static public void That(bool condition)
  433. {
  434. Assert.That(condition, Is.True, null, null);
  435. }
  436. #endregion
  437. /// <summary>
  438. /// Asserts that the code represented by a delegate throws an exception
  439. /// that satisfies the constraint provided.
  440. /// </summary>
  441. /// <param name="code">A TestDelegate to be executed</param>
  442. /// <param name="constraint">A ThrowsConstraint used in the test</param>
  443. static public void That(TestDelegate code, IResolveConstraint constraint)
  444. {
  445. Assert.That((object)code, constraint);
  446. }
  447. #endregion
  448. #region Throws, Catch and DoesNotThrow
  449. #region Throws
  450. /// <summary>
  451. /// Verifies that a delegate throws a particular exception when called.
  452. /// </summary>
  453. /// <param name="expression">A constraint to be satisfied by the exception</param>
  454. /// <param name="code">A TestSnippet delegate</param>
  455. /// <param name="message">The message that will be displayed on failure</param>
  456. /// <param name="args">Arguments to be used in formatting the message</param>
  457. public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message, params object[] args)
  458. {
  459. Exception caughtException = null;
  460. try
  461. {
  462. code();
  463. }
  464. catch (Exception ex)
  465. {
  466. caughtException = ex;
  467. }
  468. Assert.That(caughtException, expression, message, args);
  469. return caughtException;
  470. }
  471. /// <summary>
  472. /// Verifies that a delegate throws a particular exception when called.
  473. /// </summary>
  474. /// <param name="expression">A constraint to be satisfied by the exception</param>
  475. /// <param name="code">A TestSnippet delegate</param>
  476. /// <param name="message">The message that will be displayed on failure</param>
  477. public static Exception Throws(IResolveConstraint expression, TestDelegate code, string message)
  478. {
  479. return Throws(expression, code, message, null);
  480. }
  481. /// <summary>
  482. /// Verifies that a delegate throws a particular exception when called.
  483. /// </summary>
  484. /// <param name="expression">A constraint to be satisfied by the exception</param>
  485. /// <param name="code">A TestSnippet delegate</param>
  486. public static Exception Throws(IResolveConstraint expression, TestDelegate code)
  487. {
  488. return Throws(expression, code, string.Empty, null);
  489. }
  490. /// <summary>
  491. /// Verifies that a delegate throws a particular exception when called.
  492. /// </summary>
  493. /// <param name="expectedExceptionType">The exception Type expected</param>
  494. /// <param name="code">A TestSnippet delegate</param>
  495. /// <param name="message">The message that will be displayed on failure</param>
  496. /// <param name="args">Arguments to be used in formatting the message</param>
  497. public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
  498. {
  499. return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, args);
  500. }
  501. /// <summary>
  502. /// Verifies that a delegate throws a particular exception when called.
  503. /// </summary>
  504. /// <param name="expectedExceptionType">The exception Type expected</param>
  505. /// <param name="code">A TestSnippet delegate</param>
  506. /// <param name="message">The message that will be displayed on failure</param>
  507. public static Exception Throws(Type expectedExceptionType, TestDelegate code, string message)
  508. {
  509. return Throws(new ExactTypeConstraint(expectedExceptionType), code, message, null);
  510. }
  511. /// <summary>
  512. /// Verifies that a delegate throws a particular exception when called.
  513. /// </summary>
  514. /// <param name="expectedExceptionType">The exception Type expected</param>
  515. /// <param name="code">A TestSnippet delegate</param>
  516. public static Exception Throws(Type expectedExceptionType, TestDelegate code)
  517. {
  518. return Throws(new ExactTypeConstraint(expectedExceptionType), code, string.Empty, null);
  519. }
  520. #endregion
  521. #region Throws<T>
  522. #if NET_2_0
  523. /// <summary>
  524. /// Verifies that a delegate throws a particular exception when called.
  525. /// </summary>
  526. /// <typeparam name="T">Type of the expected exception</typeparam>
  527. /// <param name="code">A TestSnippet delegate</param>
  528. /// <param name="message">The message that will be displayed on failure</param>
  529. /// <param name="args">Arguments to be used in formatting the message</param>
  530. public static T Throws<T>(TestDelegate code, string message, params object[] args) where T : Exception
  531. {
  532. return (T)Throws(typeof(T), code, message, args);
  533. }
  534. /// <summary>
  535. /// Verifies that a delegate throws a particular exception when called.
  536. /// </summary>
  537. /// <typeparam name="T">Type of the expected exception</typeparam>
  538. /// <param name="code">A TestSnippet delegate</param>
  539. /// <param name="message">The message that will be displayed on failure</param>
  540. public static T Throws<T>(TestDelegate code, string message) where T : Exception
  541. {
  542. return Throws<T>(code, message, null);
  543. }
  544. /// <summary>
  545. /// Verifies that a delegate throws a particular exception when called.
  546. /// </summary>
  547. /// <typeparam name="T">Type of the expected exception</typeparam>
  548. /// <param name="code">A TestSnippet delegate</param>
  549. public static T Throws<T>(TestDelegate code) where T : Exception
  550. {
  551. return Throws<T>(code, string.Empty, null);
  552. }
  553. #endif
  554. #endregion
  555. #region Catch
  556. /// <summary>
  557. /// Verifies that a delegate throws an exception when called
  558. /// and returns it.
  559. /// </summary>
  560. /// <param name="code">A TestDelegate</param>
  561. /// <param name="message">The message that will be displayed on failure</param>
  562. /// <param name="args">Arguments to be used in formatting the message</param>
  563. public static Exception Catch(TestDelegate code, string message, params object[] args)
  564. {
  565. return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message, args);
  566. }
  567. /// <summary>
  568. /// Verifies that a delegate throws an exception when called
  569. /// and returns it.
  570. /// </summary>
  571. /// <param name="code">A TestDelegate</param>
  572. /// <param name="message">The message that will be displayed on failure</param>
  573. public static Exception Catch(TestDelegate code, string message)
  574. {
  575. return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code, message);
  576. }
  577. /// <summary>
  578. /// Verifies that a delegate throws an exception when called
  579. /// and returns it.
  580. /// </summary>
  581. /// <param name="code">A TestDelegate</param>
  582. public static Exception Catch(TestDelegate code)
  583. {
  584. return Throws(new InstanceOfTypeConstraint(typeof(Exception)), code);
  585. }
  586. /// <summary>
  587. /// Verifies that a delegate throws an exception of a certain Type
  588. /// or one derived from it when called and returns it.
  589. /// </summary>
  590. /// <param name="expectedExceptionType">The expected Exception Type</param>
  591. /// <param name="code">A TestDelegate</param>
  592. /// <param name="message">The message that will be displayed on failure</param>
  593. /// <param name="args">Arguments to be used in formatting the message</param>
  594. public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message, params object[] args)
  595. {
  596. return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message, args);
  597. }
  598. /// <summary>
  599. /// Verifies that a delegate throws an exception of a certain Type
  600. /// or one derived from it when called and returns it.
  601. /// </summary>
  602. /// <param name="expectedExceptionType">The expected Exception Type</param>
  603. /// <param name="code">A TestDelegate</param>
  604. /// <param name="message">The message that will be displayed on failure</param>
  605. public static Exception Catch(Type expectedExceptionType, TestDelegate code, string message)
  606. {
  607. return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code, message);
  608. }
  609. /// <summary>
  610. /// Verifies that a delegate throws an exception of a certain Type
  611. /// or one derived from it when called and returns it.
  612. /// </summary>
  613. /// <param name="expectedExceptionType">The expected Exception Type</param>
  614. /// <param name="code">A TestDelegate</param>
  615. public static Exception Catch(Type expectedExceptionType, TestDelegate code)
  616. {
  617. return Throws(new InstanceOfTypeConstraint(expectedExceptionType), code);
  618. }
  619. #endregion
  620. #region Catch<T>
  621. #if NET_2_0
  622. /// <summary>
  623. /// Verifies that a delegate throws an exception of a certain Type
  624. /// or one derived from it when called and returns it.
  625. /// </summary>
  626. /// <typeparam name="T">The expected Exception Type</typeparam>
  627. /// <param name="code">A TestDelegate</param>
  628. /// <param name="message">The message that will be displayed on failure</param>
  629. /// <param name="args">Arguments to be used in formatting the message</param>
  630. public static T Catch<T>(TestDelegate code, string message, params object[] args) where T : System.Exception
  631. {
  632. return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message, args);
  633. }
  634. /// <summary>
  635. /// Verifies that a delegate throws an exception of a certain Type
  636. /// or one derived from it when called and returns it.
  637. /// </summary>
  638. /// <typeparam name="T">The expected Exception Type</typeparam>
  639. /// <param name="code">A TestDelegate</param>
  640. /// <param name="message">The message that will be displayed on failure</param>
  641. public static T Catch<T>(TestDelegate code, string message) where T : System.Exception
  642. {
  643. return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code, message);
  644. }
  645. /// <summary>
  646. /// Verifies that a delegate throws an exception of a certain Type
  647. /// or one derived from it when called and returns it.
  648. /// </summary>
  649. /// <typeparam name="T">The expected Exception Type</typeparam>
  650. /// <param name="code">A TestDelegate</param>
  651. public static T Catch<T>(TestDelegate code) where T : System.Exception
  652. {
  653. return (T)Throws(new InstanceOfTypeConstraint(typeof(T)), code);
  654. }
  655. #endif
  656. #endregion
  657. #region DoesNotThrow
  658. /// <summary>
  659. /// Verifies that a delegate does not throw an exception
  660. /// </summary>
  661. /// <param name="code">A TestSnippet delegate</param>
  662. /// <param name="message">The message that will be displayed on failure</param>
  663. /// <param name="args">Arguments to be used in formatting the message</param>
  664. public static void DoesNotThrow(TestDelegate code, string message, params object[] args)
  665. {
  666. try
  667. {
  668. code();
  669. }
  670. catch (Exception ex)
  671. {
  672. TextMessageWriter writer = new TextMessageWriter(message, args);
  673. writer.WriteLine("Unexpected exception: {0}", ex.GetType());
  674. Assert.Fail(writer.ToString());
  675. }
  676. }
  677. /// <summary>
  678. /// Verifies that a delegate does not throw an exception.
  679. /// </summary>
  680. /// <param name="code">A TestSnippet delegate</param>
  681. /// <param name="message">The message that will be displayed on failure</param>
  682. public static void DoesNotThrow(TestDelegate code, string message)
  683. {
  684. DoesNotThrow(code, message, null);
  685. }
  686. /// <summary>
  687. /// Verifies that a delegate does not throw an exception.
  688. /// </summary>
  689. /// <param name="code">A TestSnippet delegate</param>
  690. public static void DoesNotThrow(TestDelegate code)
  691. {
  692. DoesNotThrow(code, string.Empty, null);
  693. }
  694. #endregion
  695. #endregion
  696. #region True
  697. /// <summary>
  698. /// Asserts that a condition is true. If the condition is false the method throws
  699. /// an <see cref="AssertionException"/>.
  700. /// </summary>
  701. /// <param name="condition">The evaluated condition</param>
  702. /// <param name="message">The message to display in case of failure</param>
  703. /// <param name="args">Array of objects to be used in formatting the message</param>
  704. public static void True(bool condition, string message, params object[] args)
  705. {
  706. Assert.That(condition, Is.True, message, args);
  707. }
  708. /// <summary>
  709. /// Asserts that a condition is true. If the condition is false the method throws
  710. /// an <see cref="AssertionException"/>.
  711. /// </summary>
  712. /// <param name="condition">The evaluated condition</param>
  713. /// <param name="message">The message to display in case of failure</param>
  714. public static void True(bool condition, string message)
  715. {
  716. Assert.That(condition, Is.True, message, null);
  717. }
  718. /// <summary>
  719. /// Asserts that a condition is true. If the condition is false the method throws
  720. /// an <see cref="AssertionException"/>.
  721. /// </summary>
  722. /// <param name="condition">The evaluated condition</param>
  723. public static void True(bool condition)
  724. {
  725. Assert.That(condition, Is.True, null, null);
  726. }
  727. /// <summary>
  728. /// Asserts that a condition is true. If the condition is false the method throws
  729. /// an <see cref="AssertionException"/>.
  730. /// </summary>
  731. /// <param name="condition">The evaluated condition</param>
  732. /// <param name="message">The message to display in case of failure</param>
  733. /// <param name="args">Array of objects to be used in formatting the message</param>
  734. public static void IsTrue(bool condition, string message, params object[] args)
  735. {
  736. Assert.That(condition, Is.True, message, args);
  737. }
  738. /// <summary>
  739. /// Asserts that a condition is true. If the condition is false the method throws
  740. /// an <see cref="AssertionException"/>.
  741. /// </summary>
  742. /// <param name="condition">The evaluated condition</param>
  743. /// <param name="message">The message to display in case of failure</param>
  744. public static void IsTrue(bool condition, string message)
  745. {
  746. Assert.That(condition, Is.True, message, null);
  747. }
  748. /// <summary>
  749. /// Asserts that a condition is true. If the condition is false the method throws
  750. /// an <see cref="AssertionException"/>.
  751. /// </summary>
  752. /// <param name="condition">The evaluated condition</param>
  753. public static void IsTrue(bool condition)
  754. {
  755. Assert.That(condition, Is.True, null, null);
  756. }
  757. #endregion
  758. #region False
  759. /// <summary>
  760. /// Asserts that a condition is false. If the condition is true the method throws
  761. /// an <see cref="AssertionException"/>.
  762. /// </summary>
  763. /// <param name="condition">The evaluated condition</param>
  764. /// <param name="message">The message to display in case of failure</param>
  765. /// <param name="args">Array of objects to be used in formatting the message</param>
  766. public static void False(bool condition, string message, params object[] args)
  767. {
  768. Assert.That(condition, Is.False, message, args);
  769. }
  770. /// <summary>
  771. /// Asserts that a condition is false. If the condition is true the method throws
  772. /// an <see cref="AssertionException"/>.
  773. /// </summary>
  774. /// <param name="condition">The evaluated condition</param>
  775. /// <param name="message">The message to display in case of failure</param>
  776. public static void False(bool condition, string message)
  777. {
  778. Assert.That(condition, Is.False, message, null);
  779. }
  780. /// <summary>
  781. /// Asserts that a condition is false. If the condition is true the method throws
  782. /// an <see cref="AssertionException"/>.
  783. /// </summary>
  784. /// <param name="condition">The evaluated condition</param>
  785. public static void False(bool condition)
  786. {
  787. Assert.That(condition, Is.False, null, null);
  788. }
  789. /// <summary>
  790. /// Asserts that a condition is false. If the condition is true the method throws
  791. /// an <see cref="AssertionException"/>.
  792. /// </summary>
  793. /// <param name="condition">The evaluated condition</param>
  794. /// <param name="message">The message to display in case of failure</param>
  795. /// <param name="args">Array of objects to be used in formatting the message</param>
  796. public static void IsFalse(bool condition, string message, params object[] args)
  797. {
  798. Assert.That(condition, Is.False, message, args);
  799. }
  800. /// <summary>
  801. /// Asserts that a condition is false. If the condition is true the method throws
  802. /// an <see cref="AssertionException"/>.
  803. /// </summary>
  804. /// <param name="condition">The evaluated condition</param>
  805. /// <param name="message">The message to display in case of failure</param>
  806. public static void IsFalse(bool condition, string message)
  807. {
  808. Assert.That(condition, Is.False, message, null);
  809. }
  810. /// <summary>
  811. /// Asserts that a condition is false. If the condition is true the method throws
  812. /// an <see cref="AssertionException"/>.
  813. /// </summary>
  814. /// <param name="condition">The evaluated condition</param>
  815. public static void IsFalse(bool condition)
  816. {
  817. Assert.That(condition, Is.False, null, null);
  818. }
  819. #endregion
  820. #region NotNull
  821. /// <summary>
  822. /// Verifies that the object that is passed in is not equal to <code>null</code>
  823. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  824. /// is thrown.
  825. /// </summary>
  826. /// <param name="anObject">The object that is to be tested</param>
  827. /// <param name="message">The message to display in case of failure</param>
  828. /// <param name="args">Array of objects to be used in formatting the message</param>
  829. public static void NotNull(object anObject, string message, params object[] args)
  830. {
  831. Assert.That(anObject, Is.Not.Null, message, args);
  832. }
  833. /// <summary>
  834. /// Verifies that the object that is passed in is not equal to <code>null</code>
  835. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  836. /// is thrown.
  837. /// </summary>
  838. /// <param name="anObject">The object that is to be tested</param>
  839. /// <param name="message">The message to display in case of failure</param>
  840. public static void NotNull(object anObject, string message)
  841. {
  842. Assert.That(anObject, Is.Not.Null, message, null);
  843. }
  844. /// <summary>
  845. /// Verifies that the object that is passed in is not equal to <code>null</code>
  846. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  847. /// is thrown.
  848. /// </summary>
  849. /// <param name="anObject">The object that is to be tested</param>
  850. public static void NotNull(object anObject)
  851. {
  852. Assert.That(anObject, Is.Not.Null, null, null);
  853. }
  854. /// <summary>
  855. /// Verifies that the object that is passed in is not equal to <code>null</code>
  856. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  857. /// is thrown.
  858. /// </summary>
  859. /// <param name="anObject">The object that is to be tested</param>
  860. /// <param name="message">The message to display in case of failure</param>
  861. /// <param name="args">Array of objects to be used in formatting the message</param>
  862. public static void IsNotNull(object anObject, string message, params object[] args)
  863. {
  864. Assert.That(anObject, Is.Not.Null, message, args);
  865. }
  866. /// <summary>
  867. /// Verifies that the object that is passed in is not equal to <code>null</code>
  868. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  869. /// is thrown.
  870. /// </summary>
  871. /// <param name="anObject">The object that is to be tested</param>
  872. /// <param name="message">The message to display in case of failure</param>
  873. public static void IsNotNull(object anObject, string message)
  874. {
  875. Assert.That(anObject, Is.Not.Null, message, null);
  876. }
  877. /// <summary>
  878. /// Verifies that the object that is passed in is not equal to <code>null</code>
  879. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  880. /// is thrown.
  881. /// </summary>
  882. /// <param name="anObject">The object that is to be tested</param>
  883. public static void IsNotNull(object anObject)
  884. {
  885. Assert.That(anObject, Is.Not.Null, null, null);
  886. }
  887. #endregion
  888. #region Null
  889. /// <summary>
  890. /// Verifies that the object that is passed in is equal to <code>null</code>
  891. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  892. /// is thrown.
  893. /// </summary>
  894. /// <param name="anObject">The object that is to be tested</param>
  895. /// <param name="message">The message to display in case of failure</param>
  896. /// <param name="args">Array of objects to be used in formatting the message</param>
  897. public static void Null(object anObject, string message, params object[] args)
  898. {
  899. Assert.That(anObject, Is.Null, message, args);
  900. }
  901. /// <summary>
  902. /// Verifies that the object that is passed in is equal to <code>null</code>
  903. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  904. /// is thrown.
  905. /// </summary>
  906. /// <param name="anObject">The object that is to be tested</param>
  907. /// <param name="message">The message to display in case of failure</param>
  908. public static void Null(object anObject, string message)
  909. {
  910. Assert.That(anObject, Is.Null, message, null);
  911. }
  912. /// <summary>
  913. /// Verifies that the object that is passed in is equal to <code>null</code>
  914. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  915. /// is thrown.
  916. /// </summary>
  917. /// <param name="anObject">The object that is to be tested</param>
  918. public static void Null(object anObject)
  919. {
  920. Assert.That(anObject, Is.Null, null, null);
  921. }
  922. /// <summary>
  923. /// Verifies that the object that is passed in is equal to <code>null</code>
  924. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  925. /// is thrown.
  926. /// </summary>
  927. /// <param name="anObject">The object that is to be tested</param>
  928. /// <param name="message">The message to display in case of failure</param>
  929. /// <param name="args">Array of objects to be used in formatting the message</param>
  930. public static void IsNull(object anObject, string message, params object[] args)
  931. {
  932. Assert.That(anObject, Is.Null, message, args);
  933. }
  934. /// <summary>
  935. /// Verifies that the object that is passed in is equal to <code>null</code>
  936. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  937. /// is thrown.
  938. /// </summary>
  939. /// <param name="anObject">The object that is to be tested</param>
  940. /// <param name="message">The message to display in case of failure</param>
  941. public static void IsNull(object anObject, string message)
  942. {
  943. Assert.That(anObject, Is.Null, message, null);
  944. }
  945. /// <summary>
  946. /// Verifies that the object that is passed in is equal to <code>null</code>
  947. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  948. /// is thrown.
  949. /// </summary>
  950. /// <param name="anObject">The object that is to be tested</param>
  951. public static void IsNull(object anObject)
  952. {
  953. Assert.That(anObject, Is.Null, null, null);
  954. }
  955. #endregion
  956. #region IsNaN
  957. /// <summary>
  958. /// Verifies that the double that is passed in is an <code>NaN</code> value.
  959. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  960. /// is thrown.
  961. /// </summary>
  962. /// <param name="aDouble">The value that is to be tested</param>
  963. /// <param name="message">The message to display in case of failure</param>
  964. /// <param name="args">Array of objects to be used in formatting the message</param>
  965. public static void IsNaN(double aDouble, string message, params object[] args)
  966. {
  967. Assert.That(aDouble, Is.NaN, message, args);
  968. }
  969. /// <summary>
  970. /// Verifies that the double that is passed in is an <code>NaN</code> value.
  971. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  972. /// is thrown.
  973. /// </summary>
  974. /// <param name="aDouble">The value that is to be tested</param>
  975. /// <param name="message">The message to display in case of failure</param>
  976. public static void IsNaN(double aDouble, string message)
  977. {
  978. Assert.That(aDouble, Is.NaN, message, null);
  979. }
  980. /// <summary>
  981. /// Verifies that the double that is passed in is an <code>NaN</code> value.
  982. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  983. /// is thrown.
  984. /// </summary>
  985. /// <param name="aDouble">The value that is to be tested</param>
  986. public static void IsNaN(double aDouble)
  987. {
  988. Assert.That(aDouble, Is.NaN, null, null);
  989. }
  990. #if NET_2_0
  991. /// <summary>
  992. /// Verifies that the double that is passed in is an <code>NaN</code> value.
  993. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  994. /// is thrown.
  995. /// </summary>
  996. /// <param name="aDouble">The value that is to be tested</param>
  997. /// <param name="message">The message to display in case of failure</param>
  998. /// <param name="args">Array of objects to be used in formatting the message</param>
  999. public static void IsNaN(double? aDouble, string message, params object[] args)
  1000. {
  1001. Assert.That(aDouble, Is.NaN, message, args);
  1002. }
  1003. /// <summary>
  1004. /// Verifies that the double that is passed in is an <code>NaN</code> value.
  1005. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  1006. /// is thrown.
  1007. /// </summary>
  1008. /// <param name="aDouble">The value that is to be tested</param>
  1009. /// <param name="message">The message to display in case of failure</param>
  1010. public static void IsNaN(double? aDouble, string message)
  1011. {
  1012. Assert.That(aDouble, Is.NaN, message, null);
  1013. }
  1014. /// <summary>
  1015. /// Verifies that the double that is passed in is an <code>NaN</code> value.
  1016. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  1017. /// is thrown.
  1018. /// </summary>
  1019. /// <param name="aDouble">The value that is to be tested</param>
  1020. public static void IsNaN(double? aDouble)
  1021. {
  1022. Assert.That(aDouble, Is.NaN, null, null);
  1023. }
  1024. #endif
  1025. #endregion
  1026. #region IsEmpty
  1027. /// <summary>
  1028. /// Assert that a string is empty - that is equal to string.Empty
  1029. /// </summary>
  1030. /// <param name="aString">The string to be tested</param>
  1031. /// <param name="message">The message to display in case of failure</param>
  1032. /// <param name="args">Array of objects to be used in formatting the message</param>
  1033. public static void IsEmpty(string aString, string message, params object[] args)
  1034. {
  1035. Assert.That(aString, new EmptyStringConstraint(), message, args);
  1036. }
  1037. /// <summary>
  1038. /// Assert that a string is empty - that is equal to string.Empty
  1039. /// </summary>
  1040. /// <param name="aString">The string to be tested</param>
  1041. /// <param name="message">The message to display in case of failure</param>
  1042. public static void IsEmpty(string aString, string message)
  1043. {
  1044. Assert.That(aString, new EmptyStringConstraint(), message, null);
  1045. }
  1046. /// <summary>
  1047. /// Assert that a string is empty - that is equal to string.Empty
  1048. /// </summary>
  1049. /// <param name="aString">The string to be tested</param>
  1050. public static void IsEmpty(string aString)
  1051. {
  1052. Assert.That(aString, new EmptyStringConstraint(), null, null);
  1053. }
  1054. #endregion
  1055. #region IsEmpty
  1056. /// <summary>
  1057. /// Assert that an array, list or other collection is empty
  1058. /// </summary>
  1059. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  1060. /// <param name="message">The message to display in case of failure</param>
  1061. /// <param name="args">Array of objects to be used in formatting the message</param>
  1062. public static void IsEmpty(ICollection collection, string message, params object[] args)
  1063. {
  1064. Assert.That(collection, new EmptyCollectionConstraint(), message, args);
  1065. }
  1066. /// <summary>
  1067. /// Assert that an array, list or other collection is empty
  1068. /// </summary>
  1069. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  1070. /// <param name="message">The message to display in case of failure</param>
  1071. public static void IsEmpty(ICollection collection, string message)
  1072. {
  1073. Assert.That(collection, new EmptyCollectionConstraint(), message, null);
  1074. }
  1075. /// <summary>
  1076. /// Assert that an array, list or other collection is empty
  1077. /// </summary>
  1078. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  1079. public static void IsEmpty(ICollection collection)
  1080. {
  1081. Assert.That(collection, new EmptyCollectionConstraint(), null, null);
  1082. }
  1083. #endregion
  1084. #region IsNotEmpty
  1085. /// <summary>
  1086. /// Assert that a string is not empty - that is not equal to string.Empty
  1087. /// </summary>
  1088. /// <param name="aString">The string to be tested</param>
  1089. /// <param name="message">The message to display in case of failure</param>
  1090. /// <param name="args">Array of objects to be used in formatting the message</param>
  1091. public static void IsNotEmpty(string aString, string message, params object[] args)
  1092. {
  1093. Assert.That(aString, Is.Not.Empty, message, args);
  1094. }
  1095. /// <summary>
  1096. /// Assert that a string is not empty - that is not equal to string.Empty
  1097. /// </summary>
  1098. /// <param name="aString">The string to be tested</param>
  1099. /// <param name="message">The message to display in case of failure</param>
  1100. public static void IsNotEmpty(string aString, string message)
  1101. {
  1102. Assert.That(aString, Is.Not.Empty, message, null);
  1103. }
  1104. /// <summary>
  1105. /// Assert that a string is not empty - that is not equal to string.Empty
  1106. /// </summary>
  1107. /// <param name="aString">The string to be tested</param>
  1108. public static void IsNotEmpty(string aString)
  1109. {
  1110. Assert.That(aString, Is.Not.Empty, null, null);
  1111. }
  1112. #endregion
  1113. #region IsNotEmpty
  1114. /// <summary>
  1115. /// Assert that an array, list or other collection is not empty
  1116. /// </summary>
  1117. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  1118. /// <param name="message">The message to display in case of failure</param>
  1119. /// <param name="args">Array of objects to be used in formatting the message</param>
  1120. public static void IsNotEmpty(ICollection collection, string message, params object[] args)
  1121. {
  1122. Assert.That(collection, Is.Not.Empty, message, args);
  1123. }
  1124. /// <summary>
  1125. /// Assert that an array, list or other collection is not empty
  1126. /// </summary>
  1127. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  1128. /// <param name="message">The message to display in case of failure</param>
  1129. public static void IsNotEmpty(ICollection collection, string message)
  1130. {
  1131. Assert.That(collection, Is.Not.Empty, message, null);
  1132. }
  1133. /// <summary>
  1134. /// Assert that an array, list or other collection is not empty
  1135. /// </summary>
  1136. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  1137. public static void IsNotEmpty(ICollection collection)
  1138. {
  1139. Assert.That(collection, Is.Not.Empty, null, null);
  1140. }
  1141. #endregion
  1142. #region IsNullOrEmpty
  1143. /// <summary>
  1144. /// Assert that a string is either null or equal to string.Empty
  1145. /// </summary>
  1146. /// <param name="aString">The string to be tested</param>
  1147. /// <param name="message">The message to display in case of failure</param>
  1148. /// <param name="args">Array of objects to be used in formatting the message</param>
  1149. public static void IsNullOrEmpty(string aString, string message, params object[] args)
  1150. {
  1151. Assert.That(aString, new NullOrEmptyStringConstraint(), message, args);
  1152. }
  1153. /// <summary>
  1154. /// Assert that a string is either null or equal to string.Empty
  1155. /// </summary>
  1156. /// <param name="aString">The string to be tested</param>
  1157. /// <param name="message">The message to display in case of failure</param>
  1158. public static void IsNullOrEmpty(string aString, string message)
  1159. {
  1160. Assert.That(aString, new NullOrEmptyStringConstraint(), message, null);
  1161. }
  1162. /// <summary>
  1163. /// Assert that a string is either null or equal to string.Empty
  1164. /// </summary>
  1165. /// <param name="aString">The string to be tested</param>
  1166. public static void IsNullOrEmpty(string aString)
  1167. {
  1168. Assert.That(aString, new NullOrEmptyStringConstraint(), null, null);
  1169. }
  1170. #endregion
  1171. #region IsNotNullOrEmpty
  1172. /// <summary>
  1173. /// Assert that a string is not null or empty
  1174. /// </summary>
  1175. /// <param name="aString">The string to be tested</param>
  1176. /// <param name="message">The message to display in case of failure</param>
  1177. /// <param name="args">Array of objects to be used in formatting the message</param>
  1178. public static void IsNotNullOrEmpty(string aString, string message, params object[] args)
  1179. {
  1180. Assert.That(aString, new NotConstraint(new NullOrEmptyStringConstraint()), message, args);
  1181. }
  1182. /// <summary>
  1183. /// Assert that a string is not null or empty
  1184. /// </summary>
  1185. /// <param name="aString">The string to be tested</param>
  1186. /// <param name="message">The message to display in case of failure</param>
  1187. public static void IsNotNullOrEmpty(string aString, string message)
  1188. {
  1189. Assert.That(aString, new NotConstraint(new NullOrEmptyStringConstraint()), message, null);
  1190. }
  1191. /// <summary>
  1192. /// Assert that a string is not null or empty
  1193. /// </summary>
  1194. /// <param name="aString">The string to be tested</param>
  1195. public static void IsNotNullOrEmpty(string aString)
  1196. {
  1197. Assert.That(aString, new NotConstraint(new NullOrEmptyStringConstraint()), null, null);
  1198. }
  1199. #endregion
  1200. #region IsAssignableFrom
  1201. /// <summary>
  1202. /// Asserts that an object may be assigned a value of a given Type.
  1203. /// </summary>
  1204. /// <param name="expected">The expected Type.</param>
  1205. /// <param name="actual">The object under examination</param>
  1206. /// <param name="message">The message to display in case of failure</param>
  1207. /// <param name="args">Array of objects to be used in formatting the message</param>
  1208. public static void IsAssignableFrom(Type expected, object actual, string message, params object[] args)
  1209. {
  1210. Assert.That(actual, Is.AssignableFrom(expected), message, args);
  1211. }
  1212. /// <summary>
  1213. /// Asserts that an object may be assigned a value of a given Type.
  1214. /// </summary>
  1215. /// <param name="expected">The expected Type.</param>
  1216. /// <param name="actual">The object under examination</param>
  1217. /// <param name="message">The message to display in case of failure</param>
  1218. public static void IsAssignableFrom(Type expected, object actual, string message)
  1219. {
  1220. Assert.That(actual, Is.AssignableFrom(expected), message, null);
  1221. }
  1222. /// <summary>
  1223. /// Asserts that an object may be assigned a value of a given Type.
  1224. /// </summary>
  1225. /// <param name="expected">The expected Type.</param>
  1226. /// <param name="actual">The object under examination</param>
  1227. public static void IsAssignableFrom(Type expected, object actual)
  1228. {
  1229. Assert.That(actual, Is.AssignableFrom(expected), null, null);
  1230. }
  1231. #endregion
  1232. #region IsAssignableFrom<T>
  1233. #if NET_2_0
  1234. /// <summary>
  1235. /// Asserts that an object may be assigned a value of a given Type.
  1236. /// </summary>
  1237. /// <typeparam name="T">The expected Type.</typeparam>
  1238. /// <param name="actual">The object under examination</param>
  1239. /// <param name="message">The message to display in case of failure</param>
  1240. /// <param name="args">Array of objects to be used in formatting the message</param>
  1241. public static void IsAssignableFrom<T>(object actual, string message, params object[] args)
  1242. {
  1243. Assert.That(actual, Is.AssignableFrom(typeof(T)), message, args);
  1244. }
  1245. /// <summary>
  1246. /// Asserts that an object may be assigned a value of a given Type.
  1247. /// </summary>
  1248. /// <typeparam name="T">The expected Type.</typeparam>
  1249. /// <param name="actual">The object under examination</param>
  1250. /// <param name="message">The message to display in case of failure</param>
  1251. public static void IsAssignableFrom<T>(object actual, string message)
  1252. {
  1253. Assert.That(actual, Is.AssignableFrom(typeof(T)), message, null);
  1254. }
  1255. /// <summary>
  1256. /// Asserts that an object may be assigned a value of a given Type.
  1257. /// </summary>
  1258. /// <typeparam name="T">The expected Type.</typeparam>
  1259. /// <param name="actual">The object under examination</param>
  1260. public static void IsAssignableFrom<T>(object actual)
  1261. {
  1262. Assert.That(actual, Is.AssignableFrom(typeof(T)), null, null);
  1263. }
  1264. #endif
  1265. #endregion
  1266. #region IsNotAssignableFrom
  1267. /// <summary>
  1268. /// Asserts that an object may not be assigned a value of a given Type.
  1269. /// </summary>
  1270. /// <param name="expected">The expected Type.</param>
  1271. /// <param name="actual">The object under examination</param>
  1272. /// <param name="message">The message to display in case of failure</param>
  1273. /// <param name="args">Array of objects to be used in formatting the message</param>
  1274. public static void IsNotAssignableFrom(Type expected, object actual, string message, params object[] args)
  1275. {
  1276. Assert.That(actual, Is.Not.AssignableFrom(expected), message, args);
  1277. }
  1278. /// <summary>
  1279. /// Asserts that an object may not be assigned a value of a given Type.
  1280. /// </summary>
  1281. /// <param name="expected">The expected Type.</param>
  1282. /// <param name="actual">The object under examination</param>
  1283. /// <param name="message">The message to display in case of failure</param>
  1284. public static void IsNotAssignableFrom(Type expected, object actual, string message)
  1285. {
  1286. Assert.That(actual, Is.Not.AssignableFrom(expected), message, null);
  1287. }
  1288. /// <summary>
  1289. /// Asserts that an object may not be assigned a value of a given Type.
  1290. /// </summary>
  1291. /// <param name="expected">The expected Type.</param>
  1292. /// <param name="actual">The object under examination</param>
  1293. public static void IsNotAssignableFrom(Type expected, object actual)
  1294. {
  1295. Assert.That(actual, Is.Not.AssignableFrom(expected), null, null);
  1296. }
  1297. #endregion
  1298. #region IsNotAssignableFrom<T>
  1299. #if NET_2_0
  1300. /// <summary>
  1301. /// Asserts that an object may not be assigned a value of a given Type.
  1302. /// </summary>
  1303. /// <typeparam name="T">The expected Type.</typeparam>
  1304. /// <param name="actual">The object under examination</param>
  1305. /// <param name="message">The message to display in case of failure</param>
  1306. /// <param name="args">Array of objects to be used in formatting the message</param>
  1307. public static void IsNotAssignableFrom<T>(object actual, string message, params object[] args)
  1308. {
  1309. Assert.That(actual, Is.Not.AssignableFrom(typeof(T)), message, args);
  1310. }
  1311. /// <summary>
  1312. /// Asserts that an object may not be assigned a value of a given Type.
  1313. /// </summary>
  1314. /// <typeparam name="T">The expected Type.</typeparam>
  1315. /// <param name="actual">The object under examination</param>
  1316. /// <param name="message">The message to display in case of failure</param>
  1317. public static void IsNotAssignableFrom<T>(object actual, string message)
  1318. {
  1319. Assert.That(actual, Is.Not.AssignableFrom(typeof(T)), message, null);
  1320. }
  1321. /// <summary>
  1322. /// Asserts that an object may not be assigned a value of a given Type.
  1323. /// </summary>
  1324. /// <typeparam name="T">The expected Type.</typeparam>
  1325. /// <param name="actual">The object under examination</param>
  1326. public static void IsNotAssignableFrom<T>(object actual)
  1327. {
  1328. Assert.That(actual, Is.Not.AssignableFrom(typeof(T)), null, null);
  1329. }
  1330. #endif
  1331. #endregion
  1332. #region IsInstanceOf
  1333. /// <summary>
  1334. /// Asserts that an object is an instance of a given type.
  1335. /// </summary>
  1336. /// <param name="expected">The expected Type</param>
  1337. /// <param name="actual">The object being examined</param>
  1338. /// <param name="message">The message to display in case of failure</param>
  1339. /// <param name="args">Array of objects to be used in formatting the message</param>
  1340. public static void IsInstanceOf(Type expected, object actual, string message, params object[] args)
  1341. {
  1342. Assert.That(actual, Is.InstanceOf(expected), message, args);
  1343. }
  1344. /// <summary>
  1345. /// Asserts that an object is an instance of a given type.
  1346. /// </summary>
  1347. /// <param name="expected">The expected Type</param>
  1348. /// <param name="actual">The object being examined</param>
  1349. /// <param name="message">The message to display in case of failure</param>
  1350. public static void IsInstanceOf(Type expected, object actual, string message)
  1351. {
  1352. Assert.That(actual, Is.InstanceOf(expected), message, null);
  1353. }
  1354. /// <summary>
  1355. /// Asserts that an object is an instance of a given type.
  1356. /// </summary>
  1357. /// <param name="expected">The expected Type</param>
  1358. /// <param name="actual">The object being examined</param>
  1359. public static void IsInstanceOf(Type expected, object actual)
  1360. {
  1361. Assert.That(actual, Is.InstanceOf(expected), null, null);
  1362. }
  1363. /// <summary>
  1364. /// Asserts that an object is an instance of a given type.
  1365. /// </summary>
  1366. /// <param name="expected">The expected Type</param>
  1367. /// <param name="actual">The object being examined</param>
  1368. /// <param name="message">The message to display in case of failure</param>
  1369. /// <param name="args">Array of objects to be used in formatting the message</param>
  1370. [Obsolete]
  1371. public static void IsInstanceOfType(Type expected, object actual, string message, params object[] args)
  1372. {
  1373. Assert.That(actual, Is.InstanceOf(expected), message, args);
  1374. }
  1375. /// <summary>
  1376. /// Asserts that an object is an instance of a given type.
  1377. /// </summary>
  1378. /// <param name="expected">The expected Type</param>
  1379. /// <param name="actual">The object being examined</param>
  1380. /// <param name="message">The message to display in case of failure</param>
  1381. [Obsolete]
  1382. public static void IsInstanceOfType(Type expected, object actual, string message)
  1383. {
  1384. Assert.That(actual, Is.InstanceOf(expected), message, null);
  1385. }
  1386. /// <summary>
  1387. /// Asserts that an object is an instance of a given type.
  1388. /// </summary>
  1389. /// <param name="expected">The expected Type</param>
  1390. /// <param name="actual">The object being examined</param>
  1391. [Obsolete]
  1392. public static void IsInstanceOfType(Type expected, object actual)
  1393. {
  1394. Assert.That(actual, Is.InstanceOf(expected), null, null);
  1395. }
  1396. #endregion
  1397. #region IsInstanceOf<T>
  1398. #if NET_2_0
  1399. /// <summary>
  1400. /// Asserts that an object is an instance of a given type.
  1401. /// </summary>
  1402. /// <typeparam name="T">The expected Type</typeparam>
  1403. /// <param name="actual">The object being examined</param>
  1404. /// <param name="message">The message to display in case of failure</param>
  1405. /// <param name="args">Array of objects to be used in formatting the message</param>
  1406. public static void IsInstanceOf<T>(object actual, string message, params object[] args)
  1407. {
  1408. Assert.That(actual, Is.InstanceOf(typeof(T)), message, args);
  1409. }
  1410. /// <summary>
  1411. /// Asserts that an object is an instance of a given type.
  1412. /// </summary>
  1413. /// <typeparam name="T">The expected Type</typeparam>
  1414. /// <param name="actual">The object being examined</param>
  1415. /// <param name="message">The message to display in case of failure</param>
  1416. public static void IsInstanceOf<T>(object actual, string message)
  1417. {
  1418. Assert.That(actual, Is.InstanceOf(typeof(T)), message, null);
  1419. }
  1420. /// <summary>
  1421. /// Asserts that an object is an instance of a given type.
  1422. /// </summary>
  1423. /// <typeparam name="T">The expected Type</typeparam>
  1424. /// <param name="actual">The object being examined</param>
  1425. public static void IsInstanceOf<T>(object actual)
  1426. {
  1427. Assert.That(actual, Is.InstanceOf(typeof(T)), null, null);
  1428. }
  1429. #endif
  1430. #endregion
  1431. #region IsNotInstanceOf
  1432. /// <summary>
  1433. /// Asserts that an object is not an instance of a given type.
  1434. /// </summary>
  1435. /// <param name="expected">The expected Type</param>
  1436. /// <param name="actual">The object being examined</param>
  1437. /// <param name="message">The message to display in case of failure</param>
  1438. /// <param name="args">Array of objects to be used in formatting the message</param>
  1439. public static void IsNotInstanceOf(Type expected, object actual, string message, params object[] args)
  1440. {
  1441. Assert.That(actual, Is.Not.InstanceOf(expected), message, args);
  1442. }
  1443. /// <summary>
  1444. /// Asserts that an object is not an instance of a given type.
  1445. /// </summary>
  1446. /// <param name="expected">The expected Type</param>
  1447. /// <param name="actual">The object being examined</param>
  1448. /// <param name="message">The message to display in case of failure</param>
  1449. public static void IsNotInstanceOf(Type expected, object actual, string message)
  1450. {
  1451. Assert.That(actual, Is.Not.InstanceOf(expected), message, null);
  1452. }
  1453. /// <summary>
  1454. /// Asserts that an object is not an instance of a given type.
  1455. /// </summary>
  1456. /// <param name="expected">The expected Type</param>
  1457. /// <param name="actual">The object being examined</param>
  1458. public static void IsNotInstanceOf(Type expected, object actual)
  1459. {
  1460. Assert.That(actual, Is.Not.InstanceOf(expected), null, null);
  1461. }
  1462. /// <summary>
  1463. /// Asserts that an object is not an instance of a given type.
  1464. /// </summary>
  1465. /// <param name="expected">The expected Type</param>
  1466. /// <param name="actual">The object being examined</param>
  1467. /// <param name="message">The message to display in case of failure</param>
  1468. /// <param name="args">Array of objects to be used in formatting the message</param>
  1469. [Obsolete]
  1470. public static void IsNotInstanceOfType(Type expected, object actual, string message, params object[] args)
  1471. {
  1472. Assert.That(actual, Is.Not.InstanceOf(expected), message, args);
  1473. }
  1474. /// <summary>
  1475. /// Asserts that an object is not an instance of a given type.
  1476. /// </summary>
  1477. /// <param name="expected">The expected Type</param>
  1478. /// <param name="actual">The object being examined</param>
  1479. /// <param name="message">The message to display in case of failure</param>
  1480. [Obsolete]
  1481. public static void IsNotInstanceOfType(Type expected, object actual, string message)
  1482. {
  1483. Assert.That(actual, Is.Not.InstanceOf(expected), message, null);
  1484. }
  1485. /// <summary>
  1486. /// Asserts that an object is not an instance of a given type.
  1487. /// </summary>
  1488. /// <param name="expected">The expected Type</param>
  1489. /// <param name="actual">The object being examined</param>
  1490. [Obsolete]
  1491. public static void IsNotInstanceOfType(Type expected, object actual)
  1492. {
  1493. Assert.That(actual, Is.Not.InstanceOf(expected), null, null);
  1494. }
  1495. #endregion
  1496. #region IsNotInstanceOf<T>
  1497. #if NET_2_0
  1498. /// <summary>
  1499. /// Asserts that an object is not an instance of a given type.
  1500. /// </summary>
  1501. /// <typeparam name="T">The expected Type</typeparam>
  1502. /// <param name="actual">The object being examined</param>
  1503. /// <param name="message">The message to display in case of failure</param>
  1504. /// <param name="args">Array of objects to be used in formatting the message</param>
  1505. public static void IsNotInstanceOf<T>(object actual, string message, params object[] args)
  1506. {
  1507. Assert.That(actual, Is.Not.InstanceOf(typeof(T)), message, args);
  1508. }
  1509. /// <summary>
  1510. /// Asserts that an object is not an instance of a given type.
  1511. /// </summary>
  1512. /// <typeparam name="T">The expected Type</typeparam>
  1513. /// <param name="actual">The object being examined</param>
  1514. /// <param name="message">The message to display in case of failure</param>
  1515. public static void IsNotInstanceOf<T>(object actual, string message)
  1516. {
  1517. Assert.That(actual, Is.Not.InstanceOf(typeof(T)), message, null);
  1518. }
  1519. /// <summary>
  1520. /// Asserts that an object is not an instance of a given type.
  1521. /// </summary>
  1522. /// <typeparam name="T">The expected Type</typeparam>
  1523. /// <param name="actual">The object being examined</param>
  1524. public static void IsNotInstanceOf<T>(object actual)
  1525. {
  1526. Assert.That(actual, Is.Not.InstanceOf(typeof(T)), null, null);
  1527. }
  1528. #endif
  1529. #endregion
  1530. #region AreEqual
  1531. /// <summary>
  1532. /// Verifies that two values are equal. If they are not, then an
  1533. /// <see cref="AssertionException"/> is thrown.
  1534. /// </summary>
  1535. /// <param name="expected">The expected value</param>
  1536. /// <param name="actual">The actual value</param>
  1537. /// <param name="message">The message to display in case of failure</param>
  1538. /// <param name="args">Array of objects to be used in formatting the message</param>
  1539. public static void AreEqual(int expected, int actual, string message, params object[] args)
  1540. {
  1541. Assert.That(actual, Is.EqualTo(expected), message, args);
  1542. }
  1543. /// <summary>
  1544. /// Verifies that two values are equal. If they are not, then an
  1545. /// <see cref="AssertionException"/> is thrown.
  1546. /// </summary>
  1547. /// <param name="expected">The expected value</param>
  1548. /// <param name="actual">The actual value</param>
  1549. /// <param name="message">The message to display in case of failure</param>
  1550. public static void AreEqual(int expected, int actual, string message)
  1551. {
  1552. Assert.That(actual, Is.EqualTo(expected), message, null);
  1553. }
  1554. /// <summary>
  1555. /// Verifies that two values are equal. If they are not, then an
  1556. /// <see cref="AssertionException"/> is thrown.
  1557. /// </summary>
  1558. /// <param name="expected">The expected value</param>
  1559. /// <param name="actual">The actual value</param>
  1560. public static void AreEqual(int expected, int actual)
  1561. {
  1562. Assert.That(actual, Is.EqualTo(expected), null, null);
  1563. }
  1564. /// <summary>
  1565. /// Verifies that two values are equal. If they are not, then an
  1566. /// <see cref="AssertionException"/> is thrown.
  1567. /// </summary>
  1568. /// <param name="expected">The expected value</param>
  1569. /// <param name="actual">The actual value</param>
  1570. /// <param name="message">The message to display in case of failure</param>
  1571. /// <param name="args">Array of objects to be used in formatting the message</param>
  1572. public static void AreEqual(long expected, long actual, string message, params object[] args)
  1573. {
  1574. Assert.That(actual, Is.EqualTo(expected), message, args);
  1575. }
  1576. /// <summary>
  1577. /// Verifies that two values are equal. If they are not, then an
  1578. /// <see cref="AssertionException"/> is thrown.
  1579. /// </summary>
  1580. /// <param name="expected">The expected value</param>
  1581. /// <param name="actual">The actual value</param>
  1582. /// <param name="message">The message to display in case of failure</param>
  1583. public static void AreEqual(long expected, long actual, string message)
  1584. {
  1585. Assert.That(actual, Is.EqualTo(expected), message, null);
  1586. }
  1587. /// <summary>
  1588. /// Verifies that two values are equal. If they are not, then an
  1589. /// <see cref="AssertionException"/> is thrown.
  1590. /// </summary>
  1591. /// <param name="expected">The expected value</param>
  1592. /// <param name="actual">The actual value</param>
  1593. public static void AreEqual(long expected, long actual)
  1594. {
  1595. Assert.That(actual, Is.EqualTo(expected), null, null);
  1596. }
  1597. /// <summary>
  1598. /// Verifies that two values are equal. If they are not, then an
  1599. /// <see cref="AssertionException"/> is thrown.
  1600. /// </summary>
  1601. /// <param name="expected">The expected value</param>
  1602. /// <param name="actual">The actual value</param>
  1603. /// <param name="message">The message to display in case of failure</param>
  1604. /// <param name="args">Array of objects to be used in formatting the message</param>
  1605. [CLSCompliant(false)]
  1606. public static void AreEqual(uint expected, uint actual, string message, params object[] args)
  1607. {
  1608. Assert.That(actual, Is.EqualTo(expected), message, args);
  1609. }
  1610. /// <summary>
  1611. /// Verifies that two values are equal. If they are not, then an
  1612. /// <see cref="AssertionException"/> is thrown.
  1613. /// </summary>
  1614. /// <param name="expected">The expected value</param>
  1615. /// <param name="actual">The actual value</param>
  1616. /// <param name="message">The message to display in case of failure</param>
  1617. [CLSCompliant(false)]
  1618. public static void AreEqual(uint expected, uint actual, string message)
  1619. {
  1620. Assert.That(actual, Is.EqualTo(expected), message, null);
  1621. }
  1622. /// <summary>
  1623. /// Verifies that two values are equal. If they are not, then an
  1624. /// <see cref="AssertionException"/> is thrown.
  1625. /// </summary>
  1626. /// <param name="expected">The expected value</param>
  1627. /// <param name="actual">The actual value</param>
  1628. [CLSCompliant(false)]
  1629. public static void AreEqual(uint expected, uint actual)
  1630. {
  1631. Assert.That(actual, Is.EqualTo(expected), null, null);
  1632. }
  1633. /// <summary>
  1634. /// Verifies that two values are equal. If they are not, then an
  1635. /// <see cref="AssertionException"/> is thrown.
  1636. /// </summary>
  1637. /// <param name="expected">The expected value</param>
  1638. /// <param name="actual">The actual value</param>
  1639. /// <param name="message">The message to display in case of failure</param>
  1640. /// <param name="args">Array of objects to be used in formatting the message</param>
  1641. [CLSCompliant(false)]
  1642. public static void AreEqual(ulong expected, ulong actual, string message, params object[] args)
  1643. {
  1644. Assert.That(actual, Is.EqualTo(expected), message, args);
  1645. }
  1646. /// <summary>
  1647. /// Verifies that two values are equal. If they are not, then an
  1648. /// <see cref="AssertionException"/> is thrown.
  1649. /// </summary>
  1650. /// <param name="expected">The expected value</param>
  1651. /// <param name="actual">The actual value</param>
  1652. /// <param name="message">The message to display in case of failure</param>
  1653. [CLSCompliant(false)]
  1654. public static void AreEqual(ulong expected, ulong actual, string message)
  1655. {
  1656. Assert.That(actual, Is.EqualTo(expected), message, null);
  1657. }
  1658. /// <summary>
  1659. /// Verifies that two values are equal. If they are not, then an
  1660. /// <see cref="AssertionException"/> is thrown.
  1661. /// </summary>
  1662. /// <param name="expected">The expected value</param>
  1663. /// <param name="actual">The actual value</param>
  1664. [CLSCompliant(false)]
  1665. public static void AreEqual(ulong expected, ulong actual)
  1666. {
  1667. Assert.That(actual, Is.EqualTo(expected), null, null);
  1668. }
  1669. /// <summary>
  1670. /// Verifies that two values are equal. If they are not, then an
  1671. /// <see cref="AssertionException"/> is thrown.
  1672. /// </summary>
  1673. /// <param name="expected">The expected value</param>
  1674. /// <param name="actual">The actual value</param>
  1675. /// <param name="message">The message to display in case of failure</param>
  1676. /// <param name="args">Array of objects to be used in formatting the message</param>
  1677. public static void AreEqual(decimal expected, decimal actual, string message, params object[] args)
  1678. {
  1679. Assert.That(actual, Is.EqualTo(expected), message, args);
  1680. }
  1681. /// <summary>
  1682. /// Verifies that two values are equal. If they are not, then an
  1683. /// <see cref="AssertionException"/> is thrown.
  1684. /// </summary>
  1685. /// <param name="expected">The expected value</param>
  1686. /// <param name="actual">The actual value</param>
  1687. /// <param name="message">The message to display in case of failure</param>
  1688. public static void AreEqual(decimal expected, decimal actual, string message)
  1689. {
  1690. Assert.That(actual, Is.EqualTo(expected), message, null);
  1691. }
  1692. /// <summary>
  1693. /// Verifies that two values are equal. If they are not, then an
  1694. /// <see cref="AssertionException"/> is thrown.
  1695. /// </summary>
  1696. /// <param name="expected">The expected value</param>
  1697. /// <param name="actual">The actual value</param>
  1698. public static void AreEqual(decimal expected, decimal actual)
  1699. {
  1700. Assert.That(actual, Is.EqualTo(expected), null, null);
  1701. }
  1702. #endregion
  1703. #region AreEqual
  1704. /// <summary>
  1705. /// Verifies that two doubles are equal considering a delta. If the
  1706. /// expected value is infinity then the delta value is ignored. If
  1707. /// they are not equal then an <see cref="AssertionException"/> is
  1708. /// thrown.
  1709. /// </summary>
  1710. /// <param name="expected">The expected value</param>
  1711. /// <param name="actual">The actual value</param>
  1712. /// <param name="delta">The maximum acceptable difference between the
  1713. /// the expected and the actual</param>
  1714. /// <param name="message">The message to display in case of failure</param>
  1715. /// <param name="args">Array of objects to be used in formatting the message</param>
  1716. public static void AreEqual(double expected, double actual, double delta, string message, params object[] args)
  1717. {
  1718. AssertDoublesAreEqual(expected, actual, delta, message, args);
  1719. }
  1720. /// <summary>
  1721. /// Verifies that two doubles are equal considering a delta. If the
  1722. /// expected value is infinity then the delta value is ignored. If
  1723. /// they are not equal then an <see cref="AssertionException"/> is
  1724. /// thrown.
  1725. /// </summary>
  1726. /// <param name="expected">The expected value</param>
  1727. /// <param name="actual">The actual value</param>
  1728. /// <param name="delta">The maximum acceptable difference between the
  1729. /// the expected and the actual</param>
  1730. /// <param name="message">The message to display in case of failure</param>
  1731. public static void AreEqual(double expected, double actual, double delta, string message)
  1732. {
  1733. AssertDoublesAreEqual(expected, actual, delta, message, null);
  1734. }
  1735. /// <summary>
  1736. /// Verifies that two doubles are equal considering a delta. If the
  1737. /// expected value is infinity then the delta value is ignored. If
  1738. /// they are not equal then an <see cref="AssertionException"/> is
  1739. /// thrown.
  1740. /// </summary>
  1741. /// <param name="expected">The expected value</param>
  1742. /// <param name="actual">The actual value</param>
  1743. /// <param name="delta">The maximum acceptable difference between the
  1744. /// the expected and the actual</param>
  1745. public static void AreEqual(double expected, double actual, double delta)
  1746. {
  1747. AssertDoublesAreEqual(expected, actual, delta, null, null);
  1748. }
  1749. #if NET_2_0
  1750. /// <summary>
  1751. /// Verifies that two doubles are equal considering a delta. If the
  1752. /// expected value is infinity then the delta value is ignored. If
  1753. /// they are not equal then an <see cref="AssertionException"/> is
  1754. /// thrown.
  1755. /// </summary>
  1756. /// <param name="expected">The expected value</param>
  1757. /// <param name="actual">The actual value</param>
  1758. /// <param name="delta">The maximum acceptable difference between the
  1759. /// the expected and the actual</param>
  1760. /// <param name="message">The message to display in case of failure</param>
  1761. /// <param name="args">Array of objects to be used in formatting the message</param>
  1762. public static void AreEqual(double expected, double? actual, double delta, string message, params object[] args)
  1763. {
  1764. AssertDoublesAreEqual(expected, (double)actual, delta, message, args);
  1765. }
  1766. /// <summary>
  1767. /// Verifies that two doubles are equal considering a delta. If the
  1768. /// expected value is infinity then the delta value is ignored. If
  1769. /// they are not equal then an <see cref="AssertionException"/> is
  1770. /// thrown.
  1771. /// </summary>
  1772. /// <param name="expected">The expected value</param>
  1773. /// <param name="actual">The actual value</param>
  1774. /// <param name="delta">The maximum acceptable difference between the
  1775. /// the expected and the actual</param>
  1776. /// <param name="message">The message to display in case of failure</param>
  1777. public static void AreEqual(double expected, double? actual, double delta, string message)
  1778. {
  1779. AssertDoublesAreEqual(expected, (double)actual, delta, message, null);
  1780. }
  1781. /// <summary>
  1782. /// Verifies that two doubles are equal considering a delta. If the
  1783. /// expected value is infinity then the delta value is ignored. If
  1784. /// they are not equal then an <see cref="AssertionException"/> is
  1785. /// thrown.
  1786. /// </summary>
  1787. /// <param name="expected">The expected value</param>
  1788. /// <param name="actual">The actual value</param>
  1789. /// <param name="delta">The maximum acceptable difference between the
  1790. /// the expected and the actual</param>
  1791. public static void AreEqual(double expected, double? actual, double delta)
  1792. {
  1793. AssertDoublesAreEqual(expected, (double)actual, delta, null, null);
  1794. }
  1795. #endif
  1796. #endregion
  1797. #region AreEqual
  1798. /// <summary>
  1799. /// Verifies that two objects are equal. Two objects are considered
  1800. /// equal if both are null, or if both have the same value. NUnit
  1801. /// has special semantics for some object types.
  1802. /// If they are not equal an <see cref="AssertionException"/> is thrown.
  1803. /// </summary>
  1804. /// <param name="expected">The value that is expected</param>
  1805. /// <param name="actual">The actual value</param>
  1806. /// <param name="message">The message to display in case of failure</param>
  1807. /// <param name="args">Array of objects to be used in formatting the message</param>
  1808. public static void AreEqual(object expected, object actual, string message, params object[] args)
  1809. {
  1810. Assert.That(actual, Is.EqualTo(expected), message, args);
  1811. }
  1812. /// <summary>
  1813. /// Verifies that two objects are equal. Two objects are considered
  1814. /// equal if both are null, or if both have the same value. NUnit
  1815. /// has special semantics for some object types.
  1816. /// If they are not equal an <see cref="AssertionException"/> is thrown.
  1817. /// </summary>
  1818. /// <param name="expected">The value that is expected</param>
  1819. /// <param name="actual">The actual value</param>
  1820. /// <param name="message">The message to display in case of failure</param>
  1821. public static void AreEqual(object expected, object actual, string message)
  1822. {
  1823. Assert.That(actual, Is.EqualTo(expected), message, null);
  1824. }
  1825. /// <summary>
  1826. /// Verifies that two objects are equal. Two objects are considered
  1827. /// equal if both are null, or if both have the same value. NUnit
  1828. /// has special semantics for some object types.
  1829. /// If they are not equal an <see cref="AssertionException"/> is thrown.
  1830. /// </summary>
  1831. /// <param name="expected">The value that is expected</param>
  1832. /// <param name="actual">The actual value</param>
  1833. public static void AreEqual(object expected, object actual)
  1834. {
  1835. Assert.That(actual, Is.EqualTo(expected), null, null);
  1836. }
  1837. #endregion
  1838. #region AreNotEqual
  1839. /// <summary>
  1840. /// Verifies that two values are not equal. If they are equal, then an
  1841. /// <see cref="AssertionException"/> is thrown.
  1842. /// </summary>
  1843. /// <param name="expected">The expected value</param>
  1844. /// <param name="actual">The actual value</param>
  1845. /// <param name="message">The message to display in case of failure</param>
  1846. /// <param name="args">Array of objects to be used in formatting the message</param>
  1847. public static void AreNotEqual(int expected, int actual, string message, params object[] args)
  1848. {
  1849. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1850. }
  1851. /// <summary>
  1852. /// Verifies that two values are not equal. If they are equal, then an
  1853. /// <see cref="AssertionException"/> is thrown.
  1854. /// </summary>
  1855. /// <param name="expected">The expected value</param>
  1856. /// <param name="actual">The actual value</param>
  1857. /// <param name="message">The message to display in case of failure</param>
  1858. public static void AreNotEqual(int expected, int actual, string message)
  1859. {
  1860. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  1861. }
  1862. /// <summary>
  1863. /// Verifies that two values are not equal. If they are equal, then an
  1864. /// <see cref="AssertionException"/> is thrown.
  1865. /// </summary>
  1866. /// <param name="expected">The expected value</param>
  1867. /// <param name="actual">The actual value</param>
  1868. public static void AreNotEqual(int expected, int actual)
  1869. {
  1870. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  1871. }
  1872. /// <summary>
  1873. /// Verifies that two values are not equal. If they are equal, then an
  1874. /// <see cref="AssertionException"/> is thrown.
  1875. /// </summary>
  1876. /// <param name="expected">The expected value</param>
  1877. /// <param name="actual">The actual value</param>
  1878. /// <param name="message">The message to display in case of failure</param>
  1879. /// <param name="args">Array of objects to be used in formatting the message</param>
  1880. public static void AreNotEqual(long expected, long actual, string message, params object[] args)
  1881. {
  1882. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1883. }
  1884. /// <summary>
  1885. /// Verifies that two values are not equal. If they are equal, then an
  1886. /// <see cref="AssertionException"/> is thrown.
  1887. /// </summary>
  1888. /// <param name="expected">The expected value</param>
  1889. /// <param name="actual">The actual value</param>
  1890. /// <param name="message">The message to display in case of failure</param>
  1891. public static void AreNotEqual(long expected, long actual, string message)
  1892. {
  1893. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  1894. }
  1895. /// <summary>
  1896. /// Verifies that two values are not equal. If they are equal, then an
  1897. /// <see cref="AssertionException"/> is thrown.
  1898. /// </summary>
  1899. /// <param name="expected">The expected value</param>
  1900. /// <param name="actual">The actual value</param>
  1901. public static void AreNotEqual(long expected, long actual)
  1902. {
  1903. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  1904. }
  1905. /// <summary>
  1906. /// Verifies that two values are not equal. If they are equal, then an
  1907. /// <see cref="AssertionException"/> is thrown.
  1908. /// </summary>
  1909. /// <param name="expected">The expected value</param>
  1910. /// <param name="actual">The actual value</param>
  1911. /// <param name="message">The message to display in case of failure</param>
  1912. /// <param name="args">Array of objects to be used in formatting the message</param>
  1913. [CLSCompliant(false)]
  1914. public static void AreNotEqual(uint expected, uint actual, string message, params object[] args)
  1915. {
  1916. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1917. }
  1918. /// <summary>
  1919. /// Verifies that two values are not equal. If they are equal, then an
  1920. /// <see cref="AssertionException"/> is thrown.
  1921. /// </summary>
  1922. /// <param name="expected">The expected value</param>
  1923. /// <param name="actual">The actual value</param>
  1924. /// <param name="message">The message to display in case of failure</param>
  1925. [CLSCompliant(false)]
  1926. public static void AreNotEqual(uint expected, uint actual, string message)
  1927. {
  1928. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  1929. }
  1930. /// <summary>
  1931. /// Verifies that two values are not equal. If they are equal, then an
  1932. /// <see cref="AssertionException"/> is thrown.
  1933. /// </summary>
  1934. /// <param name="expected">The expected value</param>
  1935. /// <param name="actual">The actual value</param>
  1936. [CLSCompliant(false)]
  1937. public static void AreNotEqual(uint expected, uint actual)
  1938. {
  1939. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  1940. }
  1941. /// <summary>
  1942. /// Verifies that two values are not equal. If they are equal, then an
  1943. /// <see cref="AssertionException"/> is thrown.
  1944. /// </summary>
  1945. /// <param name="expected">The expected value</param>
  1946. /// <param name="actual">The actual value</param>
  1947. /// <param name="message">The message to display in case of failure</param>
  1948. /// <param name="args">Array of objects to be used in formatting the message</param>
  1949. [CLSCompliant(false)]
  1950. public static void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
  1951. {
  1952. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1953. }
  1954. /// <summary>
  1955. /// Verifies that two values are not equal. If they are equal, then an
  1956. /// <see cref="AssertionException"/> is thrown.
  1957. /// </summary>
  1958. /// <param name="expected">The expected value</param>
  1959. /// <param name="actual">The actual value</param>
  1960. /// <param name="message">The message to display in case of failure</param>
  1961. [CLSCompliant(false)]
  1962. public static void AreNotEqual(ulong expected, ulong actual, string message)
  1963. {
  1964. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  1965. }
  1966. /// <summary>
  1967. /// Verifies that two values are not equal. If they are equal, then an
  1968. /// <see cref="AssertionException"/> is thrown.
  1969. /// </summary>
  1970. /// <param name="expected">The expected value</param>
  1971. /// <param name="actual">The actual value</param>
  1972. [CLSCompliant(false)]
  1973. public static void AreNotEqual(ulong expected, ulong actual)
  1974. {
  1975. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  1976. }
  1977. /// <summary>
  1978. /// Verifies that two values are not equal. If they are equal, then an
  1979. /// <see cref="AssertionException"/> is thrown.
  1980. /// </summary>
  1981. /// <param name="expected">The expected value</param>
  1982. /// <param name="actual">The actual value</param>
  1983. /// <param name="message">The message to display in case of failure</param>
  1984. /// <param name="args">Array of objects to be used in formatting the message</param>
  1985. public static void AreNotEqual(decimal expected, decimal actual, string message, params object[] args)
  1986. {
  1987. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1988. }
  1989. /// <summary>
  1990. /// Verifies that two values are not equal. If they are equal, then an
  1991. /// <see cref="AssertionException"/> is thrown.
  1992. /// </summary>
  1993. /// <param name="expected">The expected value</param>
  1994. /// <param name="actual">The actual value</param>
  1995. /// <param name="message">The message to display in case of failure</param>
  1996. public static void AreNotEqual(decimal expected, decimal actual, string message)
  1997. {
  1998. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  1999. }
  2000. /// <summary>
  2001. /// Verifies that two values are not equal. If they are equal, then an
  2002. /// <see cref="AssertionException"/> is thrown.
  2003. /// </summary>
  2004. /// <param name="expected">The expected value</param>
  2005. /// <param name="actual">The actual value</param>
  2006. public static void AreNotEqual(decimal expected, decimal actual)
  2007. {
  2008. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  2009. }
  2010. /// <summary>
  2011. /// Verifies that two values are not equal. If they are equal, then an
  2012. /// <see cref="AssertionException"/> is thrown.
  2013. /// </summary>
  2014. /// <param name="expected">The expected value</param>
  2015. /// <param name="actual">The actual value</param>
  2016. /// <param name="message">The message to display in case of failure</param>
  2017. /// <param name="args">Array of objects to be used in formatting the message</param>
  2018. public static void AreNotEqual(float expected, float actual, string message, params object[] args)
  2019. {
  2020. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  2021. }
  2022. /// <summary>
  2023. /// Verifies that two values are not equal. If they are equal, then an
  2024. /// <see cref="AssertionException"/> is thrown.
  2025. /// </summary>
  2026. /// <param name="expected">The expected value</param>
  2027. /// <param name="actual">The actual value</param>
  2028. /// <param name="message">The message to display in case of failure</param>
  2029. public static void AreNotEqual(float expected, float actual, string message)
  2030. {
  2031. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  2032. }
  2033. /// <summary>
  2034. /// Verifies that two values are not equal. If they are equal, then an
  2035. /// <see cref="AssertionException"/> is thrown.
  2036. /// </summary>
  2037. /// <param name="expected">The expected value</param>
  2038. /// <param name="actual">The actual value</param>
  2039. public static void AreNotEqual(float expected, float actual)
  2040. {
  2041. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  2042. }
  2043. /// <summary>
  2044. /// Verifies that two values are not equal. If they are equal, then an
  2045. /// <see cref="AssertionException"/> is thrown.
  2046. /// </summary>
  2047. /// <param name="expected">The expected value</param>
  2048. /// <param name="actual">The actual value</param>
  2049. /// <param name="message">The message to display in case of failure</param>
  2050. /// <param name="args">Array of objects to be used in formatting the message</param>
  2051. public static void AreNotEqual(double expected, double actual, string message, params object[] args)
  2052. {
  2053. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  2054. }
  2055. /// <summary>
  2056. /// Verifies that two values are not equal. If they are equal, then an
  2057. /// <see cref="AssertionException"/> is thrown.
  2058. /// </summary>
  2059. /// <param name="expected">The expected value</param>
  2060. /// <param name="actual">The actual value</param>
  2061. /// <param name="message">The message to display in case of failure</param>
  2062. public static void AreNotEqual(double expected, double actual, string message)
  2063. {
  2064. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  2065. }
  2066. /// <summary>
  2067. /// Verifies that two values are not equal. If they are equal, then an
  2068. /// <see cref="AssertionException"/> is thrown.
  2069. /// </summary>
  2070. /// <param name="expected">The expected value</param>
  2071. /// <param name="actual">The actual value</param>
  2072. public static void AreNotEqual(double expected, double actual)
  2073. {
  2074. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  2075. }
  2076. #endregion
  2077. #region AreNotEqual
  2078. /// <summary>
  2079. /// Verifies that two objects are not equal. Two objects are considered
  2080. /// equal if both are null, or if both have the same value. NUnit
  2081. /// has special semantics for some object types.
  2082. /// If they are equal an <see cref="AssertionException"/> is thrown.
  2083. /// </summary>
  2084. /// <param name="expected">The value that is expected</param>
  2085. /// <param name="actual">The actual value</param>
  2086. /// <param name="message">The message to display in case of failure</param>
  2087. /// <param name="args">Array of objects to be used in formatting the message</param>
  2088. public static void AreNotEqual(object expected, object actual, string message, params object[] args)
  2089. {
  2090. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  2091. }
  2092. /// <summary>
  2093. /// Verifies that two objects are not equal. Two objects are considered
  2094. /// equal if both are null, or if both have the same value. NUnit
  2095. /// has special semantics for some object types.
  2096. /// If they are equal an <see cref="AssertionException"/> is thrown.
  2097. /// </summary>
  2098. /// <param name="expected">The value that is expected</param>
  2099. /// <param name="actual">The actual value</param>
  2100. /// <param name="message">The message to display in case of failure</param>
  2101. public static void AreNotEqual(object expected, object actual, string message)
  2102. {
  2103. Assert.That(actual, Is.Not.EqualTo(expected), message, null);
  2104. }
  2105. /// <summary>
  2106. /// Verifies that two objects are not equal. Two objects are considered
  2107. /// equal if both are null, or if both have the same value. NUnit
  2108. /// has special semantics for some object types.
  2109. /// If they are equal an <see cref="AssertionException"/> is thrown.
  2110. /// </summary>
  2111. /// <param name="expected">The value that is expected</param>
  2112. /// <param name="actual">The actual value</param>
  2113. public static void AreNotEqual(object expected, object actual)
  2114. {
  2115. Assert.That(actual, Is.Not.EqualTo(expected), null, null);
  2116. }
  2117. #endregion
  2118. #region AreSame
  2119. /// <summary>
  2120. /// Asserts that two objects refer to the same object. If they
  2121. /// are not the same an <see cref="AssertionException"/> is thrown.
  2122. /// </summary>
  2123. /// <param name="expected">The expected object</param>
  2124. /// <param name="actual">The actual object</param>
  2125. /// <param name="message">The message to display in case of failure</param>
  2126. /// <param name="args">Array of objects to be used in formatting the message</param>
  2127. public static void AreSame(object expected, object actual, string message, params object[] args)
  2128. {
  2129. Assert.That(actual, Is.SameAs(expected), message, args);
  2130. }
  2131. /// <summary>
  2132. /// Asserts that two objects refer to the same object. If they
  2133. /// are not the same an <see cref="AssertionException"/> is thrown.
  2134. /// </summary>
  2135. /// <param name="expected">The expected object</param>
  2136. /// <param name="actual">The actual object</param>
  2137. /// <param name="message">The message to display in case of failure</param>
  2138. public static void AreSame(object expected, object actual, string message)
  2139. {
  2140. Assert.That(actual, Is.SameAs(expected), message, null);
  2141. }
  2142. /// <summary>
  2143. /// Asserts that two objects refer to the same object. If they
  2144. /// are not the same an <see cref="AssertionException"/> is thrown.
  2145. /// </summary>
  2146. /// <param name="expected">The expected object</param>
  2147. /// <param name="actual">The actual object</param>
  2148. public static void AreSame(object expected, object actual)
  2149. {
  2150. Assert.That(actual, Is.SameAs(expected), null, null);
  2151. }
  2152. #endregion
  2153. #region AreNotSame
  2154. /// <summary>
  2155. /// Asserts that two objects do not refer to the same object. If they
  2156. /// are the same an <see cref="AssertionException"/> is thrown.
  2157. /// </summary>
  2158. /// <param name="expected">The expected object</param>
  2159. /// <param name="actual">The actual object</param>
  2160. /// <param name="message">The message to display in case of failure</param>
  2161. /// <param name="args">Array of objects to be used in formatting the message</param>
  2162. public static void AreNotSame(object expected, object actual, string message, params object[] args)
  2163. {
  2164. Assert.That(actual, Is.Not.SameAs(expected), message, args);
  2165. }
  2166. /// <summary>
  2167. /// Asserts that two objects do not refer to the same object. If they
  2168. /// are the same an <see cref="AssertionException"/> is thrown.
  2169. /// </summary>
  2170. /// <param name="expected">The expected object</param>
  2171. /// <param name="actual">The actual object</param>
  2172. /// <param name="message">The message to display in case of failure</param>
  2173. public static void AreNotSame(object expected, object actual, string message)
  2174. {
  2175. Assert.That(actual, Is.Not.SameAs(expected), message, null);
  2176. }
  2177. /// <summary>
  2178. /// Asserts that two objects do not refer to the same object. If they
  2179. /// are the same an <see cref="AssertionException"/> is thrown.
  2180. /// </summary>
  2181. /// <param name="expected">The expected object</param>
  2182. /// <param name="actual">The actual object</param>
  2183. public static void AreNotSame(object expected, object actual)
  2184. {
  2185. Assert.That(actual, Is.Not.SameAs(expected), null, null);
  2186. }
  2187. #endregion
  2188. #region Greater
  2189. /// <summary>
  2190. /// Verifies that the first value is greater than the second
  2191. /// value. If it is not, then an
  2192. /// <see cref="AssertionException"/> is thrown.
  2193. /// </summary>
  2194. /// <param name="arg1">The first value, expected to be greater</param>
  2195. /// <param name="arg2">The second value, expected to be less</param>
  2196. /// <param name="message">The message to display in case of failure</param>
  2197. /// <param name="args">Array of objects to be used in formatting the message</param>
  2198. public static void Greater(int arg1, int arg2, string message, params object[] args)
  2199. {
  2200. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2201. }
  2202. /// <summary>
  2203. /// Verifies that the first value is greater than the second
  2204. /// value. If it is not, then an
  2205. /// <see cref="AssertionException"/> is thrown.
  2206. /// </summary>
  2207. /// <param name="arg1">The first value, expected to be greater</param>
  2208. /// <param name="arg2">The second value, expected to be less</param>
  2209. /// <param name="message">The message to display in case of failure</param>
  2210. public static void Greater(int arg1, int arg2, string message)
  2211. {
  2212. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2213. }
  2214. /// <summary>
  2215. /// Verifies that the first value is greater than the second
  2216. /// value. If it is not, then an
  2217. /// <see cref="AssertionException"/> is thrown.
  2218. /// </summary>
  2219. /// <param name="arg1">The first value, expected to be greater</param>
  2220. /// <param name="arg2">The second value, expected to be less</param>
  2221. public static void Greater(int arg1, int arg2)
  2222. {
  2223. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2224. }
  2225. /// <summary>
  2226. /// Verifies that the first value is greater than the second
  2227. /// value. If it is not, then an
  2228. /// <see cref="AssertionException"/> is thrown.
  2229. /// </summary>
  2230. /// <param name="arg1">The first value, expected to be greater</param>
  2231. /// <param name="arg2">The second value, expected to be less</param>
  2232. /// <param name="message">The message to display in case of failure</param>
  2233. /// <param name="args">Array of objects to be used in formatting the message</param>
  2234. [CLSCompliant(false)]
  2235. public static void Greater(uint arg1, uint arg2, string message, params object[] args)
  2236. {
  2237. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2238. }
  2239. /// <summary>
  2240. /// Verifies that the first value is greater than the second
  2241. /// value. If it is not, then an
  2242. /// <see cref="AssertionException"/> is thrown.
  2243. /// </summary>
  2244. /// <param name="arg1">The first value, expected to be greater</param>
  2245. /// <param name="arg2">The second value, expected to be less</param>
  2246. /// <param name="message">The message to display in case of failure</param>
  2247. [CLSCompliant(false)]
  2248. public static void Greater(uint arg1, uint arg2, string message)
  2249. {
  2250. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2251. }
  2252. /// <summary>
  2253. /// Verifies that the first value is greater than the second
  2254. /// value. If it is not, then an
  2255. /// <see cref="AssertionException"/> is thrown.
  2256. /// </summary>
  2257. /// <param name="arg1">The first value, expected to be greater</param>
  2258. /// <param name="arg2">The second value, expected to be less</param>
  2259. [CLSCompliant(false)]
  2260. public static void Greater(uint arg1, uint arg2)
  2261. {
  2262. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2263. }
  2264. /// <summary>
  2265. /// Verifies that the first value is greater than the second
  2266. /// value. If it is not, then an
  2267. /// <see cref="AssertionException"/> is thrown.
  2268. /// </summary>
  2269. /// <param name="arg1">The first value, expected to be greater</param>
  2270. /// <param name="arg2">The second value, expected to be less</param>
  2271. /// <param name="message">The message to display in case of failure</param>
  2272. /// <param name="args">Array of objects to be used in formatting the message</param>
  2273. public static void Greater(long arg1, long arg2, string message, params object[] args)
  2274. {
  2275. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2276. }
  2277. /// <summary>
  2278. /// Verifies that the first value is greater than the second
  2279. /// value. If it is not, then an
  2280. /// <see cref="AssertionException"/> is thrown.
  2281. /// </summary>
  2282. /// <param name="arg1">The first value, expected to be greater</param>
  2283. /// <param name="arg2">The second value, expected to be less</param>
  2284. /// <param name="message">The message to display in case of failure</param>
  2285. public static void Greater(long arg1, long arg2, string message)
  2286. {
  2287. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2288. }
  2289. /// <summary>
  2290. /// Verifies that the first value is greater than the second
  2291. /// value. If it is not, then an
  2292. /// <see cref="AssertionException"/> is thrown.
  2293. /// </summary>
  2294. /// <param name="arg1">The first value, expected to be greater</param>
  2295. /// <param name="arg2">The second value, expected to be less</param>
  2296. public static void Greater(long arg1, long arg2)
  2297. {
  2298. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2299. }
  2300. /// <summary>
  2301. /// Verifies that the first value is greater than the second
  2302. /// value. If it is not, then an
  2303. /// <see cref="AssertionException"/> is thrown.
  2304. /// </summary>
  2305. /// <param name="arg1">The first value, expected to be greater</param>
  2306. /// <param name="arg2">The second value, expected to be less</param>
  2307. /// <param name="message">The message to display in case of failure</param>
  2308. /// <param name="args">Array of objects to be used in formatting the message</param>
  2309. [CLSCompliant(false)]
  2310. public static void Greater(ulong arg1, ulong arg2, string message, params object[] args)
  2311. {
  2312. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2313. }
  2314. /// <summary>
  2315. /// Verifies that the first value is greater than the second
  2316. /// value. If it is not, then an
  2317. /// <see cref="AssertionException"/> is thrown.
  2318. /// </summary>
  2319. /// <param name="arg1">The first value, expected to be greater</param>
  2320. /// <param name="arg2">The second value, expected to be less</param>
  2321. /// <param name="message">The message to display in case of failure</param>
  2322. [CLSCompliant(false)]
  2323. public static void Greater(ulong arg1, ulong arg2, string message)
  2324. {
  2325. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2326. }
  2327. /// <summary>
  2328. /// Verifies that the first value is greater than the second
  2329. /// value. If it is not, then an
  2330. /// <see cref="AssertionException"/> is thrown.
  2331. /// </summary>
  2332. /// <param name="arg1">The first value, expected to be greater</param>
  2333. /// <param name="arg2">The second value, expected to be less</param>
  2334. [CLSCompliant(false)]
  2335. public static void Greater(ulong arg1, ulong arg2)
  2336. {
  2337. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2338. }
  2339. /// <summary>
  2340. /// Verifies that the first value is greater than the second
  2341. /// value. If it is not, then an
  2342. /// <see cref="AssertionException"/> is thrown.
  2343. /// </summary>
  2344. /// <param name="arg1">The first value, expected to be greater</param>
  2345. /// <param name="arg2">The second value, expected to be less</param>
  2346. /// <param name="message">The message to display in case of failure</param>
  2347. /// <param name="args">Array of objects to be used in formatting the message</param>
  2348. public static void Greater(decimal arg1, decimal arg2, string message, params object[] args)
  2349. {
  2350. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2351. }
  2352. /// <summary>
  2353. /// Verifies that the first value is greater than the second
  2354. /// value. If it is not, then an
  2355. /// <see cref="AssertionException"/> is thrown.
  2356. /// </summary>
  2357. /// <param name="arg1">The first value, expected to be greater</param>
  2358. /// <param name="arg2">The second value, expected to be less</param>
  2359. /// <param name="message">The message to display in case of failure</param>
  2360. public static void Greater(decimal arg1, decimal arg2, string message)
  2361. {
  2362. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2363. }
  2364. /// <summary>
  2365. /// Verifies that the first value is greater than the second
  2366. /// value. If it is not, then an
  2367. /// <see cref="AssertionException"/> is thrown.
  2368. /// </summary>
  2369. /// <param name="arg1">The first value, expected to be greater</param>
  2370. /// <param name="arg2">The second value, expected to be less</param>
  2371. public static void Greater(decimal arg1, decimal arg2)
  2372. {
  2373. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2374. }
  2375. /// <summary>
  2376. /// Verifies that the first value is greater than the second
  2377. /// value. If it is not, then an
  2378. /// <see cref="AssertionException"/> is thrown.
  2379. /// </summary>
  2380. /// <param name="arg1">The first value, expected to be greater</param>
  2381. /// <param name="arg2">The second value, expected to be less</param>
  2382. /// <param name="message">The message to display in case of failure</param>
  2383. /// <param name="args">Array of objects to be used in formatting the message</param>
  2384. public static void Greater(double arg1, double arg2, string message, params object[] args)
  2385. {
  2386. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2387. }
  2388. /// <summary>
  2389. /// Verifies that the first value is greater than the second
  2390. /// value. If it is not, then an
  2391. /// <see cref="AssertionException"/> is thrown.
  2392. /// </summary>
  2393. /// <param name="arg1">The first value, expected to be greater</param>
  2394. /// <param name="arg2">The second value, expected to be less</param>
  2395. /// <param name="message">The message to display in case of failure</param>
  2396. public static void Greater(double arg1, double arg2, string message)
  2397. {
  2398. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2399. }
  2400. /// <summary>
  2401. /// Verifies that the first value is greater than the second
  2402. /// value. If it is not, then an
  2403. /// <see cref="AssertionException"/> is thrown.
  2404. /// </summary>
  2405. /// <param name="arg1">The first value, expected to be greater</param>
  2406. /// <param name="arg2">The second value, expected to be less</param>
  2407. public static void Greater(double arg1, double arg2)
  2408. {
  2409. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2410. }
  2411. /// <summary>
  2412. /// Verifies that the first value is greater than the second
  2413. /// value. If it is not, then an
  2414. /// <see cref="AssertionException"/> is thrown.
  2415. /// </summary>
  2416. /// <param name="arg1">The first value, expected to be greater</param>
  2417. /// <param name="arg2">The second value, expected to be less</param>
  2418. /// <param name="message">The message to display in case of failure</param>
  2419. /// <param name="args">Array of objects to be used in formatting the message</param>
  2420. public static void Greater(float arg1, float arg2, string message, params object[] args)
  2421. {
  2422. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2423. }
  2424. /// <summary>
  2425. /// Verifies that the first value is greater than the second
  2426. /// value. If it is not, then an
  2427. /// <see cref="AssertionException"/> is thrown.
  2428. /// </summary>
  2429. /// <param name="arg1">The first value, expected to be greater</param>
  2430. /// <param name="arg2">The second value, expected to be less</param>
  2431. /// <param name="message">The message to display in case of failure</param>
  2432. public static void Greater(float arg1, float arg2, string message)
  2433. {
  2434. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2435. }
  2436. /// <summary>
  2437. /// Verifies that the first value is greater than the second
  2438. /// value. If it is not, then an
  2439. /// <see cref="AssertionException"/> is thrown.
  2440. /// </summary>
  2441. /// <param name="arg1">The first value, expected to be greater</param>
  2442. /// <param name="arg2">The second value, expected to be less</param>
  2443. public static void Greater(float arg1, float arg2)
  2444. {
  2445. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2446. }
  2447. /// <summary>
  2448. /// Verifies that the first value is greater than the second
  2449. /// value. If it is not, then an
  2450. /// <see cref="AssertionException"/> is thrown.
  2451. /// </summary>
  2452. /// <param name="arg1">The first value, expected to be greater</param>
  2453. /// <param name="arg2">The second value, expected to be less</param>
  2454. /// <param name="message">The message to display in case of failure</param>
  2455. /// <param name="args">Array of objects to be used in formatting the message</param>
  2456. public static void Greater(IComparable arg1, IComparable arg2, string message, params object[] args)
  2457. {
  2458. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  2459. }
  2460. /// <summary>
  2461. /// Verifies that the first value is greater than the second
  2462. /// value. If it is not, then an
  2463. /// <see cref="AssertionException"/> is thrown.
  2464. /// </summary>
  2465. /// <param name="arg1">The first value, expected to be greater</param>
  2466. /// <param name="arg2">The second value, expected to be less</param>
  2467. /// <param name="message">The message to display in case of failure</param>
  2468. public static void Greater(IComparable arg1, IComparable arg2, string message)
  2469. {
  2470. Assert.That(arg1, Is.GreaterThan(arg2), message, null);
  2471. }
  2472. /// <summary>
  2473. /// Verifies that the first value is greater than the second
  2474. /// value. If it is not, then an
  2475. /// <see cref="AssertionException"/> is thrown.
  2476. /// </summary>
  2477. /// <param name="arg1">The first value, expected to be greater</param>
  2478. /// <param name="arg2">The second value, expected to be less</param>
  2479. public static void Greater(IComparable arg1, IComparable arg2)
  2480. {
  2481. Assert.That(arg1, Is.GreaterThan(arg2), null, null);
  2482. }
  2483. #endregion
  2484. #region Less
  2485. /// <summary>
  2486. /// Verifies that the first value is less than the second
  2487. /// value. If it is not, then an
  2488. /// <see cref="AssertionException"/> is thrown.
  2489. /// </summary>
  2490. /// <param name="arg1">The first value, expected to be less</param>
  2491. /// <param name="arg2">The second value, expected to be greater</param>
  2492. /// <param name="message">The message to display in case of failure</param>
  2493. /// <param name="args">Array of objects to be used in formatting the message</param>
  2494. public static void Less(int arg1, int arg2, string message, params object[] args)
  2495. {
  2496. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2497. }
  2498. /// <summary>
  2499. /// Verifies that the first value is less than the second
  2500. /// value. If it is not, then an
  2501. /// <see cref="AssertionException"/> is thrown.
  2502. /// </summary>
  2503. /// <param name="arg1">The first value, expected to be less</param>
  2504. /// <param name="arg2">The second value, expected to be greater</param>
  2505. /// <param name="message">The message to display in case of failure</param>
  2506. public static void Less(int arg1, int arg2, string message)
  2507. {
  2508. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2509. }
  2510. /// <summary>
  2511. /// Verifies that the first value is less than the second
  2512. /// value. If it is not, then an
  2513. /// <see cref="AssertionException"/> is thrown.
  2514. /// </summary>
  2515. /// <param name="arg1">The first value, expected to be less</param>
  2516. /// <param name="arg2">The second value, expected to be greater</param>
  2517. public static void Less(int arg1, int arg2)
  2518. {
  2519. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2520. }
  2521. /// <summary>
  2522. /// Verifies that the first value is less than the second
  2523. /// value. If it is not, then an
  2524. /// <see cref="AssertionException"/> is thrown.
  2525. /// </summary>
  2526. /// <param name="arg1">The first value, expected to be less</param>
  2527. /// <param name="arg2">The second value, expected to be greater</param>
  2528. /// <param name="message">The message to display in case of failure</param>
  2529. /// <param name="args">Array of objects to be used in formatting the message</param>
  2530. [CLSCompliant(false)]
  2531. public static void Less(uint arg1, uint arg2, string message, params object[] args)
  2532. {
  2533. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2534. }
  2535. /// <summary>
  2536. /// Verifies that the first value is less than the second
  2537. /// value. If it is not, then an
  2538. /// <see cref="AssertionException"/> is thrown.
  2539. /// </summary>
  2540. /// <param name="arg1">The first value, expected to be less</param>
  2541. /// <param name="arg2">The second value, expected to be greater</param>
  2542. /// <param name="message">The message to display in case of failure</param>
  2543. [CLSCompliant(false)]
  2544. public static void Less(uint arg1, uint arg2, string message)
  2545. {
  2546. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2547. }
  2548. /// <summary>
  2549. /// Verifies that the first value is less than the second
  2550. /// value. If it is not, then an
  2551. /// <see cref="AssertionException"/> is thrown.
  2552. /// </summary>
  2553. /// <param name="arg1">The first value, expected to be less</param>
  2554. /// <param name="arg2">The second value, expected to be greater</param>
  2555. [CLSCompliant(false)]
  2556. public static void Less(uint arg1, uint arg2)
  2557. {
  2558. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2559. }
  2560. /// <summary>
  2561. /// Verifies that the first value is less than the second
  2562. /// value. If it is not, then an
  2563. /// <see cref="AssertionException"/> is thrown.
  2564. /// </summary>
  2565. /// <param name="arg1">The first value, expected to be less</param>
  2566. /// <param name="arg2">The second value, expected to be greater</param>
  2567. /// <param name="message">The message to display in case of failure</param>
  2568. /// <param name="args">Array of objects to be used in formatting the message</param>
  2569. public static void Less(long arg1, long arg2, string message, params object[] args)
  2570. {
  2571. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2572. }
  2573. /// <summary>
  2574. /// Verifies that the first value is less than the second
  2575. /// value. If it is not, then an
  2576. /// <see cref="AssertionException"/> is thrown.
  2577. /// </summary>
  2578. /// <param name="arg1">The first value, expected to be less</param>
  2579. /// <param name="arg2">The second value, expected to be greater</param>
  2580. /// <param name="message">The message to display in case of failure</param>
  2581. public static void Less(long arg1, long arg2, string message)
  2582. {
  2583. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2584. }
  2585. /// <summary>
  2586. /// Verifies that the first value is less than the second
  2587. /// value. If it is not, then an
  2588. /// <see cref="AssertionException"/> is thrown.
  2589. /// </summary>
  2590. /// <param name="arg1">The first value, expected to be less</param>
  2591. /// <param name="arg2">The second value, expected to be greater</param>
  2592. public static void Less(long arg1, long arg2)
  2593. {
  2594. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2595. }
  2596. /// <summary>
  2597. /// Verifies that the first value is less than the second
  2598. /// value. If it is not, then an
  2599. /// <see cref="AssertionException"/> is thrown.
  2600. /// </summary>
  2601. /// <param name="arg1">The first value, expected to be less</param>
  2602. /// <param name="arg2">The second value, expected to be greater</param>
  2603. /// <param name="message">The message to display in case of failure</param>
  2604. /// <param name="args">Array of objects to be used in formatting the message</param>
  2605. [CLSCompliant(false)]
  2606. public static void Less(ulong arg1, ulong arg2, string message, params object[] args)
  2607. {
  2608. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2609. }
  2610. /// <summary>
  2611. /// Verifies that the first value is less than the second
  2612. /// value. If it is not, then an
  2613. /// <see cref="AssertionException"/> is thrown.
  2614. /// </summary>
  2615. /// <param name="arg1">The first value, expected to be less</param>
  2616. /// <param name="arg2">The second value, expected to be greater</param>
  2617. /// <param name="message">The message to display in case of failure</param>
  2618. [CLSCompliant(false)]
  2619. public static void Less(ulong arg1, ulong arg2, string message)
  2620. {
  2621. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2622. }
  2623. /// <summary>
  2624. /// Verifies that the first value is less than the second
  2625. /// value. If it is not, then an
  2626. /// <see cref="AssertionException"/> is thrown.
  2627. /// </summary>
  2628. /// <param name="arg1">The first value, expected to be less</param>
  2629. /// <param name="arg2">The second value, expected to be greater</param>
  2630. [CLSCompliant(false)]
  2631. public static void Less(ulong arg1, ulong arg2)
  2632. {
  2633. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2634. }
  2635. /// <summary>
  2636. /// Verifies that the first value is less than the second
  2637. /// value. If it is not, then an
  2638. /// <see cref="AssertionException"/> is thrown.
  2639. /// </summary>
  2640. /// <param name="arg1">The first value, expected to be less</param>
  2641. /// <param name="arg2">The second value, expected to be greater</param>
  2642. /// <param name="message">The message to display in case of failure</param>
  2643. /// <param name="args">Array of objects to be used in formatting the message</param>
  2644. public static void Less(decimal arg1, decimal arg2, string message, params object[] args)
  2645. {
  2646. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2647. }
  2648. /// <summary>
  2649. /// Verifies that the first value is less than the second
  2650. /// value. If it is not, then an
  2651. /// <see cref="AssertionException"/> is thrown.
  2652. /// </summary>
  2653. /// <param name="arg1">The first value, expected to be less</param>
  2654. /// <param name="arg2">The second value, expected to be greater</param>
  2655. /// <param name="message">The message to display in case of failure</param>
  2656. public static void Less(decimal arg1, decimal arg2, string message)
  2657. {
  2658. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2659. }
  2660. /// <summary>
  2661. /// Verifies that the first value is less than the second
  2662. /// value. If it is not, then an
  2663. /// <see cref="AssertionException"/> is thrown.
  2664. /// </summary>
  2665. /// <param name="arg1">The first value, expected to be less</param>
  2666. /// <param name="arg2">The second value, expected to be greater</param>
  2667. public static void Less(decimal arg1, decimal arg2)
  2668. {
  2669. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2670. }
  2671. /// <summary>
  2672. /// Verifies that the first value is less than the second
  2673. /// value. If it is not, then an
  2674. /// <see cref="AssertionException"/> is thrown.
  2675. /// </summary>
  2676. /// <param name="arg1">The first value, expected to be less</param>
  2677. /// <param name="arg2">The second value, expected to be greater</param>
  2678. /// <param name="message">The message to display in case of failure</param>
  2679. /// <param name="args">Array of objects to be used in formatting the message</param>
  2680. public static void Less(double arg1, double arg2, string message, params object[] args)
  2681. {
  2682. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2683. }
  2684. /// <summary>
  2685. /// Verifies that the first value is less than the second
  2686. /// value. If it is not, then an
  2687. /// <see cref="AssertionException"/> is thrown.
  2688. /// </summary>
  2689. /// <param name="arg1">The first value, expected to be less</param>
  2690. /// <param name="arg2">The second value, expected to be greater</param>
  2691. /// <param name="message">The message to display in case of failure</param>
  2692. public static void Less(double arg1, double arg2, string message)
  2693. {
  2694. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2695. }
  2696. /// <summary>
  2697. /// Verifies that the first value is less than the second
  2698. /// value. If it is not, then an
  2699. /// <see cref="AssertionException"/> is thrown.
  2700. /// </summary>
  2701. /// <param name="arg1">The first value, expected to be less</param>
  2702. /// <param name="arg2">The second value, expected to be greater</param>
  2703. public static void Less(double arg1, double arg2)
  2704. {
  2705. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2706. }
  2707. /// <summary>
  2708. /// Verifies that the first value is less than the second
  2709. /// value. If it is not, then an
  2710. /// <see cref="AssertionException"/> is thrown.
  2711. /// </summary>
  2712. /// <param name="arg1">The first value, expected to be less</param>
  2713. /// <param name="arg2">The second value, expected to be greater</param>
  2714. /// <param name="message">The message to display in case of failure</param>
  2715. /// <param name="args">Array of objects to be used in formatting the message</param>
  2716. public static void Less(float arg1, float arg2, string message, params object[] args)
  2717. {
  2718. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2719. }
  2720. /// <summary>
  2721. /// Verifies that the first value is less than the second
  2722. /// value. If it is not, then an
  2723. /// <see cref="AssertionException"/> is thrown.
  2724. /// </summary>
  2725. /// <param name="arg1">The first value, expected to be less</param>
  2726. /// <param name="arg2">The second value, expected to be greater</param>
  2727. /// <param name="message">The message to display in case of failure</param>
  2728. public static void Less(float arg1, float arg2, string message)
  2729. {
  2730. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2731. }
  2732. /// <summary>
  2733. /// Verifies that the first value is less than the second
  2734. /// value. If it is not, then an
  2735. /// <see cref="AssertionException"/> is thrown.
  2736. /// </summary>
  2737. /// <param name="arg1">The first value, expected to be less</param>
  2738. /// <param name="arg2">The second value, expected to be greater</param>
  2739. public static void Less(float arg1, float arg2)
  2740. {
  2741. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2742. }
  2743. /// <summary>
  2744. /// Verifies that the first value is less than the second
  2745. /// value. If it is not, then an
  2746. /// <see cref="AssertionException"/> is thrown.
  2747. /// </summary>
  2748. /// <param name="arg1">The first value, expected to be less</param>
  2749. /// <param name="arg2">The second value, expected to be greater</param>
  2750. /// <param name="message">The message to display in case of failure</param>
  2751. /// <param name="args">Array of objects to be used in formatting the message</param>
  2752. public static void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
  2753. {
  2754. Assert.That(arg1, Is.LessThan(arg2), message, args);
  2755. }
  2756. /// <summary>
  2757. /// Verifies that the first value is less than the second
  2758. /// value. If it is not, then an
  2759. /// <see cref="AssertionException"/> is thrown.
  2760. /// </summary>
  2761. /// <param name="arg1">The first value, expected to be less</param>
  2762. /// <param name="arg2">The second value, expected to be greater</param>
  2763. /// <param name="message">The message to display in case of failure</param>
  2764. public static void Less(IComparable arg1, IComparable arg2, string message)
  2765. {
  2766. Assert.That(arg1, Is.LessThan(arg2), message, null);
  2767. }
  2768. /// <summary>
  2769. /// Verifies that the first value is less than the second
  2770. /// value. If it is not, then an
  2771. /// <see cref="AssertionException"/> is thrown.
  2772. /// </summary>
  2773. /// <param name="arg1">The first value, expected to be less</param>
  2774. /// <param name="arg2">The second value, expected to be greater</param>
  2775. public static void Less(IComparable arg1, IComparable arg2)
  2776. {
  2777. Assert.That(arg1, Is.LessThan(arg2), null, null);
  2778. }
  2779. #endregion
  2780. #region GreaterOrEqual
  2781. /// <summary>
  2782. /// Verifies that the first value is greater than or equal tothe second
  2783. /// value. If it is not, then an
  2784. /// <see cref="AssertionException"/> is thrown.
  2785. /// </summary>
  2786. /// <param name="arg1">The first value, expected to be greater</param>
  2787. /// <param name="arg2">The second value, expected to be less</param>
  2788. /// <param name="message">The message to display in case of failure</param>
  2789. /// <param name="args">Array of objects to be used in formatting the message</param>
  2790. public static void GreaterOrEqual(int arg1, int arg2, string message, params object[] args)
  2791. {
  2792. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2793. }
  2794. /// <summary>
  2795. /// Verifies that the first value is greater than or equal tothe second
  2796. /// value. If it is not, then an
  2797. /// <see cref="AssertionException"/> is thrown.
  2798. /// </summary>
  2799. /// <param name="arg1">The first value, expected to be greater</param>
  2800. /// <param name="arg2">The second value, expected to be less</param>
  2801. /// <param name="message">The message to display in case of failure</param>
  2802. public static void GreaterOrEqual(int arg1, int arg2, string message)
  2803. {
  2804. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  2805. }
  2806. /// <summary>
  2807. /// Verifies that the first value is greater than or equal tothe second
  2808. /// value. If it is not, then an
  2809. /// <see cref="AssertionException"/> is thrown.
  2810. /// </summary>
  2811. /// <param name="arg1">The first value, expected to be greater</param>
  2812. /// <param name="arg2">The second value, expected to be less</param>
  2813. public static void GreaterOrEqual(int arg1, int arg2)
  2814. {
  2815. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  2816. }
  2817. /// <summary>
  2818. /// Verifies that the first value is greater than or equal tothe second
  2819. /// value. If it is not, then an
  2820. /// <see cref="AssertionException"/> is thrown.
  2821. /// </summary>
  2822. /// <param name="arg1">The first value, expected to be greater</param>
  2823. /// <param name="arg2">The second value, expected to be less</param>
  2824. /// <param name="message">The message to display in case of failure</param>
  2825. /// <param name="args">Array of objects to be used in formatting the message</param>
  2826. [CLSCompliant(false)]
  2827. public static void GreaterOrEqual(uint arg1, uint arg2, string message, params object[] args)
  2828. {
  2829. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2830. }
  2831. /// <summary>
  2832. /// Verifies that the first value is greater than or equal tothe second
  2833. /// value. If it is not, then an
  2834. /// <see cref="AssertionException"/> is thrown.
  2835. /// </summary>
  2836. /// <param name="arg1">The first value, expected to be greater</param>
  2837. /// <param name="arg2">The second value, expected to be less</param>
  2838. /// <param name="message">The message to display in case of failure</param>
  2839. [CLSCompliant(false)]
  2840. public static void GreaterOrEqual(uint arg1, uint arg2, string message)
  2841. {
  2842. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  2843. }
  2844. /// <summary>
  2845. /// Verifies that the first value is greater than or equal tothe second
  2846. /// value. If it is not, then an
  2847. /// <see cref="AssertionException"/> is thrown.
  2848. /// </summary>
  2849. /// <param name="arg1">The first value, expected to be greater</param>
  2850. /// <param name="arg2">The second value, expected to be less</param>
  2851. [CLSCompliant(false)]
  2852. public static void GreaterOrEqual(uint arg1, uint arg2)
  2853. {
  2854. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  2855. }
  2856. /// <summary>
  2857. /// Verifies that the first value is greater than or equal tothe second
  2858. /// value. If it is not, then an
  2859. /// <see cref="AssertionException"/> is thrown.
  2860. /// </summary>
  2861. /// <param name="arg1">The first value, expected to be greater</param>
  2862. /// <param name="arg2">The second value, expected to be less</param>
  2863. /// <param name="message">The message to display in case of failure</param>
  2864. /// <param name="args">Array of objects to be used in formatting the message</param>
  2865. public static void GreaterOrEqual(long arg1, long arg2, string message, params object[] args)
  2866. {
  2867. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2868. }
  2869. /// <summary>
  2870. /// Verifies that the first value is greater than or equal tothe second
  2871. /// value. If it is not, then an
  2872. /// <see cref="AssertionException"/> is thrown.
  2873. /// </summary>
  2874. /// <param name="arg1">The first value, expected to be greater</param>
  2875. /// <param name="arg2">The second value, expected to be less</param>
  2876. /// <param name="message">The message to display in case of failure</param>
  2877. public static void GreaterOrEqual(long arg1, long arg2, string message)
  2878. {
  2879. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  2880. }
  2881. /// <summary>
  2882. /// Verifies that the first value is greater than or equal tothe second
  2883. /// value. If it is not, then an
  2884. /// <see cref="AssertionException"/> is thrown.
  2885. /// </summary>
  2886. /// <param name="arg1">The first value, expected to be greater</param>
  2887. /// <param name="arg2">The second value, expected to be less</param>
  2888. public static void GreaterOrEqual(long arg1, long arg2)
  2889. {
  2890. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  2891. }
  2892. /// <summary>
  2893. /// Verifies that the first value is greater than or equal tothe second
  2894. /// value. If it is not, then an
  2895. /// <see cref="AssertionException"/> is thrown.
  2896. /// </summary>
  2897. /// <param name="arg1">The first value, expected to be greater</param>
  2898. /// <param name="arg2">The second value, expected to be less</param>
  2899. /// <param name="message">The message to display in case of failure</param>
  2900. /// <param name="args">Array of objects to be used in formatting the message</param>
  2901. [CLSCompliant(false)]
  2902. public static void GreaterOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
  2903. {
  2904. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2905. }
  2906. /// <summary>
  2907. /// Verifies that the first value is greater than or equal tothe second
  2908. /// value. If it is not, then an
  2909. /// <see cref="AssertionException"/> is thrown.
  2910. /// </summary>
  2911. /// <param name="arg1">The first value, expected to be greater</param>
  2912. /// <param name="arg2">The second value, expected to be less</param>
  2913. /// <param name="message">The message to display in case of failure</param>
  2914. [CLSCompliant(false)]
  2915. public static void GreaterOrEqual(ulong arg1, ulong arg2, string message)
  2916. {
  2917. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  2918. }
  2919. /// <summary>
  2920. /// Verifies that the first value is greater than or equal tothe second
  2921. /// value. If it is not, then an
  2922. /// <see cref="AssertionException"/> is thrown.
  2923. /// </summary>
  2924. /// <param name="arg1">The first value, expected to be greater</param>
  2925. /// <param name="arg2">The second value, expected to be less</param>
  2926. [CLSCompliant(false)]
  2927. public static void GreaterOrEqual(ulong arg1, ulong arg2)
  2928. {
  2929. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  2930. }
  2931. /// <summary>
  2932. /// Verifies that the first value is greater than or equal tothe second
  2933. /// value. If it is not, then an
  2934. /// <see cref="AssertionException"/> is thrown.
  2935. /// </summary>
  2936. /// <param name="arg1">The first value, expected to be greater</param>
  2937. /// <param name="arg2">The second value, expected to be less</param>
  2938. /// <param name="message">The message to display in case of failure</param>
  2939. /// <param name="args">Array of objects to be used in formatting the message</param>
  2940. public static void GreaterOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
  2941. {
  2942. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2943. }
  2944. /// <summary>
  2945. /// Verifies that the first value is greater than or equal tothe second
  2946. /// value. If it is not, then an
  2947. /// <see cref="AssertionException"/> is thrown.
  2948. /// </summary>
  2949. /// <param name="arg1">The first value, expected to be greater</param>
  2950. /// <param name="arg2">The second value, expected to be less</param>
  2951. /// <param name="message">The message to display in case of failure</param>
  2952. public static void GreaterOrEqual(decimal arg1, decimal arg2, string message)
  2953. {
  2954. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  2955. }
  2956. /// <summary>
  2957. /// Verifies that the first value is greater than or equal tothe second
  2958. /// value. If it is not, then an
  2959. /// <see cref="AssertionException"/> is thrown.
  2960. /// </summary>
  2961. /// <param name="arg1">The first value, expected to be greater</param>
  2962. /// <param name="arg2">The second value, expected to be less</param>
  2963. public static void GreaterOrEqual(decimal arg1, decimal arg2)
  2964. {
  2965. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  2966. }
  2967. /// <summary>
  2968. /// Verifies that the first value is greater than or equal tothe second
  2969. /// value. If it is not, then an
  2970. /// <see cref="AssertionException"/> is thrown.
  2971. /// </summary>
  2972. /// <param name="arg1">The first value, expected to be greater</param>
  2973. /// <param name="arg2">The second value, expected to be less</param>
  2974. /// <param name="message">The message to display in case of failure</param>
  2975. /// <param name="args">Array of objects to be used in formatting the message</param>
  2976. public static void GreaterOrEqual(double arg1, double arg2, string message, params object[] args)
  2977. {
  2978. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2979. }
  2980. /// <summary>
  2981. /// Verifies that the first value is greater than or equal tothe second
  2982. /// value. If it is not, then an
  2983. /// <see cref="AssertionException"/> is thrown.
  2984. /// </summary>
  2985. /// <param name="arg1">The first value, expected to be greater</param>
  2986. /// <param name="arg2">The second value, expected to be less</param>
  2987. /// <param name="message">The message to display in case of failure</param>
  2988. public static void GreaterOrEqual(double arg1, double arg2, string message)
  2989. {
  2990. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  2991. }
  2992. /// <summary>
  2993. /// Verifies that the first value is greater than or equal tothe second
  2994. /// value. If it is not, then an
  2995. /// <see cref="AssertionException"/> is thrown.
  2996. /// </summary>
  2997. /// <param name="arg1">The first value, expected to be greater</param>
  2998. /// <param name="arg2">The second value, expected to be less</param>
  2999. public static void GreaterOrEqual(double arg1, double arg2)
  3000. {
  3001. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  3002. }
  3003. /// <summary>
  3004. /// Verifies that the first value is greater than or equal tothe second
  3005. /// value. If it is not, then an
  3006. /// <see cref="AssertionException"/> is thrown.
  3007. /// </summary>
  3008. /// <param name="arg1">The first value, expected to be greater</param>
  3009. /// <param name="arg2">The second value, expected to be less</param>
  3010. /// <param name="message">The message to display in case of failure</param>
  3011. /// <param name="args">Array of objects to be used in formatting the message</param>
  3012. public static void GreaterOrEqual(float arg1, float arg2, string message, params object[] args)
  3013. {
  3014. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  3015. }
  3016. /// <summary>
  3017. /// Verifies that the first value is greater than or equal tothe second
  3018. /// value. If it is not, then an
  3019. /// <see cref="AssertionException"/> is thrown.
  3020. /// </summary>
  3021. /// <param name="arg1">The first value, expected to be greater</param>
  3022. /// <param name="arg2">The second value, expected to be less</param>
  3023. /// <param name="message">The message to display in case of failure</param>
  3024. public static void GreaterOrEqual(float arg1, float arg2, string message)
  3025. {
  3026. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  3027. }
  3028. /// <summary>
  3029. /// Verifies that the first value is greater than or equal tothe second
  3030. /// value. If it is not, then an
  3031. /// <see cref="AssertionException"/> is thrown.
  3032. /// </summary>
  3033. /// <param name="arg1">The first value, expected to be greater</param>
  3034. /// <param name="arg2">The second value, expected to be less</param>
  3035. public static void GreaterOrEqual(float arg1, float arg2)
  3036. {
  3037. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  3038. }
  3039. /// <summary>
  3040. /// Verifies that the first value is greater than or equal tothe second
  3041. /// value. If it is not, then an
  3042. /// <see cref="AssertionException"/> is thrown.
  3043. /// </summary>
  3044. /// <param name="arg1">The first value, expected to be greater</param>
  3045. /// <param name="arg2">The second value, expected to be less</param>
  3046. /// <param name="message">The message to display in case of failure</param>
  3047. /// <param name="args">Array of objects to be used in formatting the message</param>
  3048. public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
  3049. {
  3050. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  3051. }
  3052. /// <summary>
  3053. /// Verifies that the first value is greater than or equal tothe second
  3054. /// value. If it is not, then an
  3055. /// <see cref="AssertionException"/> is thrown.
  3056. /// </summary>
  3057. /// <param name="arg1">The first value, expected to be greater</param>
  3058. /// <param name="arg2">The second value, expected to be less</param>
  3059. /// <param name="message">The message to display in case of failure</param>
  3060. public static void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
  3061. {
  3062. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, null);
  3063. }
  3064. /// <summary>
  3065. /// Verifies that the first value is greater than or equal tothe second
  3066. /// value. If it is not, then an
  3067. /// <see cref="AssertionException"/> is thrown.
  3068. /// </summary>
  3069. /// <param name="arg1">The first value, expected to be greater</param>
  3070. /// <param name="arg2">The second value, expected to be less</param>
  3071. public static void GreaterOrEqual(IComparable arg1, IComparable arg2)
  3072. {
  3073. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), null, null);
  3074. }
  3075. #endregion
  3076. #region LessOrEqual
  3077. /// <summary>
  3078. /// Verifies that the first value is less than or equal to the second
  3079. /// value. If it is not, then an
  3080. /// <see cref="AssertionException"/> is thrown.
  3081. /// </summary>
  3082. /// <param name="arg1">The first value, expected to be less</param>
  3083. /// <param name="arg2">The second value, expected to be greater</param>
  3084. /// <param name="message">The message to display in case of failure</param>
  3085. /// <param name="args">Array of objects to be used in formatting the message</param>
  3086. public static void LessOrEqual(int arg1, int arg2, string message, params object[] args)
  3087. {
  3088. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3089. }
  3090. /// <summary>
  3091. /// Verifies that the first value is less than or equal to the second
  3092. /// value. If it is not, then an
  3093. /// <see cref="AssertionException"/> is thrown.
  3094. /// </summary>
  3095. /// <param name="arg1">The first value, expected to be less</param>
  3096. /// <param name="arg2">The second value, expected to be greater</param>
  3097. /// <param name="message">The message to display in case of failure</param>
  3098. public static void LessOrEqual(int arg1, int arg2, string message)
  3099. {
  3100. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3101. }
  3102. /// <summary>
  3103. /// Verifies that the first value is less than or equal to the second
  3104. /// value. If it is not, then an
  3105. /// <see cref="AssertionException"/> is thrown.
  3106. /// </summary>
  3107. /// <param name="arg1">The first value, expected to be less</param>
  3108. /// <param name="arg2">The second value, expected to be greater</param>
  3109. public static void LessOrEqual(int arg1, int arg2)
  3110. {
  3111. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3112. }
  3113. /// <summary>
  3114. /// Verifies that the first value is less than or equal to the second
  3115. /// value. If it is not, then an
  3116. /// <see cref="AssertionException"/> is thrown.
  3117. /// </summary>
  3118. /// <param name="arg1">The first value, expected to be less</param>
  3119. /// <param name="arg2">The second value, expected to be greater</param>
  3120. /// <param name="message">The message to display in case of failure</param>
  3121. /// <param name="args">Array of objects to be used in formatting the message</param>
  3122. [CLSCompliant(false)]
  3123. public static void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
  3124. {
  3125. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3126. }
  3127. /// <summary>
  3128. /// Verifies that the first value is less than or equal to the second
  3129. /// value. If it is not, then an
  3130. /// <see cref="AssertionException"/> is thrown.
  3131. /// </summary>
  3132. /// <param name="arg1">The first value, expected to be less</param>
  3133. /// <param name="arg2">The second value, expected to be greater</param>
  3134. /// <param name="message">The message to display in case of failure</param>
  3135. [CLSCompliant(false)]
  3136. public static void LessOrEqual(uint arg1, uint arg2, string message)
  3137. {
  3138. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3139. }
  3140. /// <summary>
  3141. /// Verifies that the first value is less than or equal to the second
  3142. /// value. If it is not, then an
  3143. /// <see cref="AssertionException"/> is thrown.
  3144. /// </summary>
  3145. /// <param name="arg1">The first value, expected to be less</param>
  3146. /// <param name="arg2">The second value, expected to be greater</param>
  3147. [CLSCompliant(false)]
  3148. public static void LessOrEqual(uint arg1, uint arg2)
  3149. {
  3150. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3151. }
  3152. /// <summary>
  3153. /// Verifies that the first value is less than or equal to the second
  3154. /// value. If it is not, then an
  3155. /// <see cref="AssertionException"/> is thrown.
  3156. /// </summary>
  3157. /// <param name="arg1">The first value, expected to be less</param>
  3158. /// <param name="arg2">The second value, expected to be greater</param>
  3159. /// <param name="message">The message to display in case of failure</param>
  3160. /// <param name="args">Array of objects to be used in formatting the message</param>
  3161. public static void LessOrEqual(long arg1, long arg2, string message, params object[] args)
  3162. {
  3163. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3164. }
  3165. /// <summary>
  3166. /// Verifies that the first value is less than or equal to the second
  3167. /// value. If it is not, then an
  3168. /// <see cref="AssertionException"/> is thrown.
  3169. /// </summary>
  3170. /// <param name="arg1">The first value, expected to be less</param>
  3171. /// <param name="arg2">The second value, expected to be greater</param>
  3172. /// <param name="message">The message to display in case of failure</param>
  3173. public static void LessOrEqual(long arg1, long arg2, string message)
  3174. {
  3175. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3176. }
  3177. /// <summary>
  3178. /// Verifies that the first value is less than or equal to the second
  3179. /// value. If it is not, then an
  3180. /// <see cref="AssertionException"/> is thrown.
  3181. /// </summary>
  3182. /// <param name="arg1">The first value, expected to be less</param>
  3183. /// <param name="arg2">The second value, expected to be greater</param>
  3184. public static void LessOrEqual(long arg1, long arg2)
  3185. {
  3186. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3187. }
  3188. /// <summary>
  3189. /// Verifies that the first value is less than or equal to the second
  3190. /// value. If it is not, then an
  3191. /// <see cref="AssertionException"/> is thrown.
  3192. /// </summary>
  3193. /// <param name="arg1">The first value, expected to be less</param>
  3194. /// <param name="arg2">The second value, expected to be greater</param>
  3195. /// <param name="message">The message to display in case of failure</param>
  3196. /// <param name="args">Array of objects to be used in formatting the message</param>
  3197. [CLSCompliant(false)]
  3198. public static void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
  3199. {
  3200. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3201. }
  3202. /// <summary>
  3203. /// Verifies that the first value is less than or equal to the second
  3204. /// value. If it is not, then an
  3205. /// <see cref="AssertionException"/> is thrown.
  3206. /// </summary>
  3207. /// <param name="arg1">The first value, expected to be less</param>
  3208. /// <param name="arg2">The second value, expected to be greater</param>
  3209. /// <param name="message">The message to display in case of failure</param>
  3210. [CLSCompliant(false)]
  3211. public static void LessOrEqual(ulong arg1, ulong arg2, string message)
  3212. {
  3213. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3214. }
  3215. /// <summary>
  3216. /// Verifies that the first value is less than or equal to the second
  3217. /// value. If it is not, then an
  3218. /// <see cref="AssertionException"/> is thrown.
  3219. /// </summary>
  3220. /// <param name="arg1">The first value, expected to be less</param>
  3221. /// <param name="arg2">The second value, expected to be greater</param>
  3222. [CLSCompliant(false)]
  3223. public static void LessOrEqual(ulong arg1, ulong arg2)
  3224. {
  3225. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3226. }
  3227. /// <summary>
  3228. /// Verifies that the first value is less than or equal to the second
  3229. /// value. If it is not, then an
  3230. /// <see cref="AssertionException"/> is thrown.
  3231. /// </summary>
  3232. /// <param name="arg1">The first value, expected to be less</param>
  3233. /// <param name="arg2">The second value, expected to be greater</param>
  3234. /// <param name="message">The message to display in case of failure</param>
  3235. /// <param name="args">Array of objects to be used in formatting the message</param>
  3236. public static void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
  3237. {
  3238. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3239. }
  3240. /// <summary>
  3241. /// Verifies that the first value is less than or equal to the second
  3242. /// value. If it is not, then an
  3243. /// <see cref="AssertionException"/> is thrown.
  3244. /// </summary>
  3245. /// <param name="arg1">The first value, expected to be less</param>
  3246. /// <param name="arg2">The second value, expected to be greater</param>
  3247. /// <param name="message">The message to display in case of failure</param>
  3248. public static void LessOrEqual(decimal arg1, decimal arg2, string message)
  3249. {
  3250. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3251. }
  3252. /// <summary>
  3253. /// Verifies that the first value is less than or equal to the second
  3254. /// value. If it is not, then an
  3255. /// <see cref="AssertionException"/> is thrown.
  3256. /// </summary>
  3257. /// <param name="arg1">The first value, expected to be less</param>
  3258. /// <param name="arg2">The second value, expected to be greater</param>
  3259. public static void LessOrEqual(decimal arg1, decimal arg2)
  3260. {
  3261. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3262. }
  3263. /// <summary>
  3264. /// Verifies that the first value is less than or equal to the second
  3265. /// value. If it is not, then an
  3266. /// <see cref="AssertionException"/> is thrown.
  3267. /// </summary>
  3268. /// <param name="arg1">The first value, expected to be less</param>
  3269. /// <param name="arg2">The second value, expected to be greater</param>
  3270. /// <param name="message">The message to display in case of failure</param>
  3271. /// <param name="args">Array of objects to be used in formatting the message</param>
  3272. public static void LessOrEqual(double arg1, double arg2, string message, params object[] args)
  3273. {
  3274. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3275. }
  3276. /// <summary>
  3277. /// Verifies that the first value is less than or equal to the second
  3278. /// value. If it is not, then an
  3279. /// <see cref="AssertionException"/> is thrown.
  3280. /// </summary>
  3281. /// <param name="arg1">The first value, expected to be less</param>
  3282. /// <param name="arg2">The second value, expected to be greater</param>
  3283. /// <param name="message">The message to display in case of failure</param>
  3284. public static void LessOrEqual(double arg1, double arg2, string message)
  3285. {
  3286. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3287. }
  3288. /// <summary>
  3289. /// Verifies that the first value is less than or equal to the second
  3290. /// value. If it is not, then an
  3291. /// <see cref="AssertionException"/> is thrown.
  3292. /// </summary>
  3293. /// <param name="arg1">The first value, expected to be less</param>
  3294. /// <param name="arg2">The second value, expected to be greater</param>
  3295. public static void LessOrEqual(double arg1, double arg2)
  3296. {
  3297. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3298. }
  3299. /// <summary>
  3300. /// Verifies that the first value is less than or equal to the second
  3301. /// value. If it is not, then an
  3302. /// <see cref="AssertionException"/> is thrown.
  3303. /// </summary>
  3304. /// <param name="arg1">The first value, expected to be less</param>
  3305. /// <param name="arg2">The second value, expected to be greater</param>
  3306. /// <param name="message">The message to display in case of failure</param>
  3307. /// <param name="args">Array of objects to be used in formatting the message</param>
  3308. public static void LessOrEqual(float arg1, float arg2, string message, params object[] args)
  3309. {
  3310. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3311. }
  3312. /// <summary>
  3313. /// Verifies that the first value is less than or equal to the second
  3314. /// value. If it is not, then an
  3315. /// <see cref="AssertionException"/> is thrown.
  3316. /// </summary>
  3317. /// <param name="arg1">The first value, expected to be less</param>
  3318. /// <param name="arg2">The second value, expected to be greater</param>
  3319. /// <param name="message">The message to display in case of failure</param>
  3320. public static void LessOrEqual(float arg1, float arg2, string message)
  3321. {
  3322. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3323. }
  3324. /// <summary>
  3325. /// Verifies that the first value is less than or equal to the second
  3326. /// value. If it is not, then an
  3327. /// <see cref="AssertionException"/> is thrown.
  3328. /// </summary>
  3329. /// <param name="arg1">The first value, expected to be less</param>
  3330. /// <param name="arg2">The second value, expected to be greater</param>
  3331. public static void LessOrEqual(float arg1, float arg2)
  3332. {
  3333. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3334. }
  3335. /// <summary>
  3336. /// Verifies that the first value is less than or equal to the second
  3337. /// value. If it is not, then an
  3338. /// <see cref="AssertionException"/> is thrown.
  3339. /// </summary>
  3340. /// <param name="arg1">The first value, expected to be less</param>
  3341. /// <param name="arg2">The second value, expected to be greater</param>
  3342. /// <param name="message">The message to display in case of failure</param>
  3343. /// <param name="args">Array of objects to be used in formatting the message</param>
  3344. public static void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
  3345. {
  3346. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  3347. }
  3348. /// <summary>
  3349. /// Verifies that the first value is less than or equal to the second
  3350. /// value. If it is not, then an
  3351. /// <see cref="AssertionException"/> is thrown.
  3352. /// </summary>
  3353. /// <param name="arg1">The first value, expected to be less</param>
  3354. /// <param name="arg2">The second value, expected to be greater</param>
  3355. /// <param name="message">The message to display in case of failure</param>
  3356. public static void LessOrEqual(IComparable arg1, IComparable arg2, string message)
  3357. {
  3358. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, null);
  3359. }
  3360. /// <summary>
  3361. /// Verifies that the first value is less than or equal to the second
  3362. /// value. If it is not, then an
  3363. /// <see cref="AssertionException"/> is thrown.
  3364. /// </summary>
  3365. /// <param name="arg1">The first value, expected to be less</param>
  3366. /// <param name="arg2">The second value, expected to be greater</param>
  3367. public static void LessOrEqual(IComparable arg1, IComparable arg2)
  3368. {
  3369. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), null, null);
  3370. }
  3371. #endregion
  3372. #region Contains
  3373. /// <summary>
  3374. /// Asserts that an object is contained in a list.
  3375. /// </summary>
  3376. /// <param name="expected">The expected object</param>
  3377. /// <param name="actual">The list to be examined</param>
  3378. /// <param name="message">The message to display in case of failure</param>
  3379. /// <param name="args">Array of objects to be used in formatting the message</param>
  3380. public static void Contains(object expected, ICollection actual, string message, params object[] args)
  3381. {
  3382. Assert.That(actual, new CollectionContainsConstraint(expected), message, args);
  3383. }
  3384. /// <summary>
  3385. /// Asserts that an object is contained in a list.
  3386. /// </summary>
  3387. /// <param name="expected">The expected object</param>
  3388. /// <param name="actual">The list to be examined</param>
  3389. /// <param name="message">The message to display in case of failure</param>
  3390. public static void Contains(object expected, ICollection actual, string message)
  3391. {
  3392. Assert.That(actual, new CollectionContainsConstraint(expected), message, null);
  3393. }
  3394. /// <summary>
  3395. /// Asserts that an object is contained in a list.
  3396. /// </summary>
  3397. /// <param name="expected">The expected object</param>
  3398. /// <param name="actual">The list to be examined</param>
  3399. public static void Contains(object expected, ICollection actual)
  3400. {
  3401. Assert.That(actual, new CollectionContainsConstraint(expected), null, null);
  3402. }
  3403. #endregion
  3404. }
  3405. }