예제 #1
0
        public void DoLogin_With_Right_Credentials(string username, string password)
        {
            //DaoFactory.Register<IAdminLoginDao>(typeof(FakeAdminLoginDao));  also works
            var             adminLoginService = new AdminLoginService(new FakeAdminLoginDao());
            IAdminLoginData loginData         = new AdminLoginData {
                Username = username, Password = password
            };

            var loginInfo = adminLoginService.DoLogin(loginData);

            Assert.AreEqual(0, loginInfo.ErrorMessages.Count);
            Assert.AreEqual(StatusCode.Success, loginInfo.StatusCode);
            Assert.AreEqual(username, loginInfo.Administrator.Username);
        }
예제 #2
0
        [TestCase("Cindy", "Eke")]      //test property validators seperately
        public void DoLogin_With_Wrong_Credentials(string username, string password)
        {
            DaoFactory.Register <IAdminLoginDao>(typeof(FakeAdminLoginDao));
            var             adminLoginService = new AdminLoginService();
            IAdminLoginData loginData         = new AdminLoginData {
                Username = username, Password = password
            };

            var loginInfo = adminLoginService.DoLogin(loginData);

            Assert.GreaterOrEqual(loginInfo.ErrorMessages.Count, 1);
            Assert.AreEqual(StatusCode.Failure, loginInfo.StatusCode);
            Assert.AreEqual(null, loginInfo.Administrator);
        }