Пример #1
0
 public void TestTruncateTableWithNoName()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         var expression = new TruncateTable(string.Empty);
     });
 }
Пример #2
0
        public async Task truncate_by_document()
        {
            var targets = Target.GenerateRandomData(100).ToList();
            await theStore.BulkInsertAsync(targets);

            var op = new TruncateTable(typeof(Target));

            theSession.QueueOperation(op);
            await theSession.SaveChangesAsync();

            var count = await theSession.Query <Target>().CountAsync();

            count.ShouldBe(0);
        }
Пример #3
0
        public async Task truncate_by_table_name()
        {
            var targets = Target.GenerateRandomData(100).ToList();
            await theStore.BulkInsertAsync(targets);

            var tableName = theStore.Options.Storage.MappingFor(typeof(Target)).TableName;
            var op        = new TruncateTable(tableName);

            theSession.QueueOperation(op);
            await theSession.SaveChangesAsync();

            var count = await theSession.Query <Target>().CountAsync();

            count.ShouldBe(0);
        }
Пример #4
0
        public void TestTruncateTable()
        {
            var expression = new TruncateTable("TestTable");

            Assert.Equal("TRUNCATE TABLE TestTable", expression.ToString());
        }