Top "Moq" questions

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

How to call constructor with interface arguments when mocking a concrete class with Moq

I have the following class, which uses constructor injection: public class Service : IService { public Service(IRepository repository, IProvider provider) { ... } } For …

class mocking moq constructor-injection concreteclass
Verify method call with Lambda expression - Moq

I have a Unit of Work implementation with, among others, the following method: T Single<T>(Expression<…

c# lambda mocking moq verify
How to Setup a readonly property with Moq?

I am trying to unit test using Moq. Here is the example code: public class ConcreteClass { private readonly FirstPropery firstProperty; …

c# moq readonly-attribute
Verifying a delegate was called with Moq

i got a class that gets by argument a delegate. This class invokes that delegate, and i want to unit …

c# unit-testing delegates moq
Using Moq to mock a repository that returns IQueryable<MyObject>

How to I setup my Moq to return some values and having the tested service select the right one? IRepository: …

unit-testing nunit moq
How to Mock ILogger / ILoggerService using Moq

I'm writing some unit tests for my View Model class. The constructor of this class is injected with an ILoggerService. …

c# unit-testing prism moq moq-3
Mocking a private field

I know a similar question has been asked but I have not found a clear solution. I'm trying to mock …

c# unit-testing moq rhino-mocks nmock
Rhino mock vs Typemock vs JustMock vs

I need to choose mock framework to new project. What are the pros and cons for those frameworks? Any comparison …

moq rhino-mocks typemock justmock
.NET 4, AllowPartiallyTrustedCallers attribute, and security markings like SecurityCritical

I'm new C# and am trying to understand the new security features of .NET-4. To fill in some details, I'm …

c# security .net-4.0 moq autofac
How to mock a method call that takes a dynamic object

Say I have the following: public interface ISession { T Get<T>(dynamic filter); } } And I have the following …

c# mocking moq rhino-mocks