PageRenderTime 72ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 1ms

/mcs/nunit24/NUnitFramework/framework/Assert.cs

https://bitbucket.org/danipen/mono
C# | 2960 lines | 1089 code | 336 blank | 1535 comment | 18 complexity | 01cd3f36079a3016a3c659bc301d7ad6 MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. // ****************************************************************
  2. // This is free software licensed under the NUnit license. You
  3. // may obtain a copy of the license as well as information regarding
  4. // copyright ownership at http://nunit.org/?p=license&r=2.4.
  5. // ****************************************************************
  6. using System;
  7. using System.Collections;
  8. using System.ComponentModel;
  9. using NUnit.Framework.Constraints;
  10. using NUnit.Framework.SyntaxHelpers;
  11. namespace NUnit.Framework
  12. {
  13. /// <summary>
  14. /// The Assert class contains a collection of static methods that
  15. /// implement the most common assertions used in NUnit.
  16. /// </summary>
  17. public class Assert
  18. {
  19. #region Assert Counting
  20. private static int counter = 0;
  21. /// <summary>
  22. /// Gets the number of assertions executed so far and
  23. /// resets the counter to zero.
  24. /// </summary>
  25. public static int Counter
  26. {
  27. get
  28. {
  29. int cnt = counter;
  30. counter = 0;
  31. return cnt;
  32. }
  33. }
  34. private static void IncrementAssertCount()
  35. {
  36. ++counter;
  37. }
  38. #endregion
  39. #region Constructor
  40. /// <summary>
  41. /// We don't actually want any instances of this object, but some people
  42. /// like to inherit from it to add other static methods. Hence, the
  43. /// protected constructor disallows any instances of this object.
  44. /// </summary>
  45. protected Assert() {}
  46. #endregion
  47. #region Equals and ReferenceEquals
  48. /// <summary>
  49. /// The Equals method throws an AssertionException. This is done
  50. /// to make sure there is no mistake by calling this function.
  51. /// </summary>
  52. /// <param name="a"></param>
  53. /// <param name="b"></param>
  54. [EditorBrowsable(EditorBrowsableState.Never)]
  55. public static new bool Equals(object a, object b)
  56. {
  57. throw new AssertionException("Assert.Equals should not be used for Assertions");
  58. }
  59. /// <summary>
  60. /// override the default ReferenceEquals to throw an AssertionException. This
  61. /// implementation makes sure there is no mistake in calling this function
  62. /// as part of Assert.
  63. /// </summary>
  64. /// <param name="a"></param>
  65. /// <param name="b"></param>
  66. public static new void ReferenceEquals(object a, object b)
  67. {
  68. throw new AssertionException("Assert.ReferenceEquals should not be used for Assertions");
  69. }
  70. #endregion
  71. #region IsTrue
  72. /// <summary>
  73. /// Asserts that a condition is true. If the condition is false the method throws
  74. /// an <see cref="AssertionException"/>.
  75. /// </summary>
  76. /// <param name="condition">The evaluated condition</param>
  77. /// <param name="message">The message to display if the condition is false</param>
  78. /// <param name="args">Arguments to be used in formatting the message</param>
  79. static public void IsTrue(bool condition, string message, params object[] args)
  80. {
  81. Assert.That(condition, Is.True, message, args);
  82. }
  83. /// <summary>
  84. /// Asserts that a condition is true. If the condition is false the method throws
  85. /// an <see cref="AssertionException"/>.
  86. /// </summary>
  87. /// <param name="condition">The evaluated condition</param>
  88. /// <param name="message">The message to display if the condition is false</param>
  89. static public void IsTrue(bool condition, string message)
  90. {
  91. Assert.IsTrue(condition, message, null);
  92. }
  93. /// <summary>
  94. /// Asserts that a condition is true. If the condition is false the method throws
  95. /// an <see cref="AssertionException"/>.
  96. /// </summary>
  97. /// <param name="condition">The evaluated condition</param>
  98. static public void IsTrue(bool condition)
  99. {
  100. Assert.IsTrue(condition, null, null);
  101. }
  102. #endregion
  103. #region IsFalse
  104. /// <summary>
  105. /// Asserts that a condition is false. If the condition is true the method throws
  106. /// an <see cref="AssertionException"/>.
  107. /// </summary>
  108. /// <param name="condition">The evaluated condition</param>
  109. /// <param name="message">The message to display if the condition is true</param>
  110. /// <param name="args">Arguments to be used in formatting the message</param>
  111. static public void IsFalse(bool condition, string message, params object[] args)
  112. {
  113. Assert.That(condition, Is.False, message, args);
  114. }
  115. /// <summary>
  116. /// Asserts that a condition is false. If the condition is true the method throws
  117. /// an <see cref="AssertionException"/>.
  118. /// </summary>
  119. /// <param name="condition">The evaluated condition</param>
  120. /// <param name="message">The message to display if the condition is true</param>
  121. static public void IsFalse(bool condition, string message)
  122. {
  123. Assert.IsFalse( condition, message, null );
  124. }
  125. /// <summary>
  126. /// Asserts that a condition is false. If the condition is true the method throws
  127. /// an <see cref="AssertionException"/>.
  128. /// </summary>
  129. /// <param name="condition">The evaluated condition</param>
  130. static public void IsFalse(bool condition)
  131. {
  132. Assert.IsFalse(condition, string.Empty, null);
  133. }
  134. #endregion
  135. #region IsNotNull
  136. /// <summary>
  137. /// Verifies that the object that is passed in is not equal to <code>null</code>
  138. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  139. /// is thrown.
  140. /// </summary>
  141. /// <param name="anObject">The object that is to be tested</param>
  142. /// <param name="message">The message to be displayed when the object is null</param>
  143. /// <param name="args">Arguments to be used in formatting the message</param>
  144. static public void IsNotNull(Object anObject, string message, params object[] args)
  145. {
  146. Assert.That(anObject, Is.Not.Null, message, args);
  147. }
  148. /// <summary>
  149. /// Verifies that the object that is passed in is not equal to <code>null</code>
  150. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  151. /// is thrown.
  152. /// </summary>
  153. /// <param name="anObject">The object that is to be tested</param>
  154. /// <param name="message">The message to be displayed when the object is null</param>
  155. static public void IsNotNull(Object anObject, string message)
  156. {
  157. Assert.IsNotNull(anObject, message, null);
  158. }
  159. /// <summary>
  160. /// Verifies that the object that is passed in is not equal to <code>null</code>
  161. /// If the object is <code>null</code> then an <see cref="AssertionException"/>
  162. /// is thrown.
  163. /// </summary>
  164. /// <param name="anObject">The object that is to be tested</param>
  165. static public void IsNotNull(Object anObject)
  166. {
  167. Assert.IsNotNull(anObject, string.Empty, null);
  168. }
  169. #endregion
  170. #region IsNull
  171. /// <summary>
  172. /// Verifies that the object that is passed in is equal to <code>null</code>
  173. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  174. /// is thrown.
  175. /// </summary>
  176. /// <param name="anObject">The object that is to be tested</param>
  177. /// <param name="message">The message to be displayed when the object is not null</param>
  178. /// <param name="args">Arguments to be used in formatting the message</param>
  179. static public void IsNull(Object anObject, string message, params object[] args)
  180. {
  181. Assert.That( anObject, Is.Null, message, args );
  182. }
  183. /// <summary>
  184. /// Verifies that the object that is passed in is equal to <code>null</code>
  185. /// If the object is not <code>null</code> then an <see cref="AssertionException"/>
  186. /// is thrown.
  187. /// </summary>
  188. /// <param name="anObject">The object that is to be tested</param>
  189. /// <param name="message">The message to be displayed when the object is not null</param>
  190. static public void IsNull(Object anObject, string message)
  191. {
  192. Assert.IsNull(anObject, message, null);
  193. }
  194. /// <summary>
  195. /// Verifies that the object that is passed in is equal to <code>null</code>
  196. /// If the object is not null <code>null</code> then an <see cref="AssertionException"/>
  197. /// is thrown.
  198. /// </summary>
  199. /// <param name="anObject">The object that is to be tested</param>
  200. static public void IsNull(Object anObject)
  201. {
  202. Assert.IsNull(anObject, string.Empty, null);
  203. }
  204. #endregion
  205. #region IsNaN
  206. /// <summary>
  207. /// Verifies that the double is passed is an <code>NaN</code> value.
  208. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  209. /// is thrown.
  210. /// </summary>
  211. /// <param name="aDouble">The value that is to be tested</param>
  212. /// <param name="message">The message to be displayed when the object is not null</param>
  213. /// <param name="args">Arguments to be used in formatting the message</param>
  214. static public void IsNaN(double aDouble, string message, params object[] args)
  215. {
  216. Assert.That(aDouble, Is.NaN, message, args);
  217. }
  218. /// <summary>
  219. /// Verifies that the double is passed is an <code>NaN</code> value.
  220. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  221. /// is thrown.
  222. /// </summary>
  223. /// <param name="aDouble">The object that is to be tested</param>
  224. /// <param name="message">The message to be displayed when the object is not null</param>
  225. static public void IsNaN(double aDouble, string message)
  226. {
  227. Assert.IsNaN(aDouble, message, null);
  228. }
  229. /// <summary>
  230. /// Verifies that the double is passed is an <code>NaN</code> value.
  231. /// If the object is not <code>NaN</code> then an <see cref="AssertionException"/>
  232. /// is thrown.
  233. /// </summary>
  234. /// <param name="aDouble">The object that is to be tested</param>
  235. static public void IsNaN(double aDouble)
  236. {
  237. Assert.IsNaN(aDouble, string.Empty, null);
  238. }
  239. #endregion
  240. #region IsEmpty
  241. /// <summary>
  242. /// Assert that a string is empty - that is equal to string.Empty
  243. /// </summary>
  244. /// <param name="aString">The string to be tested</param>
  245. /// <param name="message">The message to be displayed on failure</param>
  246. /// <param name="args">Arguments to be used in formatting the message</param>
  247. public static void IsEmpty( string aString, string message, params object[] args )
  248. {
  249. Assert.That(aString, new EmptyStringConstraint(), message, args);
  250. }
  251. /// <summary>
  252. /// Assert that a string is empty - that is equal to string.Emtpy
  253. /// </summary>
  254. /// <param name="aString">The string to be tested</param>
  255. /// <param name="message">The message to be displayed on failure</param>
  256. public static void IsEmpty( string aString, string message )
  257. {
  258. IsEmpty( aString, message, null );
  259. }
  260. /// <summary>
  261. /// Assert that a string is empty - that is equal to string.Emtpy
  262. /// </summary>
  263. /// <param name="aString">The string to be tested</param>
  264. public static void IsEmpty( string aString )
  265. {
  266. IsEmpty( aString, string.Empty, null );
  267. }
  268. /// <summary>
  269. /// Assert that an array, list or other collection is empty
  270. /// </summary>
  271. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  272. /// <param name="message">The message to be displayed on failure</param>
  273. /// <param name="args">Arguments to be used in formatting the message</param>
  274. public static void IsEmpty( ICollection collection, string message, params object[] args )
  275. {
  276. Assert.That(collection, new EmptyCollectionConstraint(), message, args);
  277. }
  278. /// <summary>
  279. /// Assert that an array, list or other collection is empty
  280. /// </summary>
  281. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  282. /// <param name="message">The message to be displayed on failure</param>
  283. public static void IsEmpty( ICollection collection, string message )
  284. {
  285. IsEmpty( collection, message, null );
  286. }
  287. /// <summary>
  288. /// Assert that an array,list or other collection is empty
  289. /// </summary>
  290. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  291. public static void IsEmpty( ICollection collection )
  292. {
  293. IsEmpty( collection, string.Empty, null );
  294. }
  295. #endregion
  296. #region IsNotEmpty
  297. /// <summary>
  298. /// Assert that a string is not empty - that is not equal to string.Empty
  299. /// </summary>
  300. /// <param name="aString">The string to be tested</param>
  301. /// <param name="message">The message to be displayed on failure</param>
  302. /// <param name="args">Arguments to be used in formatting the message</param>
  303. public static void IsNotEmpty( string aString, string message, params object[] args )
  304. {
  305. Assert.That(aString, Is.Not.Empty, message, args);
  306. }
  307. /// <summary>
  308. /// Assert that a string is empty - that is equal to string.Emtpy
  309. /// </summary>
  310. /// <param name="aString">The string to be tested</param>
  311. /// <param name="message">The message to be displayed on failure</param>
  312. public static void IsNotEmpty( string aString, string message )
  313. {
  314. IsNotEmpty( aString, message, null );
  315. }
  316. /// <summary>
  317. /// Assert that a string is empty - that is equal to string.Emtpy
  318. /// </summary>
  319. /// <param name="aString">The string to be tested</param>
  320. public static void IsNotEmpty( string aString )
  321. {
  322. IsNotEmpty( aString, string.Empty, null );
  323. }
  324. /// <summary>
  325. /// Assert that an array, list or other collection is empty
  326. /// </summary>
  327. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  328. /// <param name="message">The message to be displayed on failure</param>
  329. /// <param name="args">Arguments to be used in formatting the message</param>
  330. public static void IsNotEmpty( ICollection collection, string message, params object[] args )
  331. {
  332. Assert.That(collection, Is.Not.Empty, message, args);
  333. }
  334. /// <summary>
  335. /// Assert that an array, list or other collection is empty
  336. /// </summary>
  337. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  338. /// <param name="message">The message to be displayed on failure</param>
  339. public static void IsNotEmpty( ICollection collection, string message )
  340. {
  341. IsNotEmpty( collection, message, null );
  342. }
  343. /// <summary>
  344. /// Assert that an array,list or other collection is empty
  345. /// </summary>
  346. /// <param name="collection">An array, list or other collection implementing ICollection</param>
  347. public static void IsNotEmpty( ICollection collection )
  348. {
  349. IsNotEmpty( collection, string.Empty, null );
  350. }
  351. #endregion
  352. #region IsAssignableFrom
  353. /// <summary>
  354. /// Asserts that an object may be assigned a value of a given Type.
  355. /// </summary>
  356. /// <param name="expected">The expected Type.</param>
  357. /// <param name="actual">The object under examination</param>
  358. static public void IsAssignableFrom( System.Type expected, object actual )
  359. {
  360. IsAssignableFrom(expected, actual, "");
  361. }
  362. /// <summary>
  363. /// Asserts that an object may be assigned a value of a given Type.
  364. /// </summary>
  365. /// <param name="expected">The expected Type.</param>
  366. /// <param name="actual">The object under examination</param>
  367. /// <param name="message">The messge to display in case of failure</param>
  368. static public void IsAssignableFrom( System.Type expected, object actual, string message )
  369. {
  370. IsAssignableFrom(expected, actual, message, null);
  371. }
  372. /// <summary>
  373. /// Asserts that an object may be assigned a value of a given Type.
  374. /// </summary>
  375. /// <param name="expected">The expected Type.</param>
  376. /// <param name="actual">The object under examination</param>
  377. /// <param name="message">The message to display in case of failure</param>
  378. /// <param name="args">Array of objects to be used in formatting the message</param>
  379. static public void IsAssignableFrom( System.Type expected, object actual, string message, params object[] args )
  380. {
  381. Assert.That(actual, Is.AssignableFrom(expected), message, args);
  382. }
  383. #endregion
  384. #region IsNotAssignableFrom
  385. /// <summary>
  386. /// Asserts that an object may not be assigned a value of a given Type.
  387. /// </summary>
  388. /// <param name="expected">The expected Type.</param>
  389. /// <param name="actual">The object under examination</param>
  390. static public void IsNotAssignableFrom( System.Type expected, object actual )
  391. {
  392. IsNotAssignableFrom(expected, actual, "");
  393. }
  394. /// <summary>
  395. /// Asserts that an object may not be assigned a value of a given Type.
  396. /// </summary>
  397. /// <param name="expected">The expected Type.</param>
  398. /// <param name="actual">The object under examination</param>
  399. /// <param name="message">The messge to display in case of failure</param>
  400. static public void IsNotAssignableFrom( System.Type expected, object actual, string message )
  401. {
  402. IsNotAssignableFrom(expected, actual, message, null);
  403. }
  404. /// <summary>
  405. /// Asserts that an object may not be assigned a value of a given Type.
  406. /// </summary>
  407. /// <param name="expected">The expected Type.</param>
  408. /// <param name="actual">The object under examination</param>
  409. /// <param name="message">The message to display in case of failure</param>
  410. /// <param name="args">Array of objects to be used in formatting the message</param>
  411. static public void IsNotAssignableFrom( System.Type expected, object actual, string message, params object[] args )
  412. {
  413. Assert.That(actual, Is.Not.AssignableFrom(expected), message, args);
  414. }
  415. #endregion
  416. #region IsInstanceOfType
  417. /// <summary>
  418. /// Asserts that an object is an instance of a given type.
  419. /// </summary>
  420. /// <param name="expected">The expected Type</param>
  421. /// <param name="actual">The object being examined</param>
  422. public static void IsInstanceOfType( System.Type expected, object actual )
  423. {
  424. IsInstanceOfType( expected, actual, string.Empty, null );
  425. }
  426. /// <summary>
  427. /// Asserts that an object is an instance of a given type.
  428. /// </summary>
  429. /// <param name="expected">The expected Type</param>
  430. /// <param name="actual">The object being examined</param>
  431. /// <param name="message">A message to display in case of failure</param>
  432. public static void IsInstanceOfType( System.Type expected, object actual, string message )
  433. {
  434. IsInstanceOfType( expected, actual, message, null );
  435. }
  436. /// <summary>
  437. /// Asserts that an object is an instance of a given type.
  438. /// </summary>
  439. /// <param name="expected">The expected Type</param>
  440. /// <param name="actual">The object being examined</param>
  441. /// <param name="message">A message to display in case of failure</param>
  442. /// <param name="args">An array of objects to be used in formatting the message</param>
  443. public static void IsInstanceOfType( System.Type expected, object actual, string message, params object[] args )
  444. {
  445. Assert.That(actual, Is.InstanceOfType(expected), message, args);
  446. }
  447. #endregion
  448. #region IsNotInstanceOfType
  449. /// <summary>
  450. /// Asserts that an object is not an instance of a given type.
  451. /// </summary>
  452. /// <param name="expected">The expected Type</param>
  453. /// <param name="actual">The object being examined</param>
  454. public static void IsNotInstanceOfType( System.Type expected, object actual )
  455. {
  456. IsNotInstanceOfType( expected, actual, string.Empty, null );
  457. }
  458. /// <summary>
  459. /// Asserts that an object is not an instance of a given type.
  460. /// </summary>
  461. /// <param name="expected">The expected Type</param>
  462. /// <param name="actual">The object being examined</param>
  463. /// <param name="message">A message to display in case of failure</param>
  464. public static void IsNotInstanceOfType( System.Type expected, object actual, string message )
  465. {
  466. IsNotInstanceOfType( expected, actual, message, null );
  467. }
  468. /// <summary>
  469. /// Asserts that an object is not an instance of a given type.
  470. /// </summary>
  471. /// <param name="expected">The expected Type</param>
  472. /// <param name="actual">The object being examined</param>
  473. /// <param name="message">A message to display in case of failure</param>
  474. /// <param name="args">An array of objects to be used in formatting the message</param>
  475. public static void IsNotInstanceOfType( System.Type expected, object actual, string message, params object[] args )
  476. {
  477. Assert.That(actual, Is.Not.InstanceOfType(expected), message, args);
  478. }
  479. #endregion
  480. #region AreEqual
  481. #region Ints
  482. /// <summary>
  483. /// Verifies that two ints are equal. If they are not, then an
  484. /// <see cref="AssertionException"/> is thrown.
  485. /// </summary>
  486. /// <param name="expected">The expected value</param>
  487. /// <param name="actual">The actual value</param>
  488. /// <param name="message">The message that will be displayed on failure</param>
  489. /// <param name="args">Arguments to be used in formatting the message</param>
  490. static public void AreEqual(int expected,
  491. int actual, string message, params object[] args)
  492. {
  493. Assert.That(actual, Is.EqualTo(expected), message, args);
  494. }
  495. /// <summary>
  496. /// Verifies that two ints are equal. If they are not, then an
  497. /// <see cref="AssertionException"/> is thrown.
  498. /// </summary>
  499. /// <param name="expected">The expected value</param>
  500. /// <param name="actual">The actual value</param>
  501. /// <param name="message">The message that will be displayed on failure</param>
  502. static public void AreEqual(int expected, int actual, string message)
  503. {
  504. Assert.AreEqual(expected, actual, message, null);
  505. }
  506. /// <summary>
  507. /// Verifies that two ints are equal. If they are not, then an
  508. /// <see cref="AssertionException"/> is thrown.
  509. /// </summary>
  510. /// <param name="expected">The expected value</param>
  511. /// <param name="actual">The actual value</param>
  512. static public void AreEqual(int expected, int actual)
  513. {
  514. Assert.AreEqual(expected, actual, string.Empty, null);
  515. }
  516. #endregion
  517. #region Longs
  518. /// <summary>
  519. /// Verifies that two longs are equal. If they are not, then an
  520. /// <see cref="AssertionException"/> is thrown.
  521. /// </summary>
  522. /// <param name="expected">The expected value</param>
  523. /// <param name="actual">The actual value</param>
  524. /// <param name="message">The message that will be displayed on failure</param>
  525. /// <param name="args">Arguments to be used in formatting the message</param>
  526. static public void AreEqual(long expected,
  527. long actual, string message, params object[] args)
  528. {
  529. Assert.That(actual, Is.EqualTo(expected), message, args);
  530. }
  531. /// <summary>
  532. /// Verifies that two longs are equal. If they are not, then an
  533. /// <see cref="AssertionException"/> is thrown.
  534. /// </summary>
  535. /// <param name="expected">The expected value</param>
  536. /// <param name="actual">The actual value</param>
  537. /// <param name="message">The message that will be displayed on failure</param>
  538. static public void AreEqual(long expected, long actual, string message)
  539. {
  540. Assert.AreEqual(expected, actual, message, null);
  541. }
  542. /// <summary>
  543. /// Verifies that two longs are equal. If they are not, then an
  544. /// <see cref="AssertionException"/> is thrown.
  545. /// </summary>
  546. /// <param name="expected">The expected value</param>
  547. /// <param name="actual">The actual value</param>
  548. static public void AreEqual(long expected, long actual)
  549. {
  550. Assert.AreEqual(expected, actual, string.Empty, null);
  551. }
  552. #endregion
  553. #region UInts
  554. /// <summary>
  555. /// Verifies that two uints are equal. If they are not, then an
  556. /// <see cref="AssertionException"/> is thrown.
  557. /// </summary>
  558. /// <param name="expected">The expected value</param>
  559. /// <param name="actual">The actual value</param>
  560. /// <param name="message">The message that will be displayed on failure</param>
  561. /// <param name="args">Arguments to be used in formatting the message</param>
  562. [CLSCompliant(false)]
  563. static public void AreEqual(uint expected,
  564. uint actual, string message, params object[] args)
  565. {
  566. Assert.That(actual, Is.EqualTo(expected), message, args);
  567. }
  568. /// <summary>
  569. /// Verifies that two uints are equal. If they are not, then an
  570. /// <see cref="AssertionException"/> is thrown.
  571. /// </summary>
  572. /// <param name="expected">The expected value</param>
  573. /// <param name="actual">The actual value</param>
  574. /// <param name="message">The message that will be displayed on failure</param>
  575. [CLSCompliant(false)]
  576. static public void AreEqual(uint expected, uint actual, string message)
  577. {
  578. Assert.AreEqual(expected, actual, message, null);
  579. }
  580. /// <summary>
  581. /// Verifies that two uints are equal. If they are not, then an
  582. /// <see cref="AssertionException"/> is thrown.
  583. /// </summary>
  584. /// <param name="expected">The expected value</param>
  585. /// <param name="actual">The actual value</param>
  586. [CLSCompliant(false)]
  587. static public void AreEqual(uint expected, uint actual)
  588. {
  589. Assert.AreEqual(expected, actual, string.Empty, null);
  590. }
  591. #endregion
  592. #region Ulongs
  593. /// <summary>
  594. /// Verifies that two ulongs are equal. If they are not, then an
  595. /// <see cref="AssertionException"/> is thrown.
  596. /// </summary>
  597. /// <param name="expected">The expected value</param>
  598. /// <param name="actual">The actual value</param>
  599. /// <param name="message">The message that will be displayed on failure</param>
  600. /// <param name="args">Arguments to be used in formatting the message</param>
  601. [CLSCompliant(false)]
  602. static public void AreEqual(ulong expected,
  603. ulong actual, string message, params object[] args)
  604. {
  605. Assert.That(actual, Is.EqualTo(expected), message, args);
  606. }
  607. /// <summary>
  608. /// Verifies that two ulongs are equal. If they are not, then an
  609. /// <see cref="AssertionException"/> is thrown.
  610. /// </summary>
  611. /// <param name="expected">The expected value</param>
  612. /// <param name="actual">The actual value</param>
  613. /// <param name="message">The message that will be displayed on failure</param>
  614. [CLSCompliant(false)]
  615. static public void AreEqual(ulong expected, ulong actual, string message)
  616. {
  617. Assert.AreEqual(expected, actual, message, null);
  618. }
  619. /// <summary>
  620. /// Verifies that two ulongs are equal. If they are not, then an
  621. /// <see cref="AssertionException"/> is thrown.
  622. /// </summary>
  623. /// <param name="expected">The expected value</param>
  624. /// <param name="actual">The actual value</param>
  625. [CLSCompliant(false)]
  626. static public void AreEqual(ulong expected, ulong actual)
  627. {
  628. Assert.AreEqual(expected, actual, string.Empty, null);
  629. }
  630. #endregion
  631. #region Decimals
  632. /// <summary>
  633. /// Verifies that two decimals are equal. If they are not, then an
  634. /// <see cref="AssertionException"/> is thrown.
  635. /// </summary>
  636. /// <param name="expected">The expected value</param>
  637. /// <param name="actual">The actual value</param>
  638. /// <param name="message">The message that will be displayed on failure</param>
  639. /// <param name="args">Arguments to be used in formatting the message</param>
  640. static public void AreEqual(decimal expected,
  641. decimal actual, string message, params object[] args)
  642. {
  643. Assert.That(actual, Is.EqualTo(expected), message, args);
  644. }
  645. /// <summary>
  646. /// Verifies that two decimal are equal. If they are not, then an
  647. /// <see cref="AssertionException"/> is thrown.
  648. /// </summary>
  649. /// <param name="expected">The expected value</param>
  650. /// <param name="actual">The actual value</param>
  651. /// <param name="message">The message that will be displayed on failure</param>
  652. static public void AreEqual(decimal expected, decimal actual, string message)
  653. {
  654. Assert.AreEqual( expected, actual, message, null );
  655. }
  656. /// <summary>
  657. /// Verifies that two decimals are equal. If they are not, then an
  658. /// <see cref="AssertionException"/> is thrown.
  659. /// </summary>
  660. /// <param name="expected">The expected value</param>
  661. /// <param name="actual">The actual value</param>
  662. static public void AreEqual(decimal expected, decimal actual )
  663. {
  664. Assert.AreEqual( expected, actual, string.Empty, null );
  665. }
  666. #endregion
  667. #region Doubles
  668. /// <summary>
  669. /// Verifies that two doubles are equal considering a delta. If the
  670. /// expected value is infinity then the delta value is ignored. If
  671. /// they are not equals then an <see cref="AssertionException"/> is
  672. /// thrown.
  673. /// </summary>
  674. /// <param name="expected">The expected value</param>
  675. /// <param name="actual">The actual value</param>
  676. /// <param name="delta">The maximum acceptable difference between the
  677. /// the expected and the actual</param>
  678. /// <param name="message">The message that will be displayed on failure</param>
  679. /// <param name="args">Arguments to be used in formatting the message</param>
  680. static public void AreEqual(double expected,
  681. double actual, double delta, string message, params object[] args)
  682. {
  683. Constraint constraint = new EqualConstraint( expected );
  684. if ( double.IsNaN(expected) || double.IsInfinity(expected) )
  685. Assert.That(actual, Is.EqualTo( expected ), message, args);
  686. else
  687. Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
  688. }
  689. /// <summary>
  690. /// Verifies that two doubles are equal considering a delta. If the
  691. /// expected value is infinity then the delta value is ignored. If
  692. /// they are not equals then an <see cref="AssertionException"/> is
  693. /// thrown.
  694. /// </summary>
  695. /// <param name="expected">The expected value</param>
  696. /// <param name="actual">The actual value</param>
  697. /// <param name="delta">The maximum acceptable difference between the
  698. /// the expected and the actual</param>
  699. /// <param name="message">The message that will be displayed on failure</param>
  700. static public void AreEqual(double expected,
  701. double actual, double delta, string message)
  702. {
  703. Assert.AreEqual( expected, actual, delta, message, null );
  704. }
  705. /// <summary>
  706. /// Verifies that two doubles are equal considering a delta. If the
  707. /// expected value is infinity then the delta value is ignored. If
  708. /// they are not equals then an <see cref="AssertionException"/> is
  709. /// thrown.
  710. /// </summary>
  711. /// <param name="expected">The expected value</param>
  712. /// <param name="actual">The actual value</param>
  713. /// <param name="delta">The maximum acceptable difference between the
  714. /// the expected and the actual</param>
  715. static public void AreEqual(double expected, double actual, double delta)
  716. {
  717. Assert.AreEqual(expected, actual, delta, string.Empty, null);
  718. }
  719. #endregion
  720. #region Floats
  721. /// <summary>
  722. /// Verifies that two floats are equal considering a delta. If the
  723. /// expected value is infinity then the delta value is ignored. If
  724. /// they are not equals then an <see cref="AssertionException"/> is
  725. /// thrown.
  726. /// </summary>
  727. /// <param name="expected">The expected value</param>
  728. /// <param name="actual">The actual value</param>
  729. /// <param name="delta">The maximum acceptable difference between the
  730. /// the expected and the actual</param>
  731. /// <param name="message">The message displayed upon failure</param>
  732. /// <param name="args">Arguments to be used in formatting the message</param>
  733. static public void AreEqual(float expected,
  734. float actual, float delta, string message, params object[] args)
  735. {
  736. if (float.IsNaN(expected) || float.IsInfinity(expected))
  737. Assert.That(actual, Is.EqualTo( expected), message, args );
  738. else
  739. Assert.That(actual, Is.EqualTo(expected).Within(delta), message, args);
  740. }
  741. /// <summary>
  742. /// Verifies that two floats are equal considering a delta. If the
  743. /// expected value is infinity then the delta value is ignored. If
  744. /// they are not equals then an <see cref="AssertionException"/> is
  745. /// thrown.
  746. /// </summary>
  747. /// <param name="expected">The expected value</param>
  748. /// <param name="actual">The actual value</param>
  749. /// <param name="delta">The maximum acceptable difference between the
  750. /// the expected and the actual</param>
  751. /// <param name="message">The message displayed upon failure</param>
  752. static public void AreEqual(float expected, float actual, float delta, string message)
  753. {
  754. Assert.AreEqual(expected, actual, delta, message, null);
  755. }
  756. /// <summary>
  757. /// Verifies that two floats are equal considering a delta. If the
  758. /// expected value is infinity then the delta value is ignored. If
  759. /// they are not equals then an <see cref="AssertionException"/> is
  760. /// thrown.
  761. /// </summary>
  762. /// <param name="expected">The expected value</param>
  763. /// <param name="actual">The actual value</param>
  764. /// <param name="delta">The maximum acceptable difference between the
  765. /// the expected and the actual</param>
  766. static public void AreEqual(float expected, float actual, float delta)
  767. {
  768. Assert.AreEqual(expected, actual, delta, string.Empty, null);
  769. }
  770. #endregion
  771. #region Objects
  772. /// <summary>
  773. /// Verifies that two objects are equal. Two objects are considered
  774. /// equal if both are null, or if both have the same value. All
  775. /// non-numeric types are compared by using the <c>Equals</c> method.
  776. /// Arrays are compared by comparing each element using the same rules.
  777. /// If they are not equal an <see cref="AssertionException"/> is thrown.
  778. /// </summary>
  779. /// <param name="expected">The value that is expected</param>
  780. /// <param name="actual">The actual value</param>
  781. /// <param name="message">The message to display if objects are not equal</param>
  782. /// <param name="args">Arguments to be used in formatting the message</param>
  783. static public void AreEqual(Object expected, Object actual, string message, params object[] args)
  784. {
  785. Assert.That(actual, Is.EqualTo(expected), message, args);
  786. }
  787. /// <summary>
  788. /// Verifies that two objects are equal. Two objects are considered
  789. /// equal if both are null, or if both have the same value. All
  790. /// non-numeric types are compared by using the <c>Equals</c> method.
  791. /// If they are not equal an <see cref="AssertionException"/> is thrown.
  792. /// </summary>
  793. /// <param name="expected">The value that is expected</param>
  794. /// <param name="actual">The actual value</param>
  795. /// <param name="message">The message to display if objects are not equal</param>
  796. static public void AreEqual(Object expected, Object actual, string message)
  797. {
  798. Assert.AreEqual(expected, actual, message, null);
  799. }
  800. /// <summary>
  801. /// Verifies that two objects are equal. Two objects are considered
  802. /// equal if both are null, or if both have the same value. All
  803. /// non-numeric types are compared by using the <c>Equals</c> method.
  804. /// If they are not equal an <see cref="AssertionException"/> is thrown.
  805. /// </summary>
  806. /// <param name="expected">The value that is expected</param>
  807. /// <param name="actual">The actual value</param>
  808. static public void AreEqual(Object expected, Object actual)
  809. {
  810. Assert.AreEqual(expected, actual, string.Empty, null);
  811. }
  812. #endregion
  813. #endregion
  814. #region AreNotEqual
  815. #region Objects
  816. /// <summary>
  817. /// Asserts that two objects are not equal. If they are equal
  818. /// an <see cref="AssertionException"/> is thrown.
  819. /// </summary>
  820. /// <param name="expected">The expected object</param>
  821. /// <param name="actual">The actual object</param>
  822. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  823. /// <param name="args">Arguments to be used in formatting the message</param>
  824. static public void AreNotEqual( Object expected, Object actual, string message, params object[] args)
  825. {
  826. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  827. }
  828. /// <summary>
  829. /// Asserts that two objects are not equal. If they are equal
  830. /// an <see cref="AssertionException"/> is thrown.
  831. /// </summary>
  832. /// <param name="expected">The expected object</param>
  833. /// <param name="actual">The actual object</param>
  834. /// <param name="message">The message to be displayed when the objects are the same</param>
  835. static public void AreNotEqual(Object expected, Object actual, string message)
  836. {
  837. Assert.AreNotEqual(expected, actual, message, null);
  838. }
  839. /// <summary>
  840. /// Asserts that two objects are not equal. If they are equal
  841. /// an <see cref="AssertionException"/> is thrown.
  842. /// </summary>
  843. /// <param name="expected">The expected object</param>
  844. /// <param name="actual">The actual object</param>
  845. static public void AreNotEqual(Object expected, Object actual)
  846. {
  847. Assert.AreNotEqual(expected, actual, string.Empty, null);
  848. }
  849. #endregion
  850. #region Ints
  851. /// <summary>
  852. /// Asserts that two ints are not equal. If they are equal
  853. /// an <see cref="AssertionException"/> is thrown.
  854. /// </summary>
  855. /// <param name="expected">The expected object</param>
  856. /// <param name="actual">The actual object</param>
  857. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  858. /// <param name="args">Arguments to be used in formatting the message</param>
  859. static public void AreNotEqual(int expected, int actual, string message, params object[] args)
  860. {
  861. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  862. }
  863. /// <summary>
  864. /// Asserts that two ints are not equal. If they are equal
  865. /// an <see cref="AssertionException"/> is thrown.
  866. /// </summary>
  867. /// <param name="expected">The expected object</param>
  868. /// <param name="actual">The actual object</param>
  869. /// <param name="message">The message to be displayed when the objects are the same</param>
  870. static public void AreNotEqual(int expected, int actual, string message)
  871. {
  872. Assert.AreNotEqual(expected, actual, message, null);
  873. }
  874. /// <summary>
  875. /// Asserts that two ints are not equal. If they are equal
  876. /// an <see cref="AssertionException"/> is thrown.
  877. /// </summary>
  878. /// <param name="expected">The expected object</param>
  879. /// <param name="actual">The actual object</param>
  880. static public void AreNotEqual(int expected, int actual)
  881. {
  882. Assert.AreNotEqual(expected, actual, string.Empty, null);
  883. }
  884. #endregion
  885. #region Longs
  886. /// <summary>
  887. /// Asserts that two longss are not equal. If they are equal
  888. /// an <see cref="AssertionException"/> is thrown.
  889. /// </summary>
  890. /// <param name="expected">The expected object</param>
  891. /// <param name="actual">The actual object</param>
  892. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  893. /// <param name="args">Arguments to be used in formatting the message</param>
  894. static public void AreNotEqual(long expected, long actual, string message, params object[] args)
  895. {
  896. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  897. }
  898. /// <summary>
  899. /// Asserts that two longs are not equal. If they are equal
  900. /// an <see cref="AssertionException"/> is thrown.
  901. /// </summary>
  902. /// <param name="expected">The expected object</param>
  903. /// <param name="actual">The actual object</param>
  904. /// <param name="message">The message to be displayed when the objects are the same</param>
  905. static public void AreNotEqual(long expected, long actual, string message)
  906. {
  907. Assert.AreNotEqual(expected, actual, message, null);
  908. }
  909. /// <summary>
  910. /// Asserts that two longs are not equal. If they are equal
  911. /// an <see cref="AssertionException"/> is thrown.
  912. /// </summary>
  913. /// <param name="expected">The expected object</param>
  914. /// <param name="actual">The actual object</param>
  915. static public void AreNotEqual(long expected, long actual)
  916. {
  917. Assert.AreNotEqual(expected, actual, string.Empty, null);
  918. }
  919. #endregion
  920. #region UInts
  921. /// <summary>
  922. /// Asserts that two uints are not equal. If they are equal
  923. /// an <see cref="AssertionException"/> is thrown.
  924. /// </summary>
  925. /// <param name="expected">The expected object</param>
  926. /// <param name="actual">The actual object</param>
  927. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  928. /// <param name="args">Arguments to be used in formatting the message</param>
  929. [CLSCompliant(false)]
  930. static public void AreNotEqual(uint expected, uint actual, string message, params object[] args)
  931. {
  932. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  933. }
  934. /// <summary>
  935. /// Asserts that two uints are not equal. If they are equal
  936. /// an <see cref="AssertionException"/> is thrown.
  937. /// </summary>
  938. /// <param name="expected">The expected object</param>
  939. /// <param name="actual">The actual object</param>
  940. /// <param name="message">The message to be displayed when the objects are the same</param>
  941. [CLSCompliant(false)]
  942. static public void AreNotEqual(uint expected, uint actual, string message)
  943. {
  944. Assert.AreNotEqual(expected, actual, message, null);
  945. }
  946. /// <summary>
  947. /// Asserts that two uints are not equal. If they are equal
  948. /// an <see cref="AssertionException"/> is thrown.
  949. /// </summary>
  950. /// <param name="expected">The expected object</param>
  951. /// <param name="actual">The actual object</param>
  952. [CLSCompliant(false)]
  953. static public void AreNotEqual(uint expected, uint actual)
  954. {
  955. Assert.AreNotEqual(expected, actual, string.Empty, null);
  956. }
  957. #endregion
  958. #region Ulongs
  959. /// <summary>
  960. /// Asserts that two ulongs are not equal. If they are equal
  961. /// an <see cref="AssertionException"/> is thrown.
  962. /// </summary>
  963. /// <param name="expected">The expected object</param>
  964. /// <param name="actual">The actual object</param>
  965. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  966. /// <param name="args">Arguments to be used in formatting the message</param>
  967. [CLSCompliant(false)]
  968. static public void AreNotEqual(ulong expected, ulong actual, string message, params object[] args)
  969. {
  970. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  971. }
  972. /// <summary>
  973. /// Asserts that two ulongs are not equal. If they are equal
  974. /// an <see cref="AssertionException"/> is thrown.
  975. /// </summary>
  976. /// <param name="expected">The expected object</param>
  977. /// <param name="actual">The actual object</param>
  978. /// <param name="message">The message to be displayed when the objects are the same</param>
  979. [CLSCompliant(false)]
  980. static public void AreNotEqual(ulong expected, ulong actual, string message)
  981. {
  982. Assert.AreNotEqual(expected, actual, message, null);
  983. }
  984. /// <summary>
  985. /// Asserts that two ulong are not equal. If they are equal
  986. /// an <see cref="AssertionException"/> is thrown.
  987. /// </summary>
  988. /// <param name="expected">The expected object</param>
  989. /// <param name="actual">The actual object</param>
  990. [CLSCompliant(false)]
  991. static public void AreNotEqual(ulong expected, ulong actual)
  992. {
  993. Assert.AreNotEqual(expected, actual, string.Empty, null);
  994. }
  995. #endregion
  996. #region Decimals
  997. /// <summary>
  998. /// Asserts that two decimals are not equal. If they are equal
  999. /// an <see cref="AssertionException"/> is thrown.
  1000. /// </summary>
  1001. /// <param name="expected">The expected object</param>
  1002. /// <param name="actual">The actual object</param>
  1003. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  1004. /// <param name="args">Arguments to be used in formatting the message</param>
  1005. static public void AreNotEqual( decimal expected, decimal actual, string message, params object[] args)
  1006. {
  1007. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1008. }
  1009. /// <summary>
  1010. /// Asserts that two decimals are not equal. If they are equal
  1011. /// an <see cref="AssertionException"/> is thrown.
  1012. /// </summary>
  1013. /// <param name="expected">The expected object</param>
  1014. /// <param name="actual">The actual object</param>
  1015. /// <param name="message">The message to be displayed when the objects are the same</param>
  1016. static public void AreNotEqual(decimal expected, decimal actual, string message)
  1017. {
  1018. Assert.AreNotEqual(expected, actual, message, null);
  1019. }
  1020. /// <summary>
  1021. /// Asserts that two decimals are not equal. If they are equal
  1022. /// an <see cref="AssertionException"/> is thrown.
  1023. /// </summary>
  1024. /// <param name="expected">The expected object</param>
  1025. /// <param name="actual">The actual object</param>
  1026. static public void AreNotEqual(decimal expected, decimal actual)
  1027. {
  1028. Assert.AreNotEqual(expected, actual, string.Empty, null);
  1029. }
  1030. #endregion
  1031. #region Floats
  1032. /// <summary>
  1033. /// Asserts that two floats are not equal. If they are equal
  1034. /// an <see cref="AssertionException"/> is thrown.
  1035. /// </summary>
  1036. /// <param name="expected">The expected object</param>
  1037. /// <param name="actual">The actual object</param>
  1038. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  1039. /// <param name="args">Arguments to be used in formatting the message</param>
  1040. static public void AreNotEqual( float expected, float actual, string message, params object[] args)
  1041. {
  1042. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1043. }
  1044. /// <summary>
  1045. /// Asserts that two floats are not equal. If they are equal
  1046. /// an <see cref="AssertionException"/> is thrown.
  1047. /// </summary>
  1048. /// <param name="expected">The expected object</param>
  1049. /// <param name="actual">The actual object</param>
  1050. /// <param name="message">The message to be displayed when the objects are the same</param>
  1051. static public void AreNotEqual(float expected, float actual, string message)
  1052. {
  1053. Assert.AreNotEqual(expected, actual, message, null);
  1054. }
  1055. /// <summary>
  1056. /// Asserts that two floats are not equal. If they are equal
  1057. /// an <see cref="AssertionException"/> is thrown.
  1058. /// </summary>
  1059. /// <param name="expected">The expected object</param>
  1060. /// <param name="actual">The actual object</param>
  1061. static public void AreNotEqual(float expected, float actual)
  1062. {
  1063. Assert.AreNotEqual(expected, actual, string.Empty, null);
  1064. }
  1065. #endregion
  1066. #region Doubles
  1067. /// <summary>
  1068. /// Asserts that two doubles are not equal. If they are equal
  1069. /// an <see cref="AssertionException"/> is thrown.
  1070. /// </summary>
  1071. /// <param name="expected">The expected object</param>
  1072. /// <param name="actual">The actual object</param>
  1073. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  1074. /// <param name="args">Arguments to be used in formatting the message</param>
  1075. static public void AreNotEqual( double expected, double actual, string message, params object[] args)
  1076. {
  1077. Assert.That(actual, Is.Not.EqualTo(expected), message, args);
  1078. }
  1079. /// <summary>
  1080. /// Asserts that two doubles are not equal. If they are equal
  1081. /// an <see cref="AssertionException"/> is thrown.
  1082. /// </summary>
  1083. /// <param name="expected">The expected object</param>
  1084. /// <param name="actual">The actual object</param>
  1085. /// <param name="message">The message to be displayed when the objects are the same</param>
  1086. static public void AreNotEqual(double expected, double actual, string message)
  1087. {
  1088. Assert.AreNotEqual(expected, actual, message, null);
  1089. }
  1090. /// <summary>
  1091. /// Asserts that two doubles are not equal. If they are equal
  1092. /// an <see cref="AssertionException"/> is thrown.
  1093. /// </summary>
  1094. /// <param name="expected">The expected object</param>
  1095. /// <param name="actual">The actual object</param>
  1096. static public void AreNotEqual(double expected, double actual)
  1097. {
  1098. Assert.AreNotEqual(expected, actual, string.Empty, null);
  1099. }
  1100. #endregion
  1101. #endregion
  1102. #region AreSame
  1103. /// <summary>
  1104. /// Asserts that two objects refer to the same object. If they
  1105. /// are not the same an <see cref="AssertionException"/> is thrown.
  1106. /// </summary>
  1107. /// <param name="expected">The expected object</param>
  1108. /// <param name="actual">The actual object</param>
  1109. /// <param name="message">The message to be displayed when the two objects are not the same object.</param>
  1110. /// <param name="args">Arguments to be used in formatting the message</param>
  1111. static public void AreSame(Object expected, Object actual, string message, params object[] args)
  1112. {
  1113. Assert.That(actual, Is.SameAs(expected), message, args);
  1114. }
  1115. /// <summary>
  1116. /// Asserts that two objects refer to the same object. If they
  1117. /// are not the same an <see cref="AssertionException"/> is thrown.
  1118. /// </summary>
  1119. /// <param name="expected">The expected object</param>
  1120. /// <param name="actual">The actual object</param>
  1121. /// <param name="message">The message to be displayed when the object is null</param>
  1122. static public void AreSame(Object expected, Object actual, string message)
  1123. {
  1124. Assert.AreSame(expected, actual, message, null);
  1125. }
  1126. /// <summary>
  1127. /// Asserts that two objects refer to the same object. If they
  1128. /// are not the same an <see cref="AssertionException"/> is thrown.
  1129. /// </summary>
  1130. /// <param name="expected">The expected object</param>
  1131. /// <param name="actual">The actual object</param>
  1132. static public void AreSame(Object expected, Object actual)
  1133. {
  1134. Assert.AreSame(expected, actual, string.Empty, null);
  1135. }
  1136. #endregion
  1137. #region AreNotSame
  1138. /// <summary>
  1139. /// Asserts that two objects do not refer to the same object. If they
  1140. /// are the same an <see cref="AssertionException"/> is thrown.
  1141. /// </summary>
  1142. /// <param name="expected">The expected object</param>
  1143. /// <param name="actual">The actual object</param>
  1144. /// <param name="message">The message to be displayed when the two objects are the same object.</param>
  1145. /// <param name="args">Arguments to be used in formatting the message</param>
  1146. static public void AreNotSame(Object expected, Object actual, string message, params object[] args)
  1147. {
  1148. Assert.That(actual, Is.Not.SameAs(expected), message, args);
  1149. }
  1150. /// <summary>
  1151. /// Asserts that two objects do not refer to the same object. If they
  1152. /// are the same an <see cref="AssertionException"/> is thrown.
  1153. /// </summary>
  1154. /// <param name="expected">The expected object</param>
  1155. /// <param name="actual">The actual object</param>
  1156. /// <param name="message">The message to be displayed when the objects are the same</param>
  1157. static public void AreNotSame(Object expected, Object actual, string message)
  1158. {
  1159. Assert.AreNotSame(expected, actual, message, null);
  1160. }
  1161. /// <summary>
  1162. /// Asserts that two objects do not refer to the same object. If they
  1163. /// are the same an <see cref="AssertionException"/> is thrown.
  1164. /// </summary>
  1165. /// <param name="expected">The expected object</param>
  1166. /// <param name="actual">The actual object</param>
  1167. static public void AreNotSame(Object expected, Object actual)
  1168. {
  1169. Assert.AreNotSame(expected, actual, string.Empty, null);
  1170. }
  1171. #endregion
  1172. #region Greater
  1173. #region Ints
  1174. /// <summary>
  1175. /// Verifies that the first value is greater than the second
  1176. /// value. If they are not, then an
  1177. /// <see cref="AssertionException"/> is thrown.
  1178. /// </summary>
  1179. /// <param name="arg1">The first value, expected to be greater</param>
  1180. /// <param name="arg2">The second value, expected to be less</param>
  1181. /// <param name="message">The message that will be displayed on failure</param>
  1182. /// <param name="args">Arguments to be used in formatting the message</param>
  1183. static public void Greater(int arg1,
  1184. int arg2, string message, params object[] args)
  1185. {
  1186. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1187. }
  1188. /// <summary>
  1189. /// Verifies that the first value is greater than the second
  1190. /// value. If they are not, then an
  1191. /// <see cref="AssertionException"/> is thrown.
  1192. /// </summary>
  1193. /// <param name="arg1">The first value, expected to be greater</param>
  1194. /// <param name="arg2">The second value, expected to be less</param>
  1195. /// <param name="message">The message that will be displayed on failure</param>
  1196. static public void Greater(int arg1, int arg2, string message)
  1197. {
  1198. Assert.Greater( arg1, arg2, message, null );
  1199. }
  1200. /// <summary>
  1201. /// Verifies that the first value is greater than the second
  1202. /// value. If they are not, then an
  1203. /// <see cref="AssertionException"/> is thrown.
  1204. /// </summary>
  1205. /// <param name="arg1">The first value, expected to be greater</param>
  1206. /// <param name="arg2">The second value, expected to be less</param>
  1207. static public void Greater(int arg1, int arg2 )
  1208. {
  1209. Assert.Greater( arg1, arg2, string.Empty, null );
  1210. }
  1211. #endregion
  1212. #region UInts
  1213. /// <summary>
  1214. /// Verifies that the first value is greater than the second
  1215. /// value. If they are not, then an
  1216. /// <see cref="AssertionException"/> is thrown.
  1217. /// </summary>
  1218. /// <param name="arg1">The first value, expected to be greater</param>
  1219. /// <param name="arg2">The second value, expected to be less</param>
  1220. /// <param name="message">The message that will be displayed on failure</param>
  1221. /// <param name="args">Arguments to be used in formatting the message</param>
  1222. [CLSCompliant(false)]
  1223. static public void Greater(uint arg1,
  1224. uint arg2, string message, params object[] args)
  1225. {
  1226. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1227. }
  1228. /// <summary>
  1229. /// Verifies that the first value is greater than the second
  1230. /// value. If they are not, then an
  1231. /// <see cref="AssertionException"/> is thrown.
  1232. /// </summary>
  1233. /// <param name="arg1">The first value, expected to be greater</param>
  1234. /// <param name="arg2">The second value, expected to be less</param>
  1235. /// <param name="message">The message that will be displayed on failure</param>
  1236. [CLSCompliant(false)]
  1237. static public void Greater(uint arg1, uint arg2, string message)
  1238. {
  1239. Assert.Greater( arg1, arg2, message, null );
  1240. }
  1241. /// <summary>
  1242. /// Verifies that the first value is greater than the second
  1243. /// value. If they are not, then an
  1244. /// <see cref="AssertionException"/> is thrown.
  1245. /// </summary>
  1246. /// <param name="arg1">The first value, expected to be greater</param>
  1247. /// <param name="arg2">The second value, expected to be less</param>
  1248. [CLSCompliant(false)]
  1249. static public void Greater(uint arg1, uint arg2 )
  1250. {
  1251. Assert.Greater( arg1, arg2, string.Empty, null );
  1252. }
  1253. #endregion
  1254. #region Longs
  1255. /// <summary>
  1256. /// Verifies that the first value is greater than the second
  1257. /// value. If they are not, then an
  1258. /// <see cref="AssertionException"/> is thrown.
  1259. /// </summary>
  1260. /// <param name="arg1">The first value, expected to be greater</param>
  1261. /// <param name="arg2">The second value, expected to be less</param>
  1262. /// <param name="message">The message that will be displayed on failure</param>
  1263. /// <param name="args">Arguments to be used in formatting the message</param>
  1264. static public void Greater(long arg1,
  1265. long arg2, string message, params object[] args)
  1266. {
  1267. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1268. }
  1269. /// <summary>
  1270. /// Verifies that the first value is greater than the second
  1271. /// value. If they are not, then an
  1272. /// <see cref="AssertionException"/> is thrown.
  1273. /// </summary>
  1274. /// <param name="arg1">The first value, expected to be greater</param>
  1275. /// <param name="arg2">The second value, expected to be less</param>
  1276. /// <param name="message">The message that will be displayed on failure</param>
  1277. static public void Greater(long arg1, long arg2, string message)
  1278. {
  1279. Assert.Greater( arg1, arg2, message, null );
  1280. }
  1281. /// <summary>
  1282. /// Verifies that the first value is greater than the second
  1283. /// value. If they are not, then an
  1284. /// <see cref="AssertionException"/> is thrown.
  1285. /// </summary>
  1286. /// <param name="arg1">The first value, expected to be greater</param>
  1287. /// <param name="arg2">The second value, expected to be less</param>
  1288. static public void Greater(long arg1, long arg2 )
  1289. {
  1290. Assert.Greater( arg1, arg2, string.Empty, null );
  1291. }
  1292. #endregion
  1293. #region ULongs
  1294. /// <summary>
  1295. /// Verifies that the first value is greater than the second
  1296. /// value. If they are not, then an
  1297. /// <see cref="AssertionException"/> is thrown.
  1298. /// </summary>
  1299. /// <param name="arg1">The first value, expected to be greater</param>
  1300. /// <param name="arg2">The second value, expected to be less</param>
  1301. /// <param name="message">The message that will be displayed on failure</param>
  1302. /// <param name="args">Arguments to be used in formatting the message</param>
  1303. [CLSCompliant(false)]
  1304. static public void Greater(ulong arg1,
  1305. ulong arg2, string message, params object[] args)
  1306. {
  1307. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1308. }
  1309. /// <summary>
  1310. /// Verifies that the first value is greater than the second
  1311. /// value. If they are not, then an
  1312. /// <see cref="AssertionException"/> is thrown.
  1313. /// </summary>
  1314. /// <param name="arg1">The first value, expected to be greater</param>
  1315. /// <param name="arg2">The second value, expected to be less</param>
  1316. /// <param name="message">The message that will be displayed on failure</param>
  1317. [CLSCompliant(false)]
  1318. static public void Greater(ulong arg1, ulong arg2, string message)
  1319. {
  1320. Assert.Greater( arg1, arg2, message, null );
  1321. }
  1322. /// <summary>
  1323. /// Verifies that the first value is greater than the second
  1324. /// value. If they are not, then an
  1325. /// <see cref="AssertionException"/> is thrown.
  1326. /// </summary>
  1327. /// <param name="arg1">The first value, expected to be greater</param>
  1328. /// <param name="arg2">The second value, expected to be less</param>
  1329. [CLSCompliant(false)]
  1330. static public void Greater(ulong arg1, ulong arg2 )
  1331. {
  1332. Assert.Greater( arg1, arg2, string.Empty, null );
  1333. }
  1334. #endregion
  1335. #region Decimals
  1336. /// <summary>
  1337. /// Verifies that the first value is greater than the second
  1338. /// value. If they are not, then an
  1339. /// <see cref="AssertionException"/> is thrown.
  1340. /// </summary>
  1341. /// <param name="arg1">The first value, expected to be greater</param>
  1342. /// <param name="arg2">The second value, expected to be less</param>
  1343. /// <param name="message">The message that will be displayed on failure</param>
  1344. /// <param name="args">Arguments to be used in formatting the message</param>
  1345. static public void Greater(decimal arg1,
  1346. decimal arg2, string message, params object[] args)
  1347. {
  1348. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1349. }
  1350. /// <summary>
  1351. /// Verifies that the first value is greater than the second
  1352. /// value. If they are not, then an
  1353. /// <see cref="AssertionException"/> is thrown.
  1354. /// </summary>
  1355. /// <param name="arg1">The first value, expected to be greater</param>
  1356. /// <param name="arg2">The second value, expected to be less</param>
  1357. /// <param name="message">The message that will be displayed on failure</param>
  1358. static public void Greater(decimal arg1, decimal arg2, string message)
  1359. {
  1360. Assert.Greater( arg1, arg2, message, null );
  1361. }
  1362. /// <summary>
  1363. /// Verifies that the first value is greater than the second
  1364. /// value. If they are not, then an
  1365. /// <see cref="AssertionException"/> is thrown.
  1366. /// </summary>
  1367. /// <param name="arg1">The first value, expected to be greater</param>
  1368. /// <param name="arg2">The second value, expected to be less</param>
  1369. static public void Greater(decimal arg1, decimal arg2 )
  1370. {
  1371. Assert.Greater( arg1, arg2, string.Empty, null );
  1372. }
  1373. #endregion
  1374. #region Doubles
  1375. /// <summary>
  1376. /// Verifies that the first value is greater than the second
  1377. /// value. If they are not, then an
  1378. /// <see cref="AssertionException"/> is thrown.
  1379. /// </summary>
  1380. /// <param name="arg1">The first value, expected to be greater</param>
  1381. /// <param name="arg2">The second value, expected to be less</param>
  1382. /// <param name="message">The message that will be displayed on failure</param>
  1383. /// <param name="args">Arguments to be used in formatting the message</param>
  1384. static public void Greater(double arg1,
  1385. double arg2, string message, params object[] args)
  1386. {
  1387. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1388. }
  1389. /// <summary>
  1390. /// Verifies that the first value is greater than the second
  1391. /// value. If they are not, then an
  1392. /// <see cref="AssertionException"/> is thrown.
  1393. /// </summary>
  1394. /// <param name="arg1">The first value, expected to be greater</param>
  1395. /// <param name="arg2">The second value, expected to be less</param>
  1396. /// <param name="message">The message that will be displayed on failure</param>
  1397. static public void Greater(double arg1,
  1398. double arg2, string message)
  1399. {
  1400. Assert.Greater( arg1, arg2, message, null );
  1401. }
  1402. /// <summary>
  1403. /// Verifies that the first value is greater than the second
  1404. /// value. If they are not, then an
  1405. /// <see cref="AssertionException"/> is thrown.
  1406. /// </summary>
  1407. /// <param name="arg1">The first value, expected to be greater</param>
  1408. /// <param name="arg2">The second value, expected to be less</param>
  1409. static public void Greater(double arg1, double arg2)
  1410. {
  1411. Assert.Greater(arg1, arg2, string.Empty, null);
  1412. }
  1413. #endregion
  1414. #region Floats
  1415. /// <summary>
  1416. /// Verifies that the first value is greater than the second
  1417. /// value. If they are not, then an
  1418. /// <see cref="AssertionException"/> is thrown.
  1419. /// </summary>
  1420. /// <param name="arg1">The first value, expected to be greater</param>
  1421. /// <param name="arg2">The second value, expected to be less</param>
  1422. /// <param name="message">The message that will be displayed on failure</param>
  1423. /// <param name="args">Arguments to be used in formatting the message</param>
  1424. static public void Greater(float arg1,
  1425. float arg2, string message, params object[] args)
  1426. {
  1427. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1428. }
  1429. /// <summary>
  1430. /// Verifies that the first value is greater than the second
  1431. /// value. If they are not, then an
  1432. /// <see cref="AssertionException"/> is thrown.
  1433. /// </summary>
  1434. /// <param name="arg1">The first value, expected to be greater</param>
  1435. /// <param name="arg2">The second value, expected to be less</param>
  1436. /// <param name="message">The message that will be displayed on failure</param>
  1437. static public void Greater(float arg1, float arg2, string message)
  1438. {
  1439. Assert.Greater(arg1, arg2, message, null);
  1440. }
  1441. /// <summary>
  1442. /// Verifies that the first value is greater than the second
  1443. /// value. If they are not, then an
  1444. /// <see cref="AssertionException"/> is thrown.
  1445. /// </summary>
  1446. /// <param name="arg1">The first value, expected to be greater</param>
  1447. /// <param name="arg2">The second value, expected to be less</param>
  1448. static public void Greater(float arg1, float arg2)
  1449. {
  1450. Assert.Greater(arg1, arg2, string.Empty, null);
  1451. }
  1452. #endregion
  1453. #region IComparables
  1454. /// <summary>
  1455. /// Verifies that the first value is greater than the second
  1456. /// value. If they are not, then an
  1457. /// <see cref="AssertionException"/> is thrown.
  1458. /// </summary>
  1459. /// <param name="arg1">The first value, expected to be greater</param>
  1460. /// <param name="arg2">The second value, expected to be less</param>
  1461. /// <param name="message">The message that will be displayed on failure</param>
  1462. /// <param name="args">Arguments to be used in formatting the message</param>
  1463. static public void Greater(IComparable arg1,
  1464. IComparable arg2, string message, params object[] args)
  1465. {
  1466. Assert.That(arg1, Is.GreaterThan(arg2), message, args);
  1467. }
  1468. /// <summary>
  1469. /// Verifies that the first value is greater than the second
  1470. /// value. If they are not, then an
  1471. /// <see cref="AssertionException"/> is thrown.
  1472. /// </summary>
  1473. /// <param name="arg1">The first value, expected to be greater</param>
  1474. /// <param name="arg2">The second value, expected to be less</param>
  1475. /// <param name="message">The message that will be displayed on failure</param>
  1476. static public void Greater(IComparable arg1, IComparable arg2, string message)
  1477. {
  1478. Assert.Greater(arg1, arg2, message, null);
  1479. }
  1480. /// <summary>
  1481. /// Verifies that the first value is greater than the second
  1482. /// value. If they are not, then an
  1483. /// <see cref="AssertionException"/> is thrown.
  1484. /// </summary>
  1485. /// <param name="arg1">The first value, expected to be greater</param>
  1486. /// <param name="arg2">The second value, expected to be less</param>
  1487. static public void Greater(IComparable arg1, IComparable arg2)
  1488. {
  1489. Assert.Greater(arg1, arg2, string.Empty, null);
  1490. }
  1491. #endregion
  1492. #endregion
  1493. #region Less
  1494. #region Ints
  1495. /// <summary>
  1496. /// Verifies that the first value is less than the second
  1497. /// value. If it is not, then an
  1498. /// <see cref="AssertionException"/> is thrown.
  1499. /// </summary>
  1500. /// <param name="arg1">The first value, expected to be less</param>
  1501. /// <param name="arg2">The second value, expected to be greater</param>
  1502. /// <param name="message">The message that will be displayed on failure</param>
  1503. /// <param name="args">Arguments to be used in formatting the message</param>
  1504. static public void Less(int arg1, int arg2, string message, params object[] args)
  1505. {
  1506. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1507. }
  1508. /// <summary>
  1509. /// Verifies that the first value is less than the second
  1510. /// value. If it is not, then an
  1511. /// <see cref="AssertionException"/> is thrown.
  1512. /// </summary>
  1513. /// <param name="arg1">The first value, expected to be less</param>
  1514. /// <param name="arg2">The second value, expected to be greater</param>
  1515. /// <param name="message">The message that will be displayed on failure</param>
  1516. static public void Less(int arg1, int arg2, string message)
  1517. {
  1518. Assert.Less(arg1, arg2, message, null);
  1519. }
  1520. /// <summary>
  1521. /// Verifies that the first value is less than the second
  1522. /// value. If it is not, then an
  1523. /// <see cref="AssertionException"/> is thrown.
  1524. /// </summary>
  1525. /// <param name="arg1">The first value, expected to be less</param>
  1526. /// <param name="arg2">The second value, expected to be greater</param>
  1527. static public void Less(int arg1, int arg2)
  1528. {
  1529. Assert.Less( arg1, arg2, string.Empty, null);
  1530. }
  1531. #endregion
  1532. #region UInts
  1533. /// <summary>
  1534. /// Verifies that the first value is less than the second
  1535. /// value. If it is not, then an
  1536. /// <see cref="AssertionException"/> is thrown.
  1537. /// </summary>
  1538. /// <param name="arg1">The first value, expected to be less</param>
  1539. /// <param name="arg2">The second value, expected to be greater</param>
  1540. /// <param name="message">The message that will be displayed on failure</param>
  1541. /// <param name="args">Arguments to be used in formatting the message</param>
  1542. [CLSCompliant(false)]
  1543. static public void Less(uint arg1, uint arg2, string message, params object[] args)
  1544. {
  1545. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1546. }
  1547. /// <summary>
  1548. /// Verifies that the first value is less than the second
  1549. /// value. If it is not, then an
  1550. /// <see cref="AssertionException"/> is thrown.
  1551. /// </summary>
  1552. /// <param name="arg1">The first value, expected to be less</param>
  1553. /// <param name="arg2">The second value, expected to be greater</param>
  1554. /// <param name="message">The message that will be displayed on failure</param>
  1555. [CLSCompliant(false)]
  1556. static public void Less(uint arg1, uint arg2, string message)
  1557. {
  1558. Assert.Less(arg1, arg2, message, null);
  1559. }
  1560. /// <summary>
  1561. /// Verifies that the first value is less than the second
  1562. /// value. If it is not, then an
  1563. /// <see cref="AssertionException"/> is thrown.
  1564. /// </summary>
  1565. /// <param name="arg1">The first value, expected to be less</param>
  1566. /// <param name="arg2">The second value, expected to be greater</param>
  1567. [CLSCompliant(false)]
  1568. static public void Less(uint arg1, uint arg2)
  1569. {
  1570. Assert.Less( arg1, arg2, string.Empty, null);
  1571. }
  1572. #endregion
  1573. #region Longs
  1574. /// <summary>
  1575. /// Verifies that the first value is less than the second
  1576. /// value. If it is not, then an
  1577. /// <see cref="AssertionException"/> is thrown.
  1578. /// </summary>
  1579. /// <param name="arg1">The first value, expected to be less</param>
  1580. /// <param name="arg2">The second value, expected to be greater</param>
  1581. /// <param name="message">The message that will be displayed on failure</param>
  1582. /// <param name="args">Arguments to be used in formatting the message</param>
  1583. static public void Less(long arg1, long arg2, string message, params object[] args)
  1584. {
  1585. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1586. }
  1587. /// <summary>
  1588. /// Verifies that the first value is less than the second
  1589. /// value. If it is not, then an
  1590. /// <see cref="AssertionException"/> is thrown.
  1591. /// </summary>
  1592. /// <param name="arg1">The first value, expected to be less</param>
  1593. /// <param name="arg2">The second value, expected to be greater</param>
  1594. /// <param name="message">The message that will be displayed on failure</param>
  1595. static public void Less(long arg1, long arg2, string message)
  1596. {
  1597. Assert.Less(arg1, arg2, message, null);
  1598. }
  1599. /// <summary>
  1600. /// Verifies that the first value is less than the second
  1601. /// value. If it is not, then an
  1602. /// <see cref="AssertionException"/> is thrown.
  1603. /// </summary>
  1604. /// <param name="arg1">The first value, expected to be less</param>
  1605. /// <param name="arg2">The second value, expected to be greater</param>
  1606. static public void Less(long arg1, long arg2)
  1607. {
  1608. Assert.Less( arg1, arg2, string.Empty, null);
  1609. }
  1610. #endregion
  1611. #region ULongs
  1612. /// <summary>
  1613. /// Verifies that the first value is less than the second
  1614. /// value. If it is not, then an
  1615. /// <see cref="AssertionException"/> is thrown.
  1616. /// </summary>
  1617. /// <param name="arg1">The first value, expected to be less</param>
  1618. /// <param name="arg2">The second value, expected to be greater</param>
  1619. /// <param name="message">The message that will be displayed on failure</param>
  1620. /// <param name="args">Arguments to be used in formatting the message</param>
  1621. [CLSCompliant(false)]
  1622. static public void Less(ulong arg1, ulong arg2, string message, params object[] args)
  1623. {
  1624. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1625. }
  1626. /// <summary>
  1627. /// Verifies that the first value is less than the second
  1628. /// value. If it is not, then an
  1629. /// <see cref="AssertionException"/> is thrown.
  1630. /// </summary>
  1631. /// <param name="arg1">The first value, expected to be less</param>
  1632. /// <param name="arg2">The second value, expected to be greater</param>
  1633. /// <param name="message">The message that will be displayed on failure</param>
  1634. [CLSCompliant(false)]
  1635. static public void Less(ulong arg1, ulong arg2, string message)
  1636. {
  1637. Assert.Less(arg1, arg2, message, null);
  1638. }
  1639. /// <summary>
  1640. /// Verifies that the first value is less than the second
  1641. /// value. If it is not, then an
  1642. /// <see cref="AssertionException"/> is thrown.
  1643. /// </summary>
  1644. /// <param name="arg1">The first value, expected to be less</param>
  1645. /// <param name="arg2">The second value, expected to be greater</param>
  1646. [CLSCompliant(false)]
  1647. static public void Less(ulong arg1, ulong arg2)
  1648. {
  1649. Assert.Less( arg1, arg2, string.Empty, null);
  1650. }
  1651. #endregion
  1652. #region Decimals
  1653. /// <summary>
  1654. /// Verifies that the first value is less than the second
  1655. /// value. If it is not, then an
  1656. /// <see cref="AssertionException"/> is thrown.
  1657. /// </summary>
  1658. /// <param name="arg1">The first value, expected to be less</param>
  1659. /// <param name="arg2">The second value, expected to be greater</param>
  1660. /// <param name="message">The message that will be displayed on failure</param>
  1661. /// <param name="args">Arguments to be used in formatting the message</param>
  1662. static public void Less(decimal arg1, decimal arg2, string message, params object[] args)
  1663. {
  1664. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1665. }
  1666. /// <summary>
  1667. /// Verifies that the first value is less than the second
  1668. /// value. If it is not, then an
  1669. /// <see cref="AssertionException"/> is thrown.
  1670. /// </summary>
  1671. /// <param name="arg1">The first value, expected to be less</param>
  1672. /// <param name="arg2">The second value, expected to be greater</param>
  1673. /// <param name="message">The message that will be displayed on failure</param>
  1674. static public void Less(decimal arg1, decimal arg2, string message)
  1675. {
  1676. Assert.Less(arg1, arg2, message, null);
  1677. }
  1678. /// <summary>
  1679. /// Verifies that the first value is less than the second
  1680. /// value. If it is not, then an
  1681. /// <see cref="AssertionException"/> is thrown.
  1682. /// </summary>
  1683. /// <param name="arg1">The first value, expected to be less</param>
  1684. /// <param name="arg2">The second value, expected to be greater</param>
  1685. static public void Less(decimal arg1, decimal arg2)
  1686. {
  1687. Assert.Less(arg1, arg2, string.Empty, null);
  1688. }
  1689. #endregion
  1690. #region Doubles
  1691. /// <summary>
  1692. /// Verifies that the first value is less than the second
  1693. /// value. If it is not, then an
  1694. /// <see cref="AssertionException"/> is thrown.
  1695. /// </summary>
  1696. /// <param name="arg1">The first value, expected to be less</param>
  1697. /// <param name="arg2">The second value, expected to be greater</param>
  1698. /// <param name="message">The message that will be displayed on failure</param>
  1699. /// <param name="args">Arguments to be used in formatting the message</param>
  1700. static public void Less(double arg1, double arg2, string message, params object[] args)
  1701. {
  1702. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1703. }
  1704. /// <summary>
  1705. /// Verifies that the first value is less than the second
  1706. /// value. If it is not, then an
  1707. /// <see cref="AssertionException"/> is thrown.
  1708. /// </summary>
  1709. /// <param name="arg1">The first value, expected to be less</param>
  1710. /// <param name="arg2">The second value, expected to be greater</param>
  1711. /// <param name="message">The message that will be displayed on failure</param>
  1712. static public void Less(double arg1, double arg2, string message)
  1713. {
  1714. Assert.Less(arg1, arg2, message, null);
  1715. }
  1716. /// <summary>
  1717. /// Verifies that the first value is less than the second
  1718. /// value. If it is not, then an
  1719. /// <see cref="AssertionException"/> is thrown.
  1720. /// </summary>
  1721. /// <param name="arg1">The first value, expected to be less</param>
  1722. /// <param name="arg2">The second value, expected to be greater</param>
  1723. static public void Less(double arg1, double arg2)
  1724. {
  1725. Assert.Less(arg1, arg2, string.Empty, null);
  1726. }
  1727. #endregion
  1728. #region Floats
  1729. /// <summary>
  1730. /// Verifies that the first value is less than the second
  1731. /// value. If it is not, then an
  1732. /// <see cref="AssertionException"/> is thrown.
  1733. /// </summary>
  1734. /// <param name="arg1">The first value, expected to be less</param>
  1735. /// <param name="arg2">The second value, expected to be greater</param>
  1736. /// <param name="message">The message that will be displayed on failure</param>
  1737. /// <param name="args">Arguments to be used in formatting the message</param>
  1738. static public void Less(float arg1, float arg2, string message, params object[] args)
  1739. {
  1740. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1741. }
  1742. /// <summary>
  1743. /// Verifies that the first value is less than the second
  1744. /// value. If it is not, then an
  1745. /// <see cref="AssertionException"/> is thrown.
  1746. /// </summary>
  1747. /// <param name="arg1">The first value, expected to be less</param>
  1748. /// <param name="arg2">The second value, expected to be greater</param>
  1749. /// <param name="message">The message that will be displayed on failure</param>
  1750. static public void Less(float arg1, float arg2, string message)
  1751. {
  1752. Assert.Less(arg1, arg2, message, null);
  1753. }
  1754. /// <summary>
  1755. /// Verifies that the first value is less than the second
  1756. /// value. If it is not, then an
  1757. /// <see cref="AssertionException"/> is thrown.
  1758. /// </summary>
  1759. /// <param name="arg1">The first value, expected to be less</param>
  1760. /// <param name="arg2">The second value, expected to be greater</param>
  1761. static public void Less(float arg1, float arg2)
  1762. {
  1763. Assert.Less(arg1, arg2, string.Empty, null);
  1764. }
  1765. #endregion
  1766. #region IComparables
  1767. /// <summary>
  1768. /// Verifies that the first value is less than the second
  1769. /// value. If it is not, then an
  1770. /// <see cref="AssertionException"/> is thrown.
  1771. /// </summary>
  1772. /// <param name="arg1">The first value, expected to be less</param>
  1773. /// <param name="arg2">The second value, expected to be greater</param>
  1774. /// <param name="message">The message that will be displayed on failure</param>
  1775. /// <param name="args">Arguments to be used in formatting the message</param>
  1776. static public void Less(IComparable arg1, IComparable arg2, string message, params object[] args)
  1777. {
  1778. Assert.That(arg1, Is.LessThan(arg2), message, args);
  1779. }
  1780. /// <summary>
  1781. /// Verifies that the first value is less than the second
  1782. /// value. If it is not, then an
  1783. /// <see cref="AssertionException"/> is thrown.
  1784. /// </summary>
  1785. /// <param name="arg1">The first value, expected to be less</param>
  1786. /// <param name="arg2">The second value, expected to be greater</param>
  1787. /// <param name="message">The message that will be displayed on failure</param>
  1788. static public void Less(IComparable arg1, IComparable arg2, string message)
  1789. {
  1790. Assert.Less(arg1, arg2, message, null);
  1791. }
  1792. /// <summary>
  1793. /// Verifies that the first value is less than the second
  1794. /// value. If it is not, then an
  1795. /// <see cref="AssertionException"/> is thrown.
  1796. /// </summary>
  1797. /// <param name="arg1">The first value, expected to be less</param>
  1798. /// <param name="arg2">The second value, expected to be greater</param>
  1799. static public void Less(IComparable arg1, IComparable arg2)
  1800. {
  1801. Assert.Less(arg1, arg2, string.Empty, null);
  1802. }
  1803. #endregion
  1804. #endregion
  1805. #region Collection Containment
  1806. /// <summary>
  1807. /// Asserts that an object is contained in a list.
  1808. /// </summary>
  1809. /// <param name="expected">The expected object</param>
  1810. /// <param name="actual">The list to be examined</param>
  1811. /// <param name="message">The message to display in case of failure</param>
  1812. /// <param name="args">Arguments used in formatting the message</param>
  1813. static public void Contains( object expected, ICollection actual, string message, params object[] args )
  1814. {
  1815. Assert.That(actual, new CollectionContainsConstraint(expected), message, args);
  1816. }
  1817. /// <summary>
  1818. /// Asserts that an object is contained in a list.
  1819. /// </summary>
  1820. /// <param name="expected">The expected object</param>
  1821. /// <param name="actual">The list to be examined</param>
  1822. /// <param name="message">The message to display in case of failure</param>
  1823. static public void Contains( object expected, ICollection actual, string message )
  1824. {
  1825. Contains( expected, actual, message, null );
  1826. }
  1827. /// <summary>
  1828. /// Asserts that an object is contained in a list.
  1829. /// </summary>
  1830. /// <param name="expected">The expected object</param>
  1831. /// <param name="actual">The list to be examined</param>
  1832. static public void Contains( object expected, ICollection actual )
  1833. {
  1834. Contains( expected, actual, string.Empty, null );
  1835. }
  1836. #endregion
  1837. #region Fail
  1838. /// <summary>
  1839. /// Throws an <see cref="AssertionException"/> with the message and arguments
  1840. /// that are passed in. This is used by the other Assert functions.
  1841. /// </summary>
  1842. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  1843. /// <param name="args">Arguments to be used in formatting the message</param>
  1844. static public void Fail(string message, params object[] args )
  1845. {
  1846. if (message == null) message = string.Empty;
  1847. else if ( args != null && args.Length > 0 )
  1848. message = string.Format( message, args );
  1849. throw new AssertionException(message);
  1850. }
  1851. /// <summary>
  1852. /// Throws an <see cref="AssertionException"/> with the message that is
  1853. /// passed in. This is used by the other Assert functions.
  1854. /// </summary>
  1855. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  1856. static public void Fail(string message)
  1857. {
  1858. Assert.Fail(message, null);
  1859. }
  1860. /// <summary>
  1861. /// Throws an <see cref="AssertionException"/>.
  1862. /// This is used by the other Assert functions.
  1863. /// </summary>
  1864. static public void Fail()
  1865. {
  1866. Assert.Fail(string.Empty, null);
  1867. }
  1868. #endregion
  1869. #region Ignore
  1870. /// <summary>
  1871. /// Throws an <see cref="IgnoreException"/> with the message and arguments
  1872. /// that are passed in. This causes the test to be reported as ignored.
  1873. /// </summary>
  1874. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  1875. /// <param name="args">Arguments to be used in formatting the message</param>
  1876. static public void Ignore( string message, params object[] args )
  1877. {
  1878. if (message == null) message = string.Empty;
  1879. else if ( args != null && args.Length > 0 )
  1880. message = string.Format( message, args );
  1881. throw new IgnoreException(message);
  1882. }
  1883. /// <summary>
  1884. /// Throws an <see cref="IgnoreException"/> with the message that is
  1885. /// passed in. This causes the test to be reported as ignored.
  1886. /// </summary>
  1887. /// <param name="message">The message to initialize the <see cref="AssertionException"/> with.</param>
  1888. static public void Ignore( string message )
  1889. {
  1890. Assert.Ignore( message, null );
  1891. }
  1892. /// <summary>
  1893. /// Throws an <see cref="IgnoreException"/>.
  1894. /// This causes the test to be reported as ignored.
  1895. /// </summary>
  1896. static public void Ignore()
  1897. {
  1898. Assert.Ignore( string.Empty, null );
  1899. }
  1900. #endregion
  1901. #region DoAssert
  1902. /// <summary>
  1903. /// NOTE: The use of asserters for extending NUnit has
  1904. /// now been replaced by the use of constraints. This
  1905. /// method is marked obsolete.
  1906. ///
  1907. /// Test the condition asserted by an asserter and throw
  1908. /// an assertion exception using provided message on failure.
  1909. /// </summary>
  1910. /// <param name="asserter">An object that implements IAsserter</param>
  1911. [Obsolete("Use Constraints rather than Asserters for new work")]
  1912. static public void DoAssert( IAsserter asserter )
  1913. {
  1914. Assert.IncrementAssertCount();
  1915. if ( !asserter.Test() )
  1916. throw new AssertionException( asserter.Message );
  1917. }
  1918. #endregion
  1919. #region That
  1920. /// <summary>
  1921. /// Apply a constraint to an actual value, succeeding if the constraint
  1922. /// is satisfied and throwing an assertion exception on failure.
  1923. /// </summary>
  1924. /// <param name="constraint">A Constraint to be applied</param>
  1925. /// <param name="actual">The actual value to test</param>
  1926. static public void That( object actual, Constraint constraint )
  1927. {
  1928. Assert.That( actual, constraint, null, null );
  1929. }
  1930. /// <summary>
  1931. /// Apply a constraint to an actual value, succeedingt if the constraint
  1932. /// is satisfied and throwing an assertion exception on failure.
  1933. /// </summary>
  1934. /// <param name="constraint">A Constraint to be applied</param>
  1935. /// <param name="actual">The actual value to test</param>
  1936. /// <param name="message">The message that will be displayed on failure</param>
  1937. static public void That( object actual, Constraint constraint, string message )
  1938. {
  1939. Assert.That( actual, constraint, message, null );
  1940. }
  1941. /// <summary>
  1942. /// Apply a constraint to an actual value, succeedingt if the constraint
  1943. /// is satisfied and throwing an assertion exception on failure.
  1944. /// </summary>
  1945. /// <param name="constraint">A Constraint to be applied</param>
  1946. /// <param name="actual">The actual value to test</param>
  1947. /// <param name="message">The message that will be displayed on failure</param>
  1948. /// <param name="args">Arguments to be used in formatting the message</param>
  1949. static public void That( object actual, Constraint constraint, string message, params object[] args )
  1950. {
  1951. Assert.IncrementAssertCount();
  1952. if ( !constraint.Matches( actual ) )
  1953. {
  1954. MessageWriter writer = new TextMessageWriter( message, args );
  1955. constraint.WriteMessageTo( writer );
  1956. throw new AssertionException( writer.ToString() );
  1957. }
  1958. }
  1959. /// <summary>
  1960. /// Asserts that a condition is true. If the condition is false the method throws
  1961. /// an <see cref="AssertionException"/>.
  1962. /// </summary>
  1963. /// <param name="condition">The evaluated condition</param>
  1964. /// <param name="message">The message to display if the condition is false</param>
  1965. /// <param name="args">Arguments to be used in formatting the message</param>
  1966. static public void That(bool condition, string message, params object[] args)
  1967. {
  1968. Assert.That(condition, Is.True, message, args);
  1969. }
  1970. /// <summary>
  1971. /// Asserts that a condition is true. If the condition is false the method throws
  1972. /// an <see cref="AssertionException"/>.
  1973. /// </summary>
  1974. /// <param name="condition">The evaluated condition</param>
  1975. /// <param name="message">The message to display if the condition is false</param>
  1976. static public void That(bool condition, string message)
  1977. {
  1978. Assert.That(condition, Is.True, message, null);
  1979. }
  1980. /// <summary>
  1981. /// Asserts that a condition is true. If the condition is false the method throws
  1982. /// an <see cref="AssertionException"/>.
  1983. /// </summary>
  1984. /// <param name="condition">The evaluated condition</param>
  1985. static public void That(bool condition)
  1986. {
  1987. Assert.That(condition, Is.True, null, null);
  1988. }
  1989. #endregion
  1990. #region GreaterOrEqual
  1991. #region Ints
  1992. /// <summary>
  1993. /// Verifies that the first value is greater than or equal to the second
  1994. /// value. If they are not, then an
  1995. /// <see cref="AssertionException"/> is thrown.
  1996. /// </summary>
  1997. /// <param name="arg1">The first value, expected to be greater</param>
  1998. /// <param name="arg2">The second value, expected to be less</param>
  1999. /// <param name="message">The message that will be displayed on failure</param>
  2000. /// <param name="args">Arguments to be used in formatting the message</param>
  2001. static public void GreaterOrEqual(int arg1,
  2002. int arg2, string message, params object[] args)
  2003. {
  2004. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2005. }
  2006. /// <summary>
  2007. /// Verifies that the first value is greater than or equal to the second
  2008. /// value. If they are not, then an
  2009. /// <see cref="AssertionException"/> is thrown.
  2010. /// </summary>
  2011. /// <param name="arg1">The first value, expected to be greater</param>
  2012. /// <param name="arg2">The second value, expected to be less</param>
  2013. /// <param name="message">The message that will be displayed on failure</param>
  2014. static public void GreaterOrEqual(int arg1, int arg2, string message)
  2015. {
  2016. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2017. }
  2018. /// <summary>
  2019. /// Verifies that the first value is greater than or equal to the second
  2020. /// value. If they are not, then an
  2021. /// <see cref="AssertionException"/> is thrown.
  2022. /// </summary>
  2023. /// <param name="arg1">The first value, expected to be greater</param>
  2024. /// <param name="arg2">The second value, expected to be less</param>
  2025. static public void GreaterOrEqual(int arg1, int arg2)
  2026. {
  2027. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2028. }
  2029. #endregion
  2030. #region UInts
  2031. /// <summary>
  2032. /// Verifies that the first value is greater than or equal to the second
  2033. /// value. If they are not, then an
  2034. /// <see cref="AssertionException"/> is thrown.
  2035. /// </summary>
  2036. /// <param name="arg1">The first value, expected to be greater</param>
  2037. /// <param name="arg2">The second value, expected to be less</param>
  2038. /// <param name="message">The message that will be displayed on failure</param>
  2039. /// <param name="args">Arguments to be used in formatting the message</param>
  2040. [CLSCompliant(false)]
  2041. static public void GreaterOrEqual(uint arg1,
  2042. uint arg2, string message, params object[] args)
  2043. {
  2044. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2045. }
  2046. /// <summary>
  2047. /// Verifies that the first value is greater than or equal to the second
  2048. /// value. If they are not, then an
  2049. /// <see cref="AssertionException"/> is thrown.
  2050. /// </summary>
  2051. /// <param name="arg1">The first value, expected to be greater</param>
  2052. /// <param name="arg2">The second value, expected to be less</param>
  2053. /// <param name="message">The message that will be displayed on failure</param>
  2054. [CLSCompliant(false)]
  2055. static public void GreaterOrEqual(uint arg1, uint arg2, string message)
  2056. {
  2057. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2058. }
  2059. /// <summary>
  2060. /// Verifies that the first value is greater or equal to than the second
  2061. /// value. If they are not, then an
  2062. /// <see cref="AssertionException"/> is thrown.
  2063. /// </summary>
  2064. /// <param name="arg1">The first value, expected to be greater</param>
  2065. /// <param name="arg2">The second value, expected to be less</param>
  2066. [CLSCompliant(false)]
  2067. static public void GreaterOrEqual(uint arg1, uint arg2)
  2068. {
  2069. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2070. }
  2071. #endregion
  2072. #region Longs
  2073. /// <summary>
  2074. /// Verifies that the first value is greater than or equal to the second
  2075. /// value. If they are not, then an
  2076. /// <see cref="AssertionException"/> is thrown.
  2077. /// </summary>
  2078. /// <param name="arg1">The first value, expected to be greater</param>
  2079. /// <param name="arg2">The second value, expected to be less</param>
  2080. /// <param name="message">The message that will be displayed on failure</param>
  2081. /// <param name="args">Arguments to be used in formatting the message</param>
  2082. static public void GreaterOrEqual(long arg1,
  2083. long arg2, string message, params object[] args)
  2084. {
  2085. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2086. }
  2087. /// <summary>
  2088. /// Verifies that the first value is greater than or equal to the second
  2089. /// value. If they are not, then an
  2090. /// <see cref="AssertionException"/> is thrown.
  2091. /// </summary>
  2092. /// <param name="arg1">The first value, expected to be greater</param>
  2093. /// <param name="arg2">The second value, expected to be less</param>
  2094. /// <param name="message">The message that will be displayed on failure</param>
  2095. static public void GreaterOrEqual(long arg1, long arg2, string message)
  2096. {
  2097. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2098. }
  2099. /// <summary>
  2100. /// Verifies that the first value is greater or equal to than the second
  2101. /// value. If they are not, then an
  2102. /// <see cref="AssertionException"/> is thrown.
  2103. /// </summary>
  2104. /// <param name="arg1">The first value, expected to be greater</param>
  2105. /// <param name="arg2">The second value, expected to be less</param>
  2106. static public void GreaterOrEqual(long arg1, long arg2)
  2107. {
  2108. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2109. }
  2110. #endregion
  2111. #region ULongs
  2112. /// <summary>
  2113. /// Verifies that the first value is greater than or equal to the second
  2114. /// value. If they are not, then an
  2115. /// <see cref="AssertionException"/> is thrown.
  2116. /// </summary>
  2117. /// <param name="arg1">The first value, expected to be greater</param>
  2118. /// <param name="arg2">The second value, expected to be less</param>
  2119. /// <param name="message">The message that will be displayed on failure</param>
  2120. /// <param name="args">Arguments to be used in formatting the message</param>
  2121. [CLSCompliant(false)]
  2122. static public void GreaterOrEqual(ulong arg1,
  2123. ulong arg2, string message, params object[] args)
  2124. {
  2125. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2126. }
  2127. /// <summary>
  2128. /// Verifies that the first value is greater than or equal to the second
  2129. /// value. If they are not, then an
  2130. /// <see cref="AssertionException"/> is thrown.
  2131. /// </summary>
  2132. /// <param name="arg1">The first value, expected to be greater</param>
  2133. /// <param name="arg2">The second value, expected to be less</param>
  2134. /// <param name="message">The message that will be displayed on failure</param>
  2135. [CLSCompliant(false)]
  2136. static public void GreaterOrEqual(ulong arg1, ulong arg2, string message)
  2137. {
  2138. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2139. }
  2140. /// <summary>
  2141. /// Verifies that the first value is greater or equal to than the second
  2142. /// value. If they are not, then an
  2143. /// <see cref="AssertionException"/> is thrown.
  2144. /// </summary>
  2145. /// <param name="arg1">The first value, expected to be greater</param>
  2146. /// <param name="arg2">The second value, expected to be less</param>
  2147. [CLSCompliant(false)]
  2148. static public void GreaterOrEqual(ulong arg1, ulong arg2)
  2149. {
  2150. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2151. }
  2152. #endregion
  2153. #region Decimals
  2154. /// <summary>
  2155. /// Verifies that the first value is greater than or equal to the second
  2156. /// value. If they are not, then an
  2157. /// <see cref="AssertionException"/> is thrown.
  2158. /// </summary>
  2159. /// <param name="arg1">The first value, expected to be greater</param>
  2160. /// <param name="arg2">The second value, expected to be less</param>
  2161. /// <param name="message">The message that will be displayed on failure</param>
  2162. /// <param name="args">Arguments to be used in formatting the message</param>
  2163. static public void GreaterOrEqual(decimal arg1,
  2164. decimal arg2, string message, params object[] args)
  2165. {
  2166. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2167. }
  2168. /// <summary>
  2169. /// Verifies that the first value is greater than or equal to the second
  2170. /// value. If they are not, then an
  2171. /// <see cref="AssertionException"/> is thrown.
  2172. /// </summary>
  2173. /// <param name="arg1">The first value, expected to be greater</param>
  2174. /// <param name="arg2">The second value, expected to be less</param>
  2175. /// <param name="message">The message that will be displayed on failure</param>
  2176. static public void GreaterOrEqual(decimal arg1, decimal arg2, string message)
  2177. {
  2178. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2179. }
  2180. /// <summary>
  2181. /// Verifies that the first value is greater than or equal to the second
  2182. /// value. If they are not, then an
  2183. /// <see cref="AssertionException"/> is thrown.
  2184. /// </summary>
  2185. /// <param name="arg1">The first value, expected to be greater</param>
  2186. /// <param name="arg2">The second value, expected to be less</param>
  2187. static public void GreaterOrEqual(decimal arg1, decimal arg2)
  2188. {
  2189. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2190. }
  2191. #endregion
  2192. #region Doubles
  2193. /// <summary>
  2194. /// Verifies that the first value is greater than or equal to the second
  2195. /// value. If they are not, then an
  2196. /// <see cref="AssertionException"/> is thrown.
  2197. /// </summary>
  2198. /// <param name="arg1">The first value, expected to be greater</param>
  2199. /// <param name="arg2">The second value, expected to be less</param>
  2200. /// <param name="message">The message that will be displayed on failure</param>
  2201. /// <param name="args">Arguments to be used in formatting the message</param>
  2202. static public void GreaterOrEqual(double arg1,
  2203. double arg2, string message, params object[] args)
  2204. {
  2205. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2206. }
  2207. /// <summary>
  2208. /// Verifies that the first value is greater than or equal to the second
  2209. /// value. If they are not, then an
  2210. /// <see cref="AssertionException"/> is thrown.
  2211. /// </summary>
  2212. /// <param name="arg1">The first value, expected to be greater</param>
  2213. /// <param name="arg2">The second value, expected to be less</param>
  2214. /// <param name="message">The message that will be displayed on failure</param>
  2215. static public void GreaterOrEqual(double arg1,
  2216. double arg2, string message)
  2217. {
  2218. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2219. }
  2220. /// <summary>
  2221. /// Verifies that the first value is greater than or equal to the second
  2222. /// value. If they are not, then an
  2223. /// <see cref="AssertionException"/> is thrown.
  2224. /// </summary>
  2225. /// <param name="arg1">The first value, expected to be greater</param>
  2226. /// <param name="arg2">The second value, expected to be less</param>
  2227. static public void GreaterOrEqual(double arg1, double arg2)
  2228. {
  2229. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2230. }
  2231. #endregion
  2232. #region Floats
  2233. /// <summary>
  2234. /// Verifies that the first value is greater than or equal to the second
  2235. /// value. If they are not, then an
  2236. /// <see cref="AssertionException"/> is thrown.
  2237. /// </summary>
  2238. /// <param name="arg1">The first value, expected to be greater</param>
  2239. /// <param name="arg2">The second value, expected to be less</param>
  2240. /// <param name="message">The message that will be displayed on failure</param>
  2241. /// <param name="args">Arguments to be used in formatting the message</param>
  2242. static public void GreaterOrEqual(float arg1,
  2243. float arg2, string message, params object[] args)
  2244. {
  2245. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2246. }
  2247. /// <summary>
  2248. /// Verifies that the first value is greater than or equal to the second
  2249. /// value. If they are not, then an
  2250. /// <see cref="AssertionException"/> is thrown.
  2251. /// </summary>
  2252. /// <param name="arg1">The first value, expected to be greater</param>
  2253. /// <param name="arg2">The second value, expected to be less</param>
  2254. /// <param name="message">The message that will be displayed on failure</param>
  2255. static public void GreaterOrEqual(float arg1, float arg2, string message)
  2256. {
  2257. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2258. }
  2259. /// <summary>
  2260. /// Verifies that the first value is greater than or equal to the second
  2261. /// value. If they are not, then an
  2262. /// <see cref="AssertionException"/> is thrown.
  2263. /// </summary>
  2264. /// <param name="arg1">The first value, expected to be greater</param>
  2265. /// <param name="arg2">The second value, expected to be less</param>
  2266. static public void GreaterOrEqual(float arg1, float arg2)
  2267. {
  2268. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2269. }
  2270. #endregion
  2271. #region IComparables
  2272. /// <summary>
  2273. /// Verifies that the first value is greater than the second
  2274. /// value. If they are not, then an
  2275. /// <see cref="AssertionException"/> is thrown.
  2276. /// </summary>
  2277. /// <param name="arg1">The first value, expected to be greater</param>
  2278. /// <param name="arg2">The second value, expected to be less</param>
  2279. /// <param name="message">The message that will be displayed on failure</param>
  2280. /// <param name="args">Arguments to be used in formatting the message</param>
  2281. static public void GreaterOrEqual(IComparable arg1,
  2282. IComparable arg2, string message, params object[] args)
  2283. {
  2284. Assert.That(arg1, Is.GreaterThanOrEqualTo(arg2), message, args);
  2285. }
  2286. /// <summary>
  2287. /// Verifies that the first value is greater than the second
  2288. /// value. If they are not, then an
  2289. /// <see cref="AssertionException"/> is thrown.
  2290. /// </summary>
  2291. /// <param name="arg1">The first value, expected to be greater</param>
  2292. /// <param name="arg2">The second value, expected to be less</param>
  2293. /// <param name="message">The message that will be displayed on failure</param>
  2294. static public void GreaterOrEqual(IComparable arg1, IComparable arg2, string message)
  2295. {
  2296. Assert.GreaterOrEqual(arg1, arg2, message, null);
  2297. }
  2298. /// <summary>
  2299. /// Verifies that the first value is greater than the second
  2300. /// value. If they are not, then an
  2301. /// <see cref="AssertionException"/> is thrown.
  2302. /// </summary>
  2303. /// <param name="arg1">The first value, expected to be greater</param>
  2304. /// <param name="arg2">The second value, expected to be less</param>
  2305. static public void GreaterOrEqual(IComparable arg1, IComparable arg2)
  2306. {
  2307. Assert.GreaterOrEqual(arg1, arg2, string.Empty, null);
  2308. }
  2309. #endregion
  2310. #endregion
  2311. #region LessOrEqual
  2312. #region Ints
  2313. /// <summary>
  2314. /// Verifies that the first value is less than or equal to the second
  2315. /// value. If it is not, then an
  2316. /// <see cref="AssertionException"/> is thrown.
  2317. /// </summary>
  2318. /// <param name="arg1">The first value, expected to be less</param>
  2319. /// <param name="arg2">The second value, expected to be greater</param>
  2320. /// <param name="message">The message that will be displayed on failure</param>
  2321. /// <param name="args">Arguments to be used in formatting the message</param>
  2322. static public void LessOrEqual(int arg1, int arg2, string message, params object[] args)
  2323. {
  2324. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2325. }
  2326. /// <summary>
  2327. /// Verifies that the first value is less than or equal to the second
  2328. /// value. If it is not, then an
  2329. /// <see cref="AssertionException"/> is thrown.
  2330. /// </summary>
  2331. /// <param name="arg1">The first value, expected to be less</param>
  2332. /// <param name="arg2">The second value, expected to be greater</param>
  2333. /// <param name="message">The message that will be displayed on failure</param>
  2334. static public void LessOrEqual(int arg1, int arg2, string message)
  2335. {
  2336. Assert.LessOrEqual(arg1, arg2, message, null);
  2337. }
  2338. /// <summary>
  2339. /// Verifies that the first value is less than or equal to the second
  2340. /// value. If it is not, then an
  2341. /// <see cref="AssertionException"/> is thrown.
  2342. /// </summary>
  2343. /// <param name="arg1">The first value, expected to be less</param>
  2344. /// <param name="arg2">The second value, expected to be greater</param>
  2345. static public void LessOrEqual(int arg1, int arg2)
  2346. {
  2347. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2348. }
  2349. #endregion
  2350. #region UInts
  2351. /// <summary>
  2352. /// Verifies that the first value is less than or equal to the second
  2353. /// value. If it is not, then an
  2354. /// <see cref="AssertionException"/> is thrown.
  2355. /// </summary>
  2356. /// <param name="arg1">The first value, expected to be less</param>
  2357. /// <param name="arg2">The second value, expected to be greater</param>
  2358. /// <param name="message">The message that will be displayed on failure</param>
  2359. /// <param name="args">Arguments to be used in formatting the message</param>
  2360. [CLSCompliant(false)]
  2361. static public void LessOrEqual(uint arg1, uint arg2, string message, params object[] args)
  2362. {
  2363. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2364. }
  2365. /// <summary>
  2366. /// Verifies that the first value is less than or equal to the second
  2367. /// value. If it is not, then an
  2368. /// <see cref="AssertionException"/> is thrown.
  2369. /// </summary>
  2370. /// <param name="arg1">The first value, expected to be less</param>
  2371. /// <param name="arg2">The second value, expected to be greater</param>
  2372. /// <param name="message">The message that will be displayed on failure</param>
  2373. [CLSCompliant(false)]
  2374. static public void LessOrEqual(uint arg1, uint arg2, string message)
  2375. {
  2376. Assert.LessOrEqual(arg1, arg2, message, null);
  2377. }
  2378. /// <summary>
  2379. /// Verifies that the first value is less than or equal to the second
  2380. /// value. If it is not, then an
  2381. /// <see cref="AssertionException"/> is thrown.
  2382. /// </summary>
  2383. /// <param name="arg1">The first value, expected to be less</param>
  2384. /// <param name="arg2">The second value, expected to be greater</param>
  2385. [CLSCompliant(false)]
  2386. static public void LessOrEqual(uint arg1, uint arg2)
  2387. {
  2388. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2389. }
  2390. #endregion
  2391. #region Longs
  2392. /// <summary>
  2393. /// Verifies that the first value is less than or equal to the second
  2394. /// value. If it is not, then an
  2395. /// <see cref="AssertionException"/> is thrown.
  2396. /// </summary>
  2397. /// <param name="arg1">The first value, expected to be less</param>
  2398. /// <param name="arg2">The second value, expected to be greater</param>
  2399. /// <param name="message">The message that will be displayed on failure</param>
  2400. /// <param name="args">Arguments to be used in formatting the message</param>
  2401. static public void LessOrEqual(long arg1, long arg2, string message, params object[] args)
  2402. {
  2403. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2404. }
  2405. /// <summary>
  2406. /// Verifies that the first value is less than or equal to the second
  2407. /// value. If it is not, then an
  2408. /// <see cref="AssertionException"/> is thrown.
  2409. /// </summary>
  2410. /// <param name="arg1">The first value, expected to be less</param>
  2411. /// <param name="arg2">The second value, expected to be greater</param>
  2412. /// <param name="message">The message that will be displayed on failure</param>
  2413. static public void LessOrEqual(long arg1, long arg2, string message)
  2414. {
  2415. Assert.LessOrEqual(arg1, arg2, message, null);
  2416. }
  2417. /// <summary>
  2418. /// Verifies that the first value is less than or equal to the second
  2419. /// value. If it is not, then an
  2420. /// <see cref="AssertionException"/> is thrown.
  2421. /// </summary>
  2422. /// <param name="arg1">The first value, expected to be less</param>
  2423. /// <param name="arg2">The second value, expected to be greater</param>
  2424. static public void LessOrEqual(long arg1, long arg2)
  2425. {
  2426. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2427. }
  2428. #endregion
  2429. #region ULongs
  2430. /// <summary>
  2431. /// Verifies that the first value is less than or equal to the second
  2432. /// value. If it is not, then an
  2433. /// <see cref="AssertionException"/> is thrown.
  2434. /// </summary>
  2435. /// <param name="arg1">The first value, expected to be less</param>
  2436. /// <param name="arg2">The second value, expected to be greater</param>
  2437. /// <param name="message">The message that will be displayed on failure</param>
  2438. /// <param name="args">Arguments to be used in formatting the message</param>
  2439. [CLSCompliant(false)]
  2440. static public void LessOrEqual(ulong arg1, ulong arg2, string message, params object[] args)
  2441. {
  2442. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2443. }
  2444. /// <summary>
  2445. /// Verifies that the first value is less than or equal to the second
  2446. /// value. If it is not, then an
  2447. /// <see cref="AssertionException"/> is thrown.
  2448. /// </summary>
  2449. /// <param name="arg1">The first value, expected to be less</param>
  2450. /// <param name="arg2">The second value, expected to be greater</param>
  2451. /// <param name="message">The message that will be displayed on failure</param>
  2452. [CLSCompliant(false)]
  2453. static public void LessOrEqual(ulong arg1, ulong arg2, string message)
  2454. {
  2455. Assert.LessOrEqual(arg1, arg2, message, null);
  2456. }
  2457. /// <summary>
  2458. /// Verifies that the first value is less than or equal to the second
  2459. /// value. If it is not, then an
  2460. /// <see cref="AssertionException"/> is thrown.
  2461. /// </summary>
  2462. /// <param name="arg1">The first value, expected to be less</param>
  2463. /// <param name="arg2">The second value, expected to be greater</param>
  2464. [CLSCompliant(false)]
  2465. static public void LessOrEqual(ulong arg1, ulong arg2)
  2466. {
  2467. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2468. }
  2469. #endregion
  2470. #region Decimals
  2471. /// <summary>
  2472. /// Verifies that the first value is less than or equal to the second
  2473. /// value. If it is not, then an
  2474. /// <see cref="AssertionException"/> is thrown.
  2475. /// </summary>
  2476. /// <param name="arg1">The first value, expected to be less</param>
  2477. /// <param name="arg2">The second value, expected to be greater</param>
  2478. /// <param name="message">The message that will be displayed on failure</param>
  2479. /// <param name="args">Arguments to be used in formatting the message</param>
  2480. static public void LessOrEqual(decimal arg1, decimal arg2, string message, params object[] args)
  2481. {
  2482. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2483. }
  2484. /// <summary>
  2485. /// Verifies that the first value is less than or equal to the second
  2486. /// value. If it is not, then an
  2487. /// <see cref="AssertionException"/> is thrown.
  2488. /// </summary>
  2489. /// <param name="arg1">The first value, expected to be less</param>
  2490. /// <param name="arg2">The second value, expected to be greater</param>
  2491. /// <param name="message">The message that will be displayed on failure</param>
  2492. static public void LessOrEqual(decimal arg1, decimal arg2, string message)
  2493. {
  2494. Assert.LessOrEqual(arg1, arg2, message, null);
  2495. }
  2496. /// <summary>
  2497. /// Verifies that the first value is less than or equal to the second
  2498. /// value. If it is not, then an
  2499. /// <see cref="AssertionException"/> is thrown.
  2500. /// </summary>
  2501. /// <param name="arg1">The first value, expected to be less</param>
  2502. /// <param name="arg2">The second value, expected to be greater</param>
  2503. static public void LessOrEqual(decimal arg1, decimal arg2)
  2504. {
  2505. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2506. }
  2507. #endregion
  2508. #region Doubles
  2509. /// <summary>
  2510. /// Verifies that the first value is less than or equal to the second
  2511. /// value. If it is not, then an
  2512. /// <see cref="AssertionException"/> is thrown.
  2513. /// </summary>
  2514. /// <param name="arg1">The first value, expected to be less</param>
  2515. /// <param name="arg2">The second value, expected to be greater</param>
  2516. /// <param name="message">The message that will be displayed on failure</param>
  2517. /// <param name="args">Arguments to be used in formatting the message</param>
  2518. static public void LessOrEqual(double arg1, double arg2, string message, params object[] args)
  2519. {
  2520. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2521. }
  2522. /// <summary>
  2523. /// Verifies that the first value is less than or equal to the second
  2524. /// value. If it is not, then an
  2525. /// <see cref="AssertionException"/> is thrown.
  2526. /// </summary>
  2527. /// <param name="arg1">The first value, expected to be less</param>
  2528. /// <param name="arg2">The second value, expected to be greater</param>
  2529. /// <param name="message">The message that will be displayed on failure</param>
  2530. static public void LessOrEqual(double arg1, double arg2, string message)
  2531. {
  2532. Assert.LessOrEqual(arg1, arg2, message, null);
  2533. }
  2534. /// <summary>
  2535. /// Verifies that the first value is less than or equal to the second
  2536. /// value. If it is not, then an
  2537. /// <see cref="AssertionException"/> is thrown.
  2538. /// </summary>
  2539. /// <param name="arg1">The first value, expected to be less</param>
  2540. /// <param name="arg2">The second value, expected to be greater</param>
  2541. static public void LessOrEqual(double arg1, double arg2)
  2542. {
  2543. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2544. }
  2545. #endregion
  2546. #region Floats
  2547. /// <summary>
  2548. /// Verifies that the first value is less than or equal to the second
  2549. /// value. If it is not, then an
  2550. /// <see cref="AssertionException"/> is thrown.
  2551. /// </summary>
  2552. /// <param name="arg1">The first value, expected to be less</param>
  2553. /// <param name="arg2">The second value, expected to be greater</param>
  2554. /// <param name="message">The message that will be displayed on failure</param>
  2555. /// <param name="args">Arguments to be used in formatting the message</param>
  2556. static public void LessOrEqual(float arg1, float arg2, string message, params object[] args)
  2557. {
  2558. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2559. }
  2560. /// <summary>
  2561. /// Verifies that the first value is less than or equal to 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 that will be displayed on failure</param>
  2568. static public void LessOrEqual(float arg1, float arg2, string message)
  2569. {
  2570. Assert.LessOrEqual(arg1, arg2, message, null);
  2571. }
  2572. /// <summary>
  2573. /// Verifies that the first value is less than or equal to the second
  2574. /// value. If it is not, then an
  2575. /// <see cref="AssertionException"/> is thrown.
  2576. /// </summary>
  2577. /// <param name="arg1">The first value, expected to be less</param>
  2578. /// <param name="arg2">The second value, expected to be greater</param>
  2579. static public void LessOrEqual(float arg1, float arg2)
  2580. {
  2581. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2582. }
  2583. #endregion
  2584. #region IComparables
  2585. /// <summary>
  2586. /// Verifies that the first value is less than or equal to 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. /// <param name="message">The message that will be displayed on failure</param>
  2593. /// <param name="args">Arguments to be used in formatting the message</param>
  2594. static public void LessOrEqual(IComparable arg1, IComparable arg2, string message, params object[] args)
  2595. {
  2596. Assert.That(arg1, Is.LessThanOrEqualTo(arg2), message, args);
  2597. }
  2598. /// <summary>
  2599. /// Verifies that the first value is less than or equal to the second
  2600. /// value. If it is not, then an
  2601. /// <see cref="AssertionException"/> is thrown.
  2602. /// </summary>
  2603. /// <param name="arg1">The first value, expected to be less</param>
  2604. /// <param name="arg2">The second value, expected to be greater</param>
  2605. /// <param name="message">The message that will be displayed on failure</param>
  2606. static public void LessOrEqual(IComparable arg1, IComparable arg2, string message)
  2607. {
  2608. Assert.LessOrEqual(arg1, arg2, message, null);
  2609. }
  2610. /// <summary>
  2611. /// Verifies that the first value is less than or equal to 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. static public void LessOrEqual(IComparable arg1, IComparable arg2)
  2618. {
  2619. Assert.LessOrEqual(arg1, arg2, string.Empty, null);
  2620. }
  2621. #endregion
  2622. #endregion
  2623. }
  2624. }