Skip to Content
Serverless computing in Azure with .NET
book

Serverless computing in Azure with .NET

by Sasha Rosenbaum
August 2017
Intermediate to advanced
468 pages
12h 5m
English
Packt Publishing
Content preview from Serverless computing in Azure with .NET

The EvaluateText class - API failure and method failure

In the following test case, we arrange to test for the external API failure.

When a server error is returned from the Text Analytics API, our EvaluateText implementation presently fails with an exception, since the HTTP response content is not a valid JSON. The MSTest framework allows us to expect the exception using the ExpectedException attribute, and also to specify whether a specific exception type or any of the derived types are considered valid.

In the "arrange" section of the test, we will create a valid input string, and set up the SendAsync method in the HttpMessageHandler mockup class to return HttpStatusCode.InternalServerError.

In the "act" section, we will execute the

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Azure Serverless Computing

Mastering Azure Serverless Computing

Lorenzo Barbieri, Massimo Bonanni
Implementing Azure: Putting Modern DevOps to Use

Implementing Azure: Putting Modern DevOps to Use

Florian Klaffenbach, Oliver Michalski, Markus Klein, Mohamed Wali

Publisher Resources

ISBN: 9781787288393Supplemental Content