Unit Testing And Mocking With Azure SDK .NET

Unit testing is an important part of a sustainable development process because it enables developers to prevent regressions.

Things get complicated when the code you are testing communicates with an Azure service over a network. How can you reliably test code with external dependencies?

One option is to provision required Azure resources and run tests using them.

This is expensive because every developer needs their own set of resources. It’s slow because having every test communicate over a network makes them take longer. It’s hard to manage because resources have to be in a specific state before starting a test.

A better option is to replace the service clients with mocked or in-memory implementations. This avoids the above issues and lets developers focus on testing their application logic, independent from the network and service.

In this article, we’ll show you how to use the Azure SDK to write great unit tests that isolate your dependencies to make your tests more reliable.

Default image
Lingaraj Senapati
Hey There! I am Lingaraj Senapati, the Co-founder of lingarajtechhub.com My skills are Freelance, Web Developer & Designer, Corporate Trainer, Digital Marketer & Youtuber.
Articles: 142

Newsletter Updates

Enter your email address below to subscribe to our newsletter

Leave a Reply

one + 16 =

Physical Address

Patia, Bhubaneswar, khordha, 751024, Odisha, India