Making extension methods amenable to mocking

Posted by: eXtensible mind, on 19 Feb 2009 | View original | Bookmarked: 0 time(s)

The question of how to mock extension methods comes up frequently enough that I though I might give my opinion and solution to it (which does NOT include using TypeMock ;)). A first differentiator is whether you control the definition of the extension methods or not. The latter case would be, for example, the built-in Linq extension methods (First, Count, etc. on IEnumerable<T>) and there's no way to mock them unless you use TypeMock. The former would be your own logic that you decide to place...

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.

Similar Posts

  • WCF - Syndication Extensions more
  • Extension methods C# 3.0 and VB9 more
  • Extension Methods (part 2) 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