Skip to content

Commit 1c07459

Browse files
committed
Update quick-start to use Assert.ThrowsException
In Walkthrough: Test-driven development using Test Explorer, replaces try/catch pattern with Assert.ThrowsException
1 parent 7e0f782 commit 1c07459

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)