Exemple #1
0
        public void DeleteTableTest()
        {
            var factory = new MySQLCommandFactory();
            var table   = Utils.RandomName();
            var builder = factory.CreateDeleteBuilder()
                          .From(factory.GetDbObjectFactory().CreateTable(table));

            Assert.Equal($"DELETE `{ table }`", builder.Build());
        }
Exemple #2
0
        public void CreateTest()
        {
            var factory = new MySQLCommandFactory();

            Assert.IsAssignableFrom <ISelectBuilder>(factory.CreateSelectBuilder());
            Assert.IsAssignableFrom <IInsertBuilder>(factory.CreateInsertBuilder());
            Assert.IsAssignableFrom <IUpdateBuilder>(factory.CreateUpdateBuilder());
            Assert.IsAssignableFrom <IDeleteBuilder>(factory.CreateDeleteBuilder());
        }
Exemple #3
0
        public void DeleteTableWhereTest()
        {
            var factory     = new MySQLCommandFactory();
            var table       = Utils.RandomName();
            var column_1    = Utils.RandomName();
            var condition_1 = factory.GetConditionFactory().EqualTo(factory.GetDbObjectFactory().CreateColumn(column_1), factory.GetDbObjectFactory().CreateParameter(column_1));
            var builder     = factory.CreateDeleteBuilder()
                              .From(factory.GetDbObjectFactory().CreateTable(table))
                              .Where(condition_1);

            Assert.Equal($"DELETE `{ table }` WHERE `{ column_1 }` = @{ column_1 }", builder.Build());
        }