c# - Particular Constructor was called before the Method is called -


class employeebase : base {     protected idependency _dependency;      ctor(idependency dependency)     {        _dependency = dependency;     }     ctor(string name, int age)     {         base.initialize("xxx " + name, "yyy" + age);     }       ilist<emp> getallemployees()     {        return _dependency.getrecords();     } }  class filteredemployeebase : employeebase {     ctor(string name, int age) : base(name, age){}     ilist<emp> getmatchingemployees()     {        return _dependency.getrecords();     } }   // test getmatchingemployees, have inject idependency , check assert called on _dependency.getrecords... 

but key thing here is... base classes overloaded constructor should have been called - how test in rhino mocks

pls note: except filteredemployeebase rest legacy code & don't have control on changing them.

if call filteredemployeebase.getmatchingemployees without calling base class constructor taking dependency, call fail on _dependency being null. successful call on getmatchingemployees sufficient say. or miss something?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

node.js - Using Node without global install -

php - CakePHP HttpSockets send array of paramms -