public void GlobalSetup() { _useExportProviderAttribute.Before(null); if (_workspace != null) { throw new InvalidOperationException(); } _workspace = TestWorkspace.Create( @"<Workspace> <Project Language=""NoCompilation"" CommonReferences=""false""> <Document> // a no-compilation document </Document> </Project> </Workspace>"); // Explicitly choose the sqlite db to test. _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options .WithChangedOption(StorageOptions.Database, StorageDatabase.SQLite))); _storageService = new SQLitePersistentStorageService( _workspace.Services.GetService <IOptionService>(), new LocationService()); _storage = _storageService.GetStorageWorker(_workspace.CurrentSolution); if (_storage == NoOpPersistentStorage.Instance) { throw new InvalidOperationException("We didn't properly get the sqlite storage instance."); } Console.WriteLine("Storage type: " + _storage.GetType()); _document = _workspace.CurrentSolution.Projects.Single().Documents.Single(); _random = new Random(0); }
public void GlobalSetup() { _useExportProviderAttribute.Before(null); if (_workspace != null) { throw new InvalidOperationException(); } _workspace = TestWorkspace.Create( @"<Workspace> <Project Language=""NoCompilation"" CommonReferences=""false""> <Document> // a no-compilation document </Document> </Project> </Workspace>"); // Ensure we always use the storage service, no matter what the size of the solution. _workspace.Options = _workspace.Options.WithChangedOption(StorageOptions.SolutionSizeThreshold, -1); _storageService = new SQLitePersistentStorageService( _workspace.Services.GetService <IOptionService>(), new LocationService(), new SolutionSizeTracker()); _storage = _storageService.GetStorageWorker(_workspace.CurrentSolution); if (_storage == NoOpPersistentStorage.Instance) { throw new InvalidOperationException("We didn't properly get the sqlite storage instance."); } Console.WriteLine("Storage type: " + _storage.GetType()); _document = _workspace.CurrentSolution.Projects.Single().Documents.Single(); _random = new Random(0); }