Integration Test: Mock PartOf a class

Опубликовано: 19 Октябрь 2024
на канале: Saeed Esmaeelinejad
216
12

When we're trying to write integration tests, usually it's better not to mock any class or method and execute actual code. By doing so we can make sure all code paths and different scenarios will be covered.

But what if you want to mock only one method of a class?

Well, there are a few ways to do that, in this video, while I talk about all possible ways the main focus is on NSubstitute and how to use it for mocking part of a class.

Check the code[MockPartOfClass]: https://github.com/sa-es-ir/youtube-s...

Hope you like it!
#dotnet #integrationtesting #mocking #nsubstitute

Moments

00:00 - Intro
00:18 - Check the real API logic
01:36 - Integration Test without mocking
03:12 - Considering different ways of mocking a part of a class
08:12 - NSubstitute and using PartOf method

------------------------------------------------
Follow me on LinkedIn:
  / sa-es-ir