예제 #1
0
        public void GetPrivilege()
        {
            Assert.IsNull(m_profile.GetPrivileges().FirstOrDefault());
            Assert.IsNull(m_profile2.GetPrivileges().FirstOrDefault());

            List <Privilege> privileges = new List <Privilege>();

            Privilege priv = new Privilege("CREATE", "employee");

            m_profile.AddPrivilege(priv);
            privileges.Add(priv);

            priv = new Privilege("DROP", "project");

            m_profile.AddPrivilege(priv);
            privileges.Add(priv);

            Assert.AreEqual(privileges.Count, m_profile.GetPrivileges().Count);

            for (int i = 0; i < privileges.Count; i++)
            {
                Privilege privilege  = privileges[i];
                Privilege privilege2 = m_profile.GetPrivilege(privilege.GetPrivilege(), privilege.GetTable());
                Assert.AreEqual(privilege.GetPrivilege(), privilege2.GetPrivilege());
                Assert.AreEqual(privilege.GetTable(), privilege2.GetTable());
            }

            privileges.Clear();
            priv = new Privilege("UPDATE", "location");

            m_profile2.AddPrivilege(priv);
            privileges.Add(priv);

            Assert.AreEqual(privileges.Count, m_profile2.GetPrivileges().Count);

            for (int i = 0; i < privileges.Count; i++)
            {
                Privilege privilege  = privileges[i];
                Privilege privilege2 = m_profile2.GetPrivilege(privilege.GetPrivilege(), privilege.GetTable());
                Assert.AreEqual(privilege.GetPrivilege(), privilege2.GetPrivilege());
                Assert.AreEqual(privilege.GetTable(), privilege2.GetTable());
            }
        }
예제 #2
0
 public void TestGetPrivilege()
 {
     Assert.AreEqual("ALTER", m_privilege.GetPrivilege());
     Assert.AreEqual("DROP", m_privilege2.GetPrivilege());
 }