public void Execute_Test()
        {
            TestExecutionContext.CurrentContext.OutWriter.WriteLine($"{DateTime.Now:hh:mm:ss.fffffff}: Running {TestExecutionContext.CurrentContext.CurrentTest.FullName}");

            IntegrationTest = CreateIntegrationTest();
            EditApiTest();

            var strategy = Context.Database.CreateExecutionStrategy();

            strategy.Execute(() =>
            {
                using var transaction = Context.Database.BeginTransaction();

                IntegrationTest.Setup();
                Context.SaveChanges();
                transaction.Commit();
            });

            IntegrationTest.Run();
            IntegrationTest.Cleanup();

            // Save changes after cleanup
            Context.SaveChanges();

            TestExecutionContext.CurrentContext.OutWriter.WriteLine($"{DateTime.Now:hh:mm:ss.fffffff}: Finished {TestExecutionContext.CurrentContext.CurrentTest.FullName}");
        }
        protected override void Establish_context()
        {
            base.Establish_context();

            IntegrationTest = CreateIntegrationTest();
            var strategy = Context.Database.CreateExecutionStrategy();

            strategy.Execute(() =>
            {
                using var transaction = Context.Database.BeginTransaction();

                IntegrationTest.Setup();
                Context.SaveChanges();
                transaction.Commit();
            });

            //using (var transaction = new TransactionScope())
            //{
            //    IntegrationTest.Setup();
            //    transaction.Complete();
            //}

            // Set the name in the setup
            TestExecutionContext.CurrentContext.CurrentTest.Name = $"{IntegrationTest.GetType().Name}.Execute_Test";
        }
Ejemplo n.º 3
0
        public void Initialize()
        {
            _queryChain = new QueryChain()
                          .UseDapper(new Dapper.DapperConfiguration()
            {
                ConnectionString = "server=.;database=Storm;integrated security=true;"
            });

            _it = new IntegrationTest(_queryChain);
        }
Ejemplo n.º 4
0
        public void Initialize()
        {
            _queryChain = new QueryChain()
                          .UseDapper(new Dapper.DapperConfiguration()
            {
                ConnectionStringName = "TestDatabase"
            });

            _it = new IntegrationTest(_queryChain);
        }
Ejemplo n.º 5
0
        protected override void Establish_context()
        {
            base.Establish_context();

            IntegrationTest = CreateIntegrationTest();

            using (var transaction = new TransactionScope())
            {
                IntegrationTest.Setup();
                transaction.Complete();
            }

            // Set the name in the setup
            TestExecutionContext.CurrentContext.CurrentTest.Name = $"{IntegrationTest.GetType().Name}.Execute_Test";
        }