コード例 #1
0
        public void CheckVersionTest()
        {
            EidssSecurityManager target = new EidssSecurityManager();
            int expected = 0;
            int actual;

            actual = target.CheckVersion();
            Assert.AreEqual(expected, actual);
            EidssUserContext.ApplicationName = "";
            actual = target.CheckVersion();
            Assert.AreEqual(5, actual);
            EidssUserContext.ApplicationName = "test";
            using (DbManager manager = DbManagerFactory.Factory.Create())
            {
                manager.SetCommand("update tstVersionCompare set strDatabaseVersion='0.0.0' where strModuleName='test'").ExecuteNonQuery();
                actual = target.CheckVersion();
                Assert.AreEqual(3, actual);
                object dbver = manager.SetCommand("select strDatabaseVersion from tstVersionCompare where strModuleName='MainDatabaseVersion'").ExecuteScalar();
                manager.SetCommand(string.Format("update tstVersionCompare set strDatabaseVersion='{0}' where strModuleName='test'", dbver)).ExecuteNonQuery();
            }
        }