Пример #1
0
        public void AddUser_Always_CallLogger()
        {
            var mockLogger = new FakeLogger();

            var loginManager = new LoginManager1(mockLogger);

            loginManager.AddUser("somename", "password");

            StringAssert.Contains("user added: [somename],[password]", mockLogger.WriteMessage);
        }
Пример #2
0
        public void IsLoginOK_UserOK_CallLogger()
        {
            var mockLogger = new FakeLogger();

            var loginManager = new LoginManager1(mockLogger);

            loginManager.AddUser("somename", "password");
            loginManager.IsLoginOK("somename", "password");

            StringAssert.Contains("login ok: user: [somename]", mockLogger.WriteMessage);
        }
Пример #3
0
        public void IsLoginOK_InvalidLogin_CallLogger()
        {
            var mockLogger = new FakeLogger();

            var loginManager = new LoginManager1(mockLogger);

            loginManager.AddUser("somename", "password");
            loginManager.IsLoginOK("somename2", "password");

            StringAssert.Contains("bad login: [somename2],[password]", mockLogger.WriteMessage);
        }
Пример #4
0
        public void ChangeUser_Always_CallLogger()
        {
            var mockLogger = new Mock<ILogger>();

            var loginManager = new LoginManager1(mockLogger.Object);

            loginManager.AddUser("somename", "password");
            loginManager.ChangePass("somename", "password", "password2");

            mockLogger.Verify(_ => _.Write("pass changed: [somename],[password2],[password]"));
        }