Make StorageClient library more unit test friendly
Currently, a developer has to jump through hoops to unit test code written against the StorageClient library. There is no official guidance for unit testing your apps, and after looking around for what others were doing I settled on creating custom interfaces and objects that wrap the library like the guys did with: http://cloudstorageapi.codeplex.com/.
How about making official interfaces for the library and providing us with an testing-oriented in-memory implementation that we can use to immediatly begin unit testing our apps without any hassle.
3 comments
-
Steve Moir commented
A good starting point would be to just have the classes implement an interface, at least that way they're more easily mockable.
-
Cory Fowler commented
I'm on board with the need for Unit Testing. I would like to see some interfaces to make Helper/Service classes that leverage the power of generics to keep my code to a minimum.
Something like so:
private void InitializeStorage<ICreateStorageEndpoint>(T storageService, ref bool initializeFlag, ref object lockKey)
{
lock(lockKey)
{
if (initializeFlag) return;
initializeFlag = storageService.CreateIfNotExists();
}
} -
cjwittnebel
commented
A big timesaver and would definately make the unit test process much more efficient.