Skip to content

Commit 35c559e

Browse files
committed
updated equalto
1 parent d6e7616 commit 35c559e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/articles/nunit/writing-tests/constraints/EqualConstraint.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ Is.Zero // Equivalent to Is.EqualTo(0)
2323
## Modifiers
2424

2525
```csharp
26+
...AsCollection
2627
...IgnoreCase
2728
...IgnoreWhiteSpace // From version 4.2
28-
...AsCollection
2929
...NoClip
3030
...WithSameOffset
3131
...Within(object tolerance)
@@ -37,8 +37,7 @@ Is.Zero // Equivalent to Is.EqualTo(0)
3737
.Seconds
3838
.Milliseconds
3939
.Ticks
40-
...IgnoreCase
41-
...IgnoreWhiteSpace
40+
4241
...Using(IEqualityComparer comparer)
4342
...Using(IComparer comparer)
4443
...Using<T>(IEqualityComparer<T> comparer)
@@ -118,6 +117,8 @@ to indicate the mismatched location in both _expected_ and _actual_ values:
118117

119118
The `IgnoreWhiteSpace` can also be specified when comparing collections of strings.
120119

120+
The characters ignored is the same as for the C# `Char.IsWhiteSpace`.
121+
121122
## Comparing DateTimes and TimeSpans
122123

123124
**DateTimes** and **TimeSpans** may be compared either with or without a tolerance. A tolerance is specified using
@@ -136,7 +137,7 @@ Assert.That(later, Is.EqualTo(now).Within(TimeSpan.FromHours(3.0));
136137
Assert.That(later, Is.EqualTo(now).Within(3).Hours);
137138
```
138139

139-
## Comparing Arrays, Collections and IEnumerables
140+
## Comparing Arrays, Collections and IEnumerables with AsCollection
140141

141142
Since version 2.2, NUnit has been able to compare two single-dimensioned arrays. Beginning with version 2.4,
142143
multi-dimensioned arrays, nested arrays (arrays of arrays) and collections may be compared. With version 2.5, any

docs/snippets/Snippets.NUnit/ConstraintExamples.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public void EqualConstraint_Strings()
4444
string[] expected = ["Hello", "World"];
4545
string[] actual = ["HELLO", "world"];
4646
Assert.That(actual, Is.EqualTo(expected).IgnoreCase);
47+
Assert.That("Hello my world is \r\n on fire!", Is.EqualTo("Hellomy world \r\n is on fire!").IgnoreWhiteSpace);
4748
}
4849
#endregion
4950

0 commit comments

Comments
 (0)