Top "Moq" questions

Moq is a strongly typed and minimalistic mocking framework for .NET.

Using Verify to confirm expected parameter values in Moq mock class

I'm trying to verify that a method within a mock is called with an expected object parameter. I'm using Moq, …

nunit moq autofixture
Why DbContext doesn't implement IDbContext interface?

Why there is no IDbContext interface in the Entity Framework? Wouldn't it be easier to test things if there was …

entity-framework unit-testing testing mocking moq
Moq with Task await

Since I have converted my WCF methods to Async, my unit tests have failed, and I can't figure out the …

c# .net asynchronous async-await moq
Moq'ing methods where Expression<Func<T, bool>> are passed in as parameters

I'm very new to unit testing and mocking! I'm trying to write some unit tests that covers some code that …

c# unit-testing moq
How to set up a method twice for different parameters with Moq

I would like to set up a method with Moq twice but it seems that the last one overrides the …

c# .net unit-testing moq
SetupSequence in Moq

I want a mock returns a 0 the first time, then returns 1 anytime the method was called. The problem is that …

c# unit-testing mocking moq
Can not instantiate proxy...Could not find a parameterless constructor

I am trying to create a unit test using Moq which tests the MongoDB.AspNet.Identity V2 provider. This line …

mongodb moq asp.net-identity
Mocking generic method call for any given type parameter

I have an interface public interface IDataProvider { T GetDataDocument<T>(Guid document) where T:class, new() } I'd like …

c# moq
How to mock an async repository with Entity Framework Core

I'm trying to create a unit test for a class that calls into an async repository. I'm using ASP.NET …

c# unit-testing asp.net-core moq entity-framework-core
Reset mock verification in Moq?

Setup as so: public interface IFoo { void Fizz(); } [Test] public void A() { var foo = new Mock<IFoo>(MockBehavior.…

c# unit-testing moq