Top "Moq" questions

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

Using Moq to set any by any key and value

At the end of the question: Using Moq to set indexers in C#, there was an issue that someone highlighted …

c# unit-testing moq indexer
Getting arguments passed to a FakeItEasy-mock without using magic strings?

I have been using Moq for my mocking needs the last years, but after looking at FakeItEasy i wanted to …

c# unit-testing moq fakeiteasy
XUnit, AutoFixture and Moq best practice

I'm reading a lot of documentation and examples about how to properly unit test things combining the three components in …

c# unit-testing moq xunit.net autofixture
Converting IQueryable to implement IAsyncEnumerable

I have a query in a method: private readonly IEntityReader<Customer> _reader; public async Task<IEnumerable<…

c# unit-testing entity-framework-core moq iasyncenumerable
Moq: Setup a mocked method to fail on the first call, succeed on the second

What's the most succinct way to use Moq to mock a method that will throw an exception the first time …

c# unit-testing mocking nunit moq
How to Moq Entity Framework SqlQuery calls

I've been able to mock DbSet's from entity framework with Moq using this link. However, I would now like to …

c# entity-framework moq dbcontext
What are NSubstitute limitations, specially vs MOQ?

I'm about to take a decision about the mocking library for my next project. and because I'm new to those …

.net unit-testing tdd moq nsubstitute
Need help to understand Moq better

I've been looking at the Moq documentation and the comments are too short for me to understand each of things …

c# mocking lambda moq
Using autofac with moq

I need to register my Autofac container with specific interface, for this case I want to resolved mock. How can …

c# moq autofac
how do you mock an xml for unit testing?

I need to unit testing this GetData method. public MessageResponse GetData(XmlElement requestElement) { MessageResponse MsgResponse = new MessageResponse(); if (requestElement.Attributes["…

unit-testing moq mstest moq-3