# Moq

A C# library used in unit testing to create fake objects.

## What is **Moq**?

A C# mocking library used in unit testing to create fake objects, simulate dependencies, and verify interactions without relying on real implementations.

```csharp
var mock = new Mock<IUserService>();
mock.Setup(x => x.GetName()).Returns("John");
string name = mock.Object.GetName(); // "John"
```

Level: Novice · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/novice)

Updated: October 15, 2026

Source: https://www.ask-codey.com/glossary/moq
