Guest User

Untitled

a guest
May 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. [TestMethod]
  2. public void GetCSRInfo_BadOperation_ThrowsExceptionAndIsHandled()
  3. {
  4. // Arrange
  5. var uscAPI = RestService.For<IUscApi>(_uscapiurl);
  6. string csrCode = "404";
  7.  
  8. // Act
  9. try
  10. {
  11. CsrInfo item = uscAPI.GetCSRInfo(csrCode).Result.FirstOrDefault();
  12. }
  13. catch (AggregateException ae)
  14. {
  15. ae.Handle((x) =>
  16. {
  17. Debug.WriteLine("There was a problem getting the CSR information: " + x.Message);
  18.  
  19. // Assert
  20. Assert.IsTrue(x is ApiException);
  21. return true;
  22. });
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment