public void IsLoginOK_ValidUser_LogUser() { var mockLogger = new FakeLogger(); LoginManager1 lm = new LoginManager1(mockLogger, new FakeWebService()); lm.AddUser("a", "pass"); lm.IsLoginOK("a", "pass"); StringAssert.Contains("login ok: user: a", mockLogger.GetLastWrite()); }
public void IsLoginOK_LogWriteFails_SendExceptionToWebService() { var stubLogger = new FakeLogger(); var mockWebservice = new FakeWebService(); stubLogger.WillWriteFail = true; var loggingManager = CreateLoggingManager(stubLogger, mockWebservice); loggingManager.IsLoginOK("a", "pass"); StringAssert.Contains("got exception - Write faild", mockWebservice.GetLastPostMessage()); }
private static LoginManager1 CreateLoggingManager(FakeLogger stubLogger, FakeWebService mockWebservice) { return(new LoginManager1(stubLogger, mockWebservice)); }