Using Verify of Moq framework in Unit Testing [Unit Test Verification in .NET 5.0]

Опубликовано: 07 Август 2026
на канале: DotNet Core Central
7,221
107

In this video, I am going to share how we can use Verify method provided by Moq framework to verify if a particular function was called during test execution.

The Verify is different than Assert, in the sense that Assert is mainly for black-box testing, whereas Verify provides us features to white box test our assemblies.

Apart from showing how to verify works, I am also going to walk through how we can test async functions using Moq.

And finally, I will conclude by showing how we can test the internal interface and classes. This one concept particularly is very important. Because in my experience, I have seen a lot of times classes and interfaces were made public just to be able to test them out.

My blog website URL is here: https://dotnetcorecentral.com/
My YouTube channel URL is here:    / dotnetcorecentral  
My GitHub repo URL is here: https://github.com/choudhurynirjhar

00:08 - What is verification in Unit testing
00:55 - Explaining the problem
04:14 - New Unit test project
09:54 - Verify usage
11:50 - Testing async functions
13:55 - Exposing internal classes and interfaces