I'm new to mocking and would like some help. I've got a number of unit tests working with various mocks and even got my build server (teamcity) running the tests successfully. But there is one test that is giving me problems. How can I mock the following:
string url = ConfigurationManager.AppSettings.Get("homeUrl");
In my test I've tried a number of things like this:
AppSettingsSection appSettings = new AppSettingsSection();
Mock configurationManagerMock = MockManager.MockAll(typeof(ConfigurationManager));
When I run this unit test, I get the following error:
No method AppSettings in type System.Configuration.ConfigurationManager
I'm running VS2008 targeting .NET 2.0. I'm using the built-in test projects supplied by VS2008.
Any help would be great. Thanks in advance.