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";
        }
Exemple #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";
        }