public FunctionalTestsConfiguration()
        {
            SetProviderServices(SqlCeProviderServices.ProviderInvariantName, SqlCeProviderServices.Instance);
            SetProviderServices(SqlProviderServices.ProviderInvariantName, SqlProviderServices.Instance);

            SetDefaultConnectionFactory(new DefaultUnitTestsConnectionFactory());

            if (DatabaseTestHelpers.IsSqlAzure(ModelHelpers.BaseConnectionString))
            {
                SetExecutionStrategy("System.Data.SqlClient", () => new SuspendableSqlAzureExecutionStrategy());
            }
            else
            {
                SetExecutionStrategy("System.Data.SqlClient", () => new DefaultExecutionStrategy());
            }

            SetContextFactory(() => new CodeFirstScaffoldingContext("Foo"));
            SetContextFactory(() => new CodeFirstScaffoldingContextWithConnection("Bar"));

            SetMetadataAnnotationSerializer(CollationAttribute.AnnotationName, () => new CollationSerializer());

            AddInterceptor(new TestLoadedInterceptor());
            AddInterceptor(new TestLoadedInterceptor(4102, "1 yraunaJ"));
            AddInterceptor(new RegisterMutableResolver());
        }
Beispiel #2
0
 public string ResolveManifestToken(DbConnection connection)
 {
     if (!string.IsNullOrWhiteSpace(connection.Database) && // Some negative cases require the provider to fail
         connection is SqlConnection || connection.GetType().FullName.StartsWith("Castle.Proxies."))
     {
         return((DatabaseTestHelpers.IsSqlAzure(connection.ConnectionString)) ? "2012.Azure" : "2008");
     }
     return(_defaultManifestTokenResolver.ResolveManifestToken(connection));
 }
Beispiel #3
0
 public static T ExecuteNew <T>(Func <T> func)
 {
     if (DatabaseTestHelpers.IsSqlAzure(ModelHelpers.BaseConnectionString))
     {
         var executionStrategy = new ExtendedSqlAzureExecutionStrategy();
         return(executionStrategy.Execute(func));
     }
     else
     {
         return(func());
     }
 }
Beispiel #4
0
 public static void ExecuteNew(Action action)
 {
     if (DatabaseTestHelpers.IsSqlAzure(ModelHelpers.BaseConnectionString))
     {
         var executionStrategy = new ExtendedSqlAzureExecutionStrategy();
         executionStrategy.Execute(action);
     }
     else
     {
         action();
     }
 }
Beispiel #5
0
        public FunctionalTestsConfiguration()
        {
            SetProviderServices(SqlCeProviderServices.ProviderInvariantName, SqlCeProviderServices.Instance);
            SetProviderServices(System.Data.Entity.SqlServerCompact.Legacy.SqlCeProviderServices.ProviderInvariantName, System.Data.Entity.SqlServerCompact.Legacy.SqlCeProviderServices.Instance);
            SetProviderServices(SqlProviderServices.ProviderInvariantName, SqlProviderServices.Instance);

            SetDefaultConnectionFactory(new DefaultUnitTestsConnectionFactory());
            AddDependencyResolver(new SingletonDependencyResolver <IManifestTokenResolver>(new FunctionalTestsManifestTokenResolver()));

            SetExecutionStrategy(
                "System.Data.SqlClient", () => DatabaseTestHelpers.IsSqlAzure(ModelHelpers.BaseConnectionString)
                    ? new TestSqlAzureExecutionStrategy()
                    : (IDbExecutionStrategy) new DefaultExecutionStrategy());

            SetContextFactory(() => new CodeFirstScaffoldingContext("Foo"));
            SetContextFactory(() => new CodeFirstScaffoldingContextWithConnection("Bar"));
        }