Injecting Typemock Stubs and Mocks using the StructureMap container in a unit test

Posted by: ISerializable, on 24 Apr 2008 | View original | Bookmarked: 0 time(s)

Someone asked for examples of how you'd inject stubs and mocks when you'd like your object under test to use a container such as StructureMap. here are a couple of simple tests to show this using Typemock Isolator. the first uses the string based mocks found in the free community version of Typemock Isolator. the second uses the natural style syntax in the enterprise edition: assume you have ILogger, IEmailer interfaces and a MessageManager class under test that takes both of these in the ctor....

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: .NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 874 | Hits: 38

Similar Posts

  • Art Of Unit Testing (The Samurai Book) Get it now, its done. more
  • Testability vs. Testing more
  • Walkthrough: TDD Support with the Generate From Usage Feature in VS 2010 (Lisa Feigenbaum) more
  • Isolation frameworks lessons from the wild more
  • Agile Testing tools List more
  • Interfaces and Testing more
  • Over-testable systems, and mocks as bad test smells more
  • Pros and Cons and of using an Auto Mocking container in your tests more
  • A Gentle Introduction to Mocking more
  • Sleep tight, don't let the test bugs bite more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD