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";
        }
示例#2
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";
        }