mocking - unit test smell -


I'm trying to change ArcGIS's own unit test, and I'm starting to use mocks (I'm Rhino's I use).
When I started writing tests, I saw that I have to make fun of many things, and even stopping many ways to pass a single test. For example - my controller must first have relationax (hence I need iworkspace and returned irelationshipclass stub), even then a IFeature (a stub), and finally call stubRelClass.GetRelatedObjects (stubFeature) , second to ISet to other IFeatures for.

Is it normal that so many objects and methods should be held so that it is passed? I also think that I really need to step on the code (yes - I know that I should have written the test earlier, I am still trying one), to find out what is going on ahead, And what should I do.

I am also having problems with the com class jokes which apply more than one interface. In the output code I have them between the interfaces between QI How can I make a fake that implements both interfaces on runtime?

Depends on your injection chain, yes, sometimes you have to be fake of many things If you are going deeper at many levels, it may be a sign of a design mistake - objects that are relying on data coming under three layers in your API, can not be coupled in loose ways .

You should also be able to touch the chain in the quad by simply returning a duplicate object of some kind on the essential properties that you have.

[Setup] To make your most fun in the method and then to change only one or two things in each trial.

To make a number of interfaces fun, a multimock in Rhino. I believe that the syntax you are following is:

  var mock = mockRepository.DynamicMultiMock & lt; MyType & gt; (Typef (interface 1), typef (interface 2), ....);  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -