Top "Moq" questions

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

How to add an item to a Mock DbSet (using Moq)

I'm trying to set up a mock DbSet for testing purposes. I used the tutorial here, http://www.loganfranken.com/…

c# linq moq dbset
Moq: unit testing a method relying on HttpContext

Consider a method in a .NET assembly: public static string GetSecurityContextUserName() { //extract the username from request string sUser = HttpContext.Current.…

c# unit-testing mocking moq
Moq + Unit Testing - System.Reflection.TargetParameterCountException: Parameter count mismatch

I'm tring to use a lambda with a multiple-params function but Moq throws this exception at runtime when I attempt …

c# wpf unit-testing moq ivalueconverter
How to setup Mock of IConfigurationRoot to return value

I have used IConfigurationRoute to access a directory like this. if (type == "error") directory = _config.GetValue<string>("Directories:…

c# unit-testing asp.net-core moq xunit.net
What is the purpose of VerifyAll() in Moq?

I read the question at What is the purpose of Verifiable() in Moq? and have this question in my mind. …

unit-testing moq
Verifying a method was called

Using Moq, I have a very odd issue where the setup on a mock only seems to work if the …

c# .net mocking moq verify
Moq verify with object parameter

I am trying to verify a parameter that is a class. The code being tested is fine. The bug is …

c# .net unit-testing moq
Moq, strict vs loose usage

In the past, I have only used Rhino Mocks, with the typical strict mock. I am now working with Moq …

c# .net unit-testing mocking moq
Using Moq to verify calls are made in the correct order

I need to test the following method: CreateOutput(IWriter writer) { writer.Write(type); writer.Write(id); writer.Write(sender); // many …

c# unit-testing nunit moq sequential
MOQ - how to mock an interface that needs to be cast to another interface?

what I want to do is construct a moq for I1 - which is fine ... however in the course of …

unit-testing inheritance interface moq