Hi, I am newbiew. And i encoutered the same problem when I use the sample code to compile.
Because I cannot succeed to compile it. However, these code is from the TypeMock document. It should be excuted successfully.
The error message is that "Error 1, Expected class, delegate, enum, interface, or struct". It showed that " public bool
is worng, could help for this? Thanks.
public bool IsAuthenticated(string name,string password)
// do something
int Results = DoSelect(statement);
bool isOk = Results==1;
Logger.Log(Logger.NORMAL,"User Authenticated "+name);
Logger.Log(Logger.SECURITY,"User login failed "+name);
catch (Exception ex)
Logger.Log(Logger.FAILED,"Login system failure",ex);
// handle exception
public class AccountTest
public void Authenticated()
Authentication authenticator = new Authentication();
// Initialize Type Mocks (This can be done in the [Setup])
// the Logger class is now being mocked
Mock logMock = MockManager.Mock(typeof(Logger));
// set up our expectations for 2 Log calls in IsAuthenticated
// 1) "Entering Authentication" Log at first line
// 2) "User login failed user" Log
// authentication should fail
// Verify that all calls were made (This can be done in the [Teardown])