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