File tree Expand file tree Collapse file tree
docs/articles/nunit-analyzers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ Only the argument value is needed by the Assert.
1818
1919The ` Assert ` method will call a delegate if passed in, but that is an unnecessary overhead.
2020
21- In most case , only the return value is needed by the Assert:
21+ In most cases , only the return value is needed by the assertion.
2222
23- There are two exception for this :
23+ There are two exceptions :
2424
25251 . When catching exceptions, like in:
2626
@@ -34,7 +34,7 @@ There are two exception for this:
3434 Assert .That (() => task .IsCompleted , Is .True .After (5 ).Seconds .PollEvery (100 ).MilliSeconds );
3535 ```
3636
37- Sometimes developers unnecessary create a lambda expression for the _actual_ parameter.
37+ Sometimes developers unnecessarily create a lambda expression for the _actual_ parameter.
3838
3939```csharp
4040Assert.That(() => instance .Method1 (Parameters ), Is .EqualTo (expected ));
@@ -49,7 +49,7 @@ Assert.That(instance.Method1(Parameters), Is.EqualTo(expected));
4949
5050It is clearer both in looks and in what is being tested here.
5151
52- Sometimes the lambda is created implicit like in:
52+ Sometimes the lambda is created implicitly like in:
5353
5454``` csharp
5555Assert .That (instance .Method2 , Is .EqualTo (expected ));
Original file line number Diff line number Diff line change 1212
1313## Description
1414
15- The constraint didn't take the operator priority into account.
15+ The constraint didn't take the operator precedence into account.
1616
1717## Motivation
1818
@@ -22,13 +22,13 @@ We have seen users wanting to test for an equivalent of `!string.IsNullOrEmpty()
2222Assert .That (name , Is .Not .Null .Or .Empty );
2323```
2424
25- Because of the operator priority this actually means ` Is.Not.Null | Is.Empty ` .
25+ Because of the operator precedence this actually means ` Is.Not.Null | Is.Empty ` .
2626The ` Is.Empty ` part will only be tested when the item under test is ` null ` .
2727Depending on the type this either returns ` false ` or ` throws ` an ` Exception ` .
2828
2929## How to fix violations
3030
31- The code fix associated with thus rule will convert this to test for both ` Not.Null ` and ` Not.Empty ` :
31+ The code fix associated with this rule will convert this to test for both ` Not.Null ` and ` Not.Empty ` :
3232
3333``` csharp
3434Assert .That (name , Is .Not .Null .And .Not .Empty );
You can’t perform that action at this time.
0 commit comments