예제 #1
0
 private static void CreateNewContainerAndDbContext()
 {
     if (TestDependencyScope.IsInitialized())
     {
         TestDependencyScope.End();
         TestDependencyScope.Begin();
     }
 }
예제 #2
0
        private static void ResetDatabase()
        {
            var checkpoint = new Checkpoint
            {
                SchemasToExclude = new[] { "RoundhousE" },
                TablesToIgnore   = new[]
                {
                    "sysdiagrams",
                    "ApplicationStatus",
                }
            };

            checkpoint.Reset(TestDependencyScope.Resolve <Func <IDbConnection> >()().ConnectionString).GetAwaiter().GetResult();
        }
예제 #3
0
        public void Execute(TestClass testClass)
        {
            TestingIoC.Initialize();
            TestDependencyScope.Begin();

            ResetDatabase();

            var fixture = new Fixture();

            AutoFixtureParameterSource.CustomizeAutoFixture(fixture);
            var instance = new SpecimenContext(fixture).Resolve(testClass.Type);

            testClass.RunCases(@case => { @case.Execute(instance); });

            TestDependencyScope.End();

            instance.Dispose();
        }
예제 #4
0
 public static object Resolve(Type type)
 {
     return(TestDependencyScope.Resolve(type));
 }
예제 #5
0
 public static T Resolve <T>()
 {
     return(TestDependencyScope.Resolve <T>());
 }