Questions tagged as 'moq'

1
answer

How to test an asp.net mvc controler using Moq and Entity Framework 6

My controller: [Authorize] public class DominioController : Controller { private IDominioDB _db; public DominioController(IDominioDB db) { _db = db; } // GET: Dominio publi...
asked by 06.10.2015 / 03:09
2
answers

What is the purpose of the interfaces used in a Mock?

I'm using a library called Moq that is used to create mocks that will be used in unit tests. However, to create a mock it is necessary to specify an interface, as in the example of the Moq project page: var mock = new Mock<ILoveThisFra...
asked by 02.07.2018 / 01:10
1
answer

Create a mock for any instance of a class

How do I mock any instance of a class? I would like to do this so I do not have to mock an object and have to put it inside a class. Example: [TestFixture] public class TokenTest { GeradorDeToken target; [Test] public void GeraTo...
asked by 02.11.2015 / 12:13
0
answers

Using Moq with MVC DotNet

I'm using MVC4 with Moq and would like to know how to mock my Model and also if that's possible. Thank you.     
asked by 12.08.2015 / 01:49
1
answer

MVC Dependency Injection

I'm using dependency injection to use Mock . I would like to know if I need to create an interface for my Model and another one for my Controller ? Thank you     
asked by 24.08.2015 / 18:20
0
answers

Number of files in the request with Moq

The SetupGet to for the form ( Form ) of the request works, however Count does not work. How do I resolve to Count return the desired value? var httpContextMock = new Mock<HttpContextBase>(); var request = new...
asked by 08.08.2017 / 16:44
0
answers

Mock with MediatR and xUnit

I have a project that I am implementing the Unit Tests with the Mock Framework, in this project I have implemented CQRS using MediatR. Follow the test code public RegistrarMaanaimComandTest() { [Fact] public void RegistrarLocal_Reto...
asked by 22.02.2018 / 12:27