-
Notifications
You must be signed in to change notification settings - Fork 161
Updated EqualTo constraint #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
35c559e
122021f
3a94cbc
4191f42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,13 +12,13 @@ | |
| [Test] | ||
| public void EqualConstraint_Numerics() | ||
| { | ||
| Assert.That(2 + 2, Is.EqualTo(4.0)); | ||
|
Check warning on line 15 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| Assert.That(2 + 2 == 4); | ||
| Assert.That(2 + 2, Is.Not.EqualTo(5)); | ||
|
Check warning on line 17 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| Assert.That(2 + 2 != 5); | ||
| Assert.That(5.0, Is.EqualTo(5)); | ||
|
Check warning on line 19 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| Assert.That(5.5, Is.EqualTo(5).Within(0.5)); | ||
|
Check warning on line 20 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| Assert.That(5.5, Is.EqualTo(5).Within(10).Percent); | ||
|
Check warning on line 21 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| } | ||
| #endregion | ||
|
|
||
|
|
@@ -26,11 +26,11 @@ | |
| [Test] | ||
| public void EqualConstraint_FloatingPoint() | ||
| { | ||
| Assert.That(2.1 + 1.2, Is.EqualTo(3.3).Within(.0005)); | ||
|
Check warning on line 29 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| Assert.That(double.PositiveInfinity, Is.EqualTo(double.PositiveInfinity)); | ||
| Assert.That(double.NegativeInfinity, Is.EqualTo(double.NegativeInfinity)); | ||
| Assert.That(double.NaN, Is.EqualTo(double.NaN)); | ||
| Assert.That(20000000000000004.0, Is.EqualTo(20000000000000000.0).Within(1).Ulps); | ||
|
Check warning on line 33 in docs/snippets/Snippets.NUnit/ConstraintExamples.cs
|
||
| } | ||
| #endregion | ||
|
|
||
|
|
@@ -44,6 +44,7 @@ | |
| string[] expected = ["Hello", "World"]; | ||
| string[] actual = ["HELLO", "world"]; | ||
| Assert.That(actual, Is.EqualTo(expected).IgnoreCase); | ||
| Assert.That("Hello my world is \r\n on fire!", Is.EqualTo("Hellomy world \r\n is on fire!").IgnoreWhiteSpace); | ||
|
||
| } | ||
| #endregion | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.