예제 #1
0
        public void TestInsertStatementExcludesReadOnlyProps()
        {
            ClassDef.ClassDefs.Clear();
            const string newPropName = "NewProp";
            MockBO       bo          = StatementGeneratorTestHelper.CreateMockBOWithExtraReadOnlyProp(newPropName);

            InsertStatementGenerator gen = new InsertStatementGenerator(bo, DatabaseConnection.CurrentConnection);
            var statementCol             = gen.Generate();
            InsertSqlStatement statement = (InsertSqlStatement)statementCol.First();

            Assert.IsFalse(statement.Statement.ToString().Contains(newPropName));
        }
        public void TestUpdateStatementExcludesNonPersistableProps()
        {
            const string newPropName = "NewProp";
            MockBO       bo          = StatementGeneratorTestHelper.CreateMockBOWithExtraNonPersistableProp(newPropName);

            bo.SetPropertyValue(newPropName, "newvalue323");
            bo.SetPropertyValue("MockBOProp2", "dfggjh");

            UpdateStatementGenerator gen = new UpdateStatementGenerator(bo, DatabaseConnection.CurrentConnection);
            var statementCol             = gen.Generate();
            var sqlStatements            = statementCol.ToList();

            Assert.AreEqual(1, sqlStatements.Count);
            ISqlStatement statement = sqlStatements[0];

            Assert.IsFalse(statement.Statement.ToString().Contains(newPropName));
        }