using Microsoft.VisualStudio.TestTools.UnitTesting;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYY.Core.Standard.Data.Infrastructure;
using XYY.DataMSHelper.Standard;

namespace XYY.Test
{
    [TestClass]
    public class TestCreateTable
    {
        [TestMethod]
        public async Task Test()
        {
            string sqlConn = "Server=183.57.73.109,3433;Pooling=true;Max Pool Size=40000;Min Pool Size=0;initial catalog=xyy_wms;uid=xyy;pwd=n3T3RTlM;MultipleActiveResultSets=True;";

            using (IUnitOfWork _unitOfWork = new UnitOfWork(new System.Data.SqlClient.SqlConnection(sqlConn), sqlConn))
            {
                _unitOfWork.Connection.Open();
                _unitOfWork.Transaction = _unitOfWork.Connection.BeginTransaction();
                CreaterHelper createrHelper = new CreaterHelper(_unitOfWork);
                try
                {
                    await createrHelper.CreateTables("XYY.Model.Standard.Erp.Purchase", "XYY.Model.Standard");
                    _unitOfWork.Commit();
                }
                catch (Exception ex)
                {
                    _unitOfWork.Rollback();
                }
            }
        }


    }
}
