コード例 #1
0
 public void setup()
 {
     reg    = AccountRegistry.Instance;
     broker = new AuthenticationBroker();
     // new voter
     reg.AddUser(new Voter("test", "password", true, "", "", new DateTime()));
     // new admin
     reg.AddUser(new Admin("admin", "password"));
 }
コード例 #2
0
        public void authenticateSuccessTest()
        {
            // Success case
            // so singleton instance persists through tests aswell
            reg.AddUser(new Voter("LOCAL", "password", true, "", "", new DateTime()));
            Session sess = broker.authenticate("LOCAL", "password");

            Assert.IsNotNull(sess.currentUser);
            Assert.IsTrue(sess.currentUser.getUsername() == "LOCAL");
        }