Cross Mocking Process in ASP.NET

I am creating a REST API using ASP.NET MVC 3. I am doing this in a BDD style using SpecFlow using NUnit as a test runner.

Since this is a REST API, testing Url: s is obviously very important, so I want to be able to make real HTTP calls in specifications.

Now I am looking for tips on how to get Cross Process Mocking. In short, I want to mock a data layer with entities that I generate in Specs.

In a Rails application, I would use Webrat for this. Is there something similar in .NET?

I already tried Deleporter , but it seems that it cannot "send" advanced constructions (creating a simple string in the specifications and using it in Deleporter, but not for the user class, all properties become null)

Does anyone have any experience or tips on how to do this?

Edit: What I'm trying to do in Deleporter was something like this (I know that I could generate models inside Deleporter code, but this is a simplified example, so that would not work for me):

var models = Builder<Foo>.CreateListOfSize(300); Deleporter.Run(() => { var mockService = new Mock<IFooService>(); // Models will be a list of 300 Foos but the foos properties will all be null mockService.Setup(s => s.GetStuff()).Returns(models); ObjectFactory.Inject(mockService.Object); }); 
+7
source share
2 answers

I'm just investigating this myself. If you look at some example code example in the Demo guestbook , you can use Deleporter for this.

Do you have an example of what you would like to do?

+1
source

I think you're probably looking for WatiN

-one
source

All Articles