I'm developing a project in ASP.NET. When testing my pages (using WatiN)
I cannot fake my static methods called from my pages.
Here's the layout of my porject:
- Foo
Contains all core functionallity
- Foo.Web
- Contains all templates, user controls, styles etc.
- Foo.Test
- Contains all test logic and references the Foo project.
So when testing one of my pages, it has a button which will call the method Foo.FooProviders.FooService.DoSomething(Int32).
So I try to fake theses methods by (NOTE! FooService is not a static class):
Isolate.Fake.StaticMethods<FooService>(Members.ReturnRecursiveFakes);
Isolate.WhenCalled(() => FooService.DoSomething(1)).WillReturn(true);
When running the test, the method is never faked when the page calls this method. BUT, if I call the FooService from within the unit test it works.
How can I fix this?