Questions tagged as 'mock'


PHPUnit testing class without constructor

I'm developing unit tests on a project and I came across a class that does not contain constructor. You may wonder, "How does this object exist then?" Well, in another system, this object is generated and saved in a database, so in the sys...
asked by 20.04.2018 / 21:49

Pass Mock in parameter

I need to set a class, and put a face on it called "SimulationDeSet", and make the "SimulationDeSet" return the value I want, but when trying to pass this mock as a parameter it is wrong, I saw many ways to do mock but that's how I need it in th...
asked by 03.04.2018 / 21:25

Mock browsing properties

I'm running unit tests on my controllers and I often need to Action return the navigation properties along with the template in question. Example public async Task<ActionResult> AlterarValores(int? id) { if (id == null)...
asked by 02.03.2018 / 13:48

How to mock a non-existent class with Rspec Mock

I am creating a lib that will use a model of Rails , but for the development of this lib I need to test without the presence of this model . Then think of mockar (I'm using the gem rspec-mock ), so I tried:...
asked by 20.03.2017 / 20:00