Top "Moq" questions

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

How to Mock an AutoMapper IMapper object in Web API Tests With StructureMap Dependency Injection?

So I've build a WebAPI from scratch, including some best practices that I've found online such as Dependency Injection and …

unit-testing asp.net-web-api moq automapper structuremap
Create an Expression<Func<,>> using reflection

Im using Moq to create mocks of a data set. I have created a little helper class that allows me …

c# reflection lambda moq expression
Unit Testing on Controller that uses AutoMapper

I am trying to unit test a UpdateUser Controller that uses AutoMapping. Here is the code for the controller UpdateUserController …

asp.net-mvc moq automapper xunit
Mocking MediatR 3 with Moq

We've recently started using MediatR to allow us to de-clutter controller actions as we re-factor a large customer facing portal …

c# unit-testing moq xunit mediatr
How to mock config file for unit test

I have a class in which there is a parameter less constructor. But when this constructor is called, there are …

unit-testing c#-4.0 moq moq-3
How to (should I) mock DocumentClient for DocumentDb unit testing?

From the new CosmosDb emulator I got sort of a repository to perform basic documentdb operations, this repository gets injected …

c# unit-testing moq azure-cosmosdb
ASP.NET MVC Unit Testing - Sessions

Having searched StackOverflow, and Google I think what I'm doing is suppose to be right, however results don't seem to …

asp.net-mvc unit-testing moq session-variables
How to unit test a class which calls service bus queue client SendAsync method

I have a interface which has a method to create instance of queue client and message factory. I have created …

c# unit-testing moq xunit azure-servicebus-queues
Add cookie to Request.Cookies collection

I am trying to create a wrapper class to process content of HttpContext. I am creating a cookie but unable …

c# asp.net tdd moq httpcontext
How to mock IDataReader to test method which converts SqlDataReader to System.DataView

I'm new to Moq and I'm struggling to write Unit Test to test a method which converts SqlDataAdapter to System.…

c# unit-testing mocking moq idatareader