Top "Moq" questions

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

SetupSet() is obsolete. In place of what?

Let's say I want to use Moq to create a callback on a setter to store the set property in …

c# .net unit-testing mocking moq
Mocking new Microsoft Entity Framework Identity UserManager and RoleManager

Has anyone come up with a successful mocking solution for UserManager and RoleManager? I have been beating my head against …

c# entity-framework unit-testing moq asp.net-identity
Using Moq to Mock a Func<> constructor parameter and Verify it was called twice

Taken the question from this article (How to moq a Func) and adapted it as the answer is not correct. …

c# unit-testing moq functional-testing
Mocking HttpPostedFileBase and InputStream for unit-test

I want to test the following line of code: ... Bitmap uploadedPicture = Bitmap.FromStream(model.Picture.InputStream) as Bitmap; ... Picture is …

asp.net-mvc unit-testing moq httppostedfilebase
Calling original method with Moq

I have a ProductRepository with 2 methods, GetAllProducts and GetProductByType, and I want to test the logic at GetProductByType. Internally, GetProductByType …

c# mocking moq
When using Moq Verify() method invocation count, have failing test's error message contain actual method invocation count using Moq

Consider the following, where I am testing that an injected dependency's method is called a specific number of times: [Fact] …

unit-testing mocking moq moq-3
Mocking a type with an internal constructor using Moq

I'm trying to mock a class from the Microsoft Sync Framework. It only has an internal constructor. When I try …

c# unit-testing moq microsoft-sync-framework
Setup() vs SetupGet()

What is the difference between the SetupGet() and Setup() methods for MOQ?

moq
Moq - Is it possible to specify in a Setup the Verify criteria (e.g. Times called)?

If you need to Setup a return value, as well as Verify how many times the expression was called, can …

testing mocking installation moq verify
What is AutoFixture AutoMoq?

I was looking at nuget and wanted to import moq when I noticed AutoFixture AutoMoq. I see that AutoFixture is …

moq autofixture