From the course: Azure Microservices with .NET Core for Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Improving unit tests

Improving unit tests - Azure Tutorial

From the course: Azure Microservices with .NET Core for Developers

Start my 1-month free trial

Improving unit tests

Let's improve our unit test project by testing the get product async method from the products provider object. Let's copy this entire method here and we're going to rename this to get product returns product using valid ID. This is important because I want to use a valid product ID inside this test. So, let's rename this here and we need to change this line as well. Products provider, get product async and we're going to, for example, use the ID with number one. Just as before I want to test if this was successful, but rather than a products property we have a product property. So this shouldn't be null. Let's execute this, and this should be true as well. Product, product ID equals one. And the error message should be null. Perfect. Let's run this. And here in the text explorer, we can see that it's running. And get product returns product using valid ID is successful right now. Excellent. Now…

Contents