Skip to content

Commit 22cc634

Browse files
authored
Merge pull request #8565 from Evangelink/assert-throwsexception
Update quick-start to use Assert.ThrowsException
2 parents ecb3a6e + 1c07459 commit 22cc634

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

docs/test/quick-start-test-driven-development-with-test-explorer.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,10 @@ To improve our confidence that the code works in all cases, add tests that try a
157157

158158
```csharp
159159
[TestMethod]
160-
public void RooterTestNegativeInputx()
160+
public void RooterTestNegativeInput()
161161
{
162162
Rooter rooter = new Rooter();
163-
try
164-
{
165-
rooter.SquareRoot(-10);
166-
}
167-
catch (System.ArgumentOutOfRangeException)
168-
{
169-
return;
170-
}
171-
Assert.Fail();
163+
Assert.ThrowsException<ArgumentOutOfRangeException>(() => rooter.SquareRoot(-1));
172164
}
173165
```
174166

0 commit comments

Comments
 (0)