| Mehfuz's WebLog |
Previously , I have posted how it is possible to mock a method without passing the dependency through a constructor / calling method. This is something true for third party controls and tools where we have little control over how its created. You can find more on that in the following post: http://weblogs.asp.net/mehfuzh/archive/2011/07/21/fake-a-member-without-worrying-about-passing-the-dependency.aspx Now the feature that lets you mock members without passing the dependency, we call it Future mocking. However it does not mean that Justmock ignores the instance completely but rather there is a workflow where it checks if there is
no match for instance (of course it is a profiler intensive feature) and mocked within current context it tries to match any setup that is meant for. One of the best example that I recently encountered through a community feedback that describes a UI case where based on some action against the form, raises an event which needs to be handled in a specific way in the unit test to assert the expected value. Therefore, we have a Form class where the constructor looks something like:
public Form2() {...(Read whole news on source site)
Home : Blog List : Mehfuz's WebLog : Future mocking revisited
Copyright ©Visual Studio Feeds 2010 - 2011.
All Rights Reserved. The content of the postings is owned by the respective author.




