VisualStudioFeeds

All Visual Studio blogs in one place

AddThis Social Bookmark Button
I have to do some mocking of an ITable to be able to test some of my code, as you may imagine this is the point where we’re crossing the data boundary… Now, ITable is a total bugger to mock, I’ve tried on (at least) 3 separate occasions to get it mocked, and have only now, finally achieved an 80% solution. (Nothing is ever 100%) I’m not using any mock framework, they just take too long to setup (in this case) and instead have a concrete class that implements ITable and uses an
IList as it’s base. Without further ado: using System; using System.Collections; using System.Collections.Generic; using System.Data.Linq; using System.Linq; using System.Linq.Expressions; public class MockTable : ITable where T : class { private readonly IList _entities; public MockTable(IList entities) { _entities = entities; } #region ITable Members public IEnumerator GetEnumerator() { return _entities.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { ...(Read whole news on source site)

Search

Subscribe

Enter your email address:

Delivered by FeedBurner

Increase your website traffic with Attracta.com

Contact

Email:
Subject:
Message:
Anti-spam: How many eyes has a typical person?

Follow us on FB

Home : Blog List : xClave.Co.Uk : Mocking ITable<T>