private string InitConnectionString(ProviderType provider) { if (!MsAccessDataHelper.HasProvider(provider)) { throw new InvalidOperationException(string.Format(Resources.ProviderNotInstaller, provider.ToString())); } _databasePath = GenerateDatabaseName(); if (!string.IsNullOrEmpty(_sourceDatabasePath)) { File.Copy(_sourceDatabasePath, _databasePath, true); } else if (_sourceDatabaseStream != null) { using (FileStream writer = new FileStream(_databasePath, FileMode.Create, FileAccess.Write)) { _sourceDatabaseStream.CopyTo(writer); } } else { MsAccessDataHelper.CreateEmptyDatabase(_databasePath, provider); } return(MsAccessDataHelper.CreateConnectionString(_databasePath, provider)); }
public static void SkipTestIfJetProviderNotAvailable() => Skip.If(!MsAccessDataHelper.HasProvider(ProviderType.Jet), string.Format(ProviderNotAvailableMessage, MsAccessDataHelper.JetProviderBase));