How to fake Azure Table Storage in .NET for Unit Testing?

Matt - thanks for the reponse and the link. This gets me part of the way, which is better than nothing. I was hoping for a fake, so I could test the actual requests/responses.

– Erick T Jan 10 at 0:32 What's the difference between a fake and a mock? I guess I'm not clear on what you are looking for. – matt eisenberg Jan 10 at 2:19 Matt - the way that I understand it is that the Mock is set up to return specific values for specific calls (i.e.

, return true when method X is called). What I am looking for is something like a HTTP mock, to return responses when a particular URL is requested. That way, I can test the Azure Client on the HTTP level.

– Erick T Jan 19 at 4:16.

I'm not totally sure I understand the problem. Can you not write to Dev storage or better yet, a test storage account during unit tests?

The problems with using dev storage are that the dev storage doesn't work exactly like the real thing, and I want to unit test it, which doesn't lead towards using the real thing. – Erick T Jan 10 at 0:30 Use a test account. Switch the configuration setting either in the .

Config file of the unit test project or in the base class that all unit tests will derive from/call. Depending on the tests, you can pre-create and drop the tables as a part of the test. At the end of the day, if you want your tests to test real functionality, you'll have to test on a real Azure account.

Thankfully, Microsoft allows creation of bunch of them. – Igorek Jan 10 at 4:47 I am using a test account when I do the end-to-end integration test. However, for daily builds I want to be able to test locally.As I mentioned in another comment, I am looking for some way to create what could be considered an HTTP mock so that I can test locally.

– Erick T Jan 19 at 4:18.

This is something I'm currently considering myself, but I haven't tried it yet. TableServiceContext inherets from DataServiceContext, so I figure if you could inject the TableServiceContext as a DataServiceContext, you could model the Table Store using data services. Taking it a step further, if you use Entity Framework "Code First" to create your Entity Model - you could just use the Table Entities you've already created as the backing entities for your data service and everything should work smoothly.

That's the theory at least. I've never tried it. msdn.microsoft.com/en-us/library/microso....

Thanks for the response. I'm sure that I completely follow - are you suggesting using WCF Data Services (locally) as the target for the Azure table tests? If so, I like the idea, but I am concerned about the odd differences between the two.

Let me know if you have tried it out, and I'll do the same. Thanks! – Erick T Jan 19 at 4:20.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions