I have a class with a method called Validate that I want to test using Rhino Mocks. The Validate method makes a call to a static class which in turn accesses an SQL database.
I want to tell rhino mocks to ignore the call to the static class when executing the test. When debugging the code below the static class is still called and attempts to access the database when all I want it to do is return "error message text".
var mock = MockRepository.GenerateMock<DataUpdateTaskExecutor>();
string resourceName;
Expect.Call(SqlResourceHelper.GetString(resourceName)).IgnoreArguments().Return("error messaage text");
IList<string> errors;
Assert.AreEqual(false,mock.Validate(out errors));
Rhino.Mocks (as well as most of the other free mocking frameworks like moq) can't mock non-virtual members. As @Joe Tuskan said, you should either wrap the functionality in an interface and inject the interface in the constructor or make it a non-static method that can be mocked.
If you've got money to spend, there are commercial mocking tools that allow non-virtual members to be mocked. I don't have any experience with any of them so I won't mention any by name.