Most voted "moq" questions
Moq is a library for creating Mocks, which are data units used for unit testing.
Learn more…9 questions
Sort by count of
-
5
votes1
answer233
viewsHow 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 public async…
-
3
votes2
answers406
viewsWhat is the purpose of the Interfaces used in a Mock?
I’m using a library called Moq which serves 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…
-
2
votes0
answers64
viewsUsing Moq with MVC Dotnet
I am using MVC4 with Moq and would like to know how to mock mine Model also and if this is possible. Thank you.
-
2
votes1
answer1483
viewsCreate 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 don’t have to mock an object and have to put it inside a class. Example: [TestFixture] public class TokenTest { GeradorDeToken…
-
1
votes1
answer416
viewsInjection of MVC dependency
Galera I’m using dependency injection to use the Mock. I wonder if I need to create an interface for my Model and one for my Controller? Thank you
-
1
votes0
answers15
viewsAmount of files in Moq request
The SetupGet to for the form (Form) of the request works, however the Count doesn’t work. How to solve for the Count return the desired value? var httpContextMock = new…
-
1
votes0
answers71
viewsMoq in c# methods of different classes
Good night. I’m new to unit testing. I’d like to ask for help to resolve a question. I have the following method of a class that calls the method of another class: class public Teste: ITeste {…
-
0
votes2
answers105
viewsMoq function in controller test
After a few hours trying, I arrived at this test code, but still I could not understand well the function of the Mock, and without it works the same way. Note. The intention is to learn TDD with…
-
-1
votes1
answer144
viewsPrivate unit attribute test of a class / C#
I’m trying to create a unit test to ensure that an attribute of an X class is actually changed. But to compare it at the end of my test, something like: Assert.Equal(_sampleClass.Email, mockEmail);…