Esempio n. 1
0
        public void TestTableModel_TestUpdate()
        {
            ProviderSetting.CurrentDBProvider = DbProviderType.OracleOdpNetManaged;
            UniDbConnection.OpenCurrentConnection("knvtest", "3");
            Assert.AreEqual(UniDbConnection.Current.State, ConnectionState.Open);
            DataSet        ds = new DataSet();
            TestTableModel v  = UniDbModel.GetOrCreate <TestTableModel>(2, ds);

            v.SetProperty <decimal>("VALUE_T", 2054.21);
            v.SetProperty <string>("PER_NUM", "12714");
            v.Save();

            TestTableModel v1 = UniDbModel.GetOrCreate <TestTableModel>(v.GetProperty <decimal?>("TEST_TABLE_ID"));

            Assert.AreEqual(v.GetProperty <string>("NAME_T"), v1.GetProperty <string>("NAME_T"));
            Assert.AreEqual <decimal?>(v.GetProperty <decimal?>("VALUE_T"), 2054.21m);
            Assert.AreEqual <string>(v.GetProperty <string>("PER_NUM"), "12714");
        }
Esempio n. 2
0
        public void TestTableModel_TestAdd()
        {
            ProviderSetting.CurrentDBProvider = DbProviderType.OracleOdpNetManaged;
            UniDbConnection.OpenCurrentConnection("knvtest", "3");
            Assert.AreEqual(UniDbConnection.Current.State, ConnectionState.Open);
            DataSet        ds = new DataSet();
            TestTableModel v  = UniDbModel.GetOrCreate <TestTableModel>(null, ds);

            v.SetProperty <string>("NAME_T", "Новое название 1");
            v.SetProperty <string>("CODE_T", "9999Ж");
            v.SetProperty <decimal>("VALUE_T", 1042.21);
            v.SetProperty <decimal>("PER_NUM", "14534");
            v.Save();

            TestTableModel v1 = UniDbModel.GetOrCreate <TestTableModel>(v.GetProperty <decimal?>("TEST_TABLE_ID"));

            Assert.AreEqual(v.GetProperty <string>("NAME_T"), v1.GetProperty <string>("NAME_T"));
            Assert.AreEqual(v.GetProperty <decimal?>("VALUE_T"), v1.GetProperty <decimal?>("VALUE_T"));
            Assert.AreEqual(v.GetProperty <string>("PER_NUM"), v1.GetProperty <string>("PER_NUM"));
        }