I'm Learning Moq - A .NET Mocking Framework for Unit Tests

preview_player
Показать описание


This framework is new to me so lets explore it together and cover some of the basic use cases that I'd like to employ Moq for: Mocking the value of object Properties, Mocking the value of object Functions and Mocking the results of a specific function invocation. From that hopefully we'll be able to build a better understanding of the capabilities of Moq and how we can best use it to improve the quality of our testing.

***

To add Moq to your dotnet project you can run:

```ps1
dotnet add package Moq
```

Рекомендации по теме
Комментарии
Автор

I'm surprised the algorithm YouTube algorithm hasn't picked up your channel! Love the stuff your making! I always wondered what the unit testing in unity looks like. cool

OranCollins
Автор

Awesome fun to watch. I'm yelling "Change the project name!!" and "try adding a using thingy!!". I love watching coders learn something - it's such a chaotic process! To be clear - this is a fantastic inside-the-mind of a software expert working stuff out... "And now we should see this! Oh... Nope... Why... What?...?? WTF!? Oh. Right...."

petermanger
Автор

Lol you should have shown a date time override for testing as that’s one of they most obvious things for testing override for overriding things like time.deltatime in unity

And it’s the discard operator you were trying to explain/remember at end it’s used in the new pattern matching and tuples

cchance
Автор

At 35:46 it looks like the Mock class has a "CallBase" property, maybe you have to set this to true to call the methods of the orginal/base class?

rpfake