public void TestCase_DefalutValue_Refresh()
        {
            context.TruncateTable <TeBaseFieldDefaultValue>();
            var value = context.CreateNew <TeBaseFieldDefaultValue>();

            context.Insert(value, true);
            var ac = context.SelectById <TeBaseFieldDefaultValue>(value.Id);

            AssertExtend.Equal(value, ac);
        }
        public async Task TestCase_MiniValue_Refresh_Async()
        {
            await context.TruncateTableAsync <TeBaseFieldNullMiniValue>(CancellationToken.None);

            var value = context.CreateNew <TeBaseFieldNullMiniValue>();
            await context.InsertAsync(value, true, CancellationToken.None);

            var ac = await context.SelectByIdAsync <TeBaseFieldNullMiniValue>(value.Id, CancellationToken.None);

            AssertExtend.Equal(value, ac);
        }
        public void TestCase_DefaultValue_BulkInsert_Refresh()
        {
            context.TruncateTable <TeBaseFieldDefaultValue>();

            var list = new List <TeBaseFieldDefaultValue>();

            for (int i = 0; i < 10; i++)
            {
                var value = context.CreateNew <TeBaseFieldDefaultValue>();
                list.Add(value);
            }
            context.BatchInsert(list, true, true);
            var listAc = context.Query <TeBaseFieldDefaultValue>().ToList();

            AssertExtend.Equal(list, listAc);
        }
        public async Task TestCase_MiniValue_BulkInsert_Refresh_Async()
        {
            await context.TruncateTableAsync <TeBaseFieldNullMiniValue>(CancellationToken.None);

            var list = new List <TeBaseFieldNullMiniValue>();

            for (int i = 0; i < 10; i++)
            {
                var value = context.CreateNew <TeBaseFieldNullMiniValue>();
                list.Add(value);
            }
            await context.BatchInsertAsync(list, true, true, CancellationToken.None);

            var listAc = await context.Query <TeBaseFieldNullMiniValue>().ToListAsync(CancellationToken.None);

            AssertExtend.Equal(list, listAc);
        }
        public async Task TestCase_CUD_Bulk_Async()
        {
            const int count  = 33;
            var       listEx = CreateBaseFieldEntityTableList(count);
            List <TeBaseFieldEntity> listAc;
            await context.TruncateTableAsync <TeBaseFieldEntity>(CancellationToken.None);

            var retInsert = await context.BatchInsertAsync(listEx, CancellationToken.None);

            Assert.Equal(count, retInsert);
            listAc = await context.Query <TeBaseFieldEntity>().ToListAsync(CancellationToken.None);

            AssertExtend.Equal(listEx, listAc);
            DateTime d = GetNow();

            listEx.ForEach(x =>
            {
                x.DateTimeField      = d;
                x.DateTimeFieldNull  = null;
                x.Int32Field         = 2;
                x.Int32FieldNull     = null;
                x.DoubleField        = 2.0d;
                x.DoubleFieldNull    = null;
                x.VarcharField       = "abc";
                x.VarcharFieldNull   = null;
                x.EnumInt32Field     = EnumInt32Type.Zero;
                x.EnumInt32FieldNull = null;
                x.EnumInt64Field     = EnumInt64Type.Zero;
                x.EnumInt64FieldNull = null;
            });
            var retUpdate = await context.BatchUpdateAsync(listEx, CancellationToken.None);

            Assert.Equal(count, retUpdate);
            listAc = await context.Query <TeBaseFieldEntity>().ToListAsync(CancellationToken.None);

            AssertExtend.Equal(listEx, listAc);
            var retDelete = await context.BatchDeleteAsync(listEx, CancellationToken.None);

            Assert.Equal(count, retDelete);
            listAc = await context.Query <TeBaseFieldEntity>().ToListAsync(CancellationToken.None);

            AssertExtend.Equal(0, listAc.Count);
        }
        public void TestCase_CUD_Bulk()
        {
            const int count  = 33;
            var       listEx = CreateBaseFieldEntityTableList(count);
            List <TeBaseFieldEntity> listAc;

            context.TruncateTable <TeBaseFieldEntity>();
            var retInsert = context.BatchInsert(listEx);

            Assert.Equal(count, retInsert);
            listAc = context.Query <TeBaseFieldEntity>().ToList();
            AssertExtend.Equal(listEx, listAc);
            DateTime d = GetNow();

            listEx.ForEach(x =>
            {
                x.DateTimeField      = d;
                x.DateTimeFieldNull  = null;
                x.Int32Field         = 2;
                x.Int32FieldNull     = null;
                x.DoubleField        = 2.0d;
                x.DoubleFieldNull    = null;
                x.VarcharField       = "abc";
                x.VarcharFieldNull   = null;
                x.EnumInt32Field     = EnumInt32Type.Zero;
                x.EnumInt32FieldNull = null;
                x.EnumInt64Field     = EnumInt64Type.Zero;
                x.EnumInt64FieldNull = null;
            });
            var retUpdate = context.BatchUpdate(listEx);

            Assert.Equal(count, retUpdate);
            listAc = context.Query <TeBaseFieldEntity>().ToList();
            AssertExtend.Equal(listEx, listAc);
            var retDelete = context.BatchDelete(listEx);

            Assert.Equal(count, retDelete);
            listAc = context.Query <TeBaseFieldEntity>().ToList();
            AssertExtend.Equal(0, listAc.Count);
        }