Skip to content

Commit 3d9c9de

Browse files
author
Kevin Hellemun
committed
Use assert throws in test. (#63)
1 parent e59fcf3 commit 3d9c9de

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

BunqSdk.Tests/Http/ResponseIdOnBadRequestTest.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,11 @@ public class ResponseIdOnBadRequestTest : BunqSdkTestBase
2121
[Fact]
2222
public void TestBadRequestWithResponseId()
2323
{
24-
ApiException caughtException = null;
25-
26-
try
27-
{
28-
UserPerson.Get(API_CONTEXT, INVALID_USER_PERSON_ID);
29-
}
30-
catch (ApiException e)
31-
{
32-
caughtException = e;
33-
}
24+
var caughtException = Assert.Throws<BadRequestException>(
25+
() => UserPerson.Get(API_CONTEXT, INVALID_USER_PERSON_ID)
26+
);
3427

35-
Assert.NotNull(caughtException);
36-
Assert.NotNull(caughtException.ResponsId);
28+
Assert.NotNull(caughtException.ResponseId);
3729
}
3830
}
39-
}
31+
}

0 commit comments

Comments
 (0)