Well nothing I've done has allowed me to create a working test on my Web Site. That said, I've discovered from this MSDN page
that unit tests are of limited utility on a Web Site as only code in the App_code folder can be tested meaning that none
of my page or control code can! :-)
Unbowed, I decided to have a try with a Web Application. I have created the app and I let VS create a test class for me and, lo, it worked, although my Test Methods are decorated differently...
[AspNetDevelopmentServerHost("C:\\Users\\Stuart\\Documents\\Visual Studio 2008\\Projects\\WebApplication\\WebApplication", "/")]
I created a class had VS create a test on it for me. The class looked like this ...
And my test looks like this ...
Class1 target =
So far, so good.
Now if I've understood anything I've read, the idea behind Mocking is to allow me to 'mock' Object X and whilst I test Object Y's functionality, so I understand that my next test isn't really in keeping with that, but,,, Anyhow, I modified the test above to just create a Mock of Class1...
var target = Mock.Create<Class1>();
Running the test resulted in the following error...
Test method TestProject1.Class1Test.Class1ConstructorTest threw exception: System.ArgumentException: Unable to obtain public key for StrongNameKeyPair.
And there was an Error Stack Trace too.
- Have I done it wrong, or
- Is it broken?