internal IChecksummedPersistentStorage GetStorageFromKey( Workspace workspace, SolutionKey solutionKey, IPersistentStorageFaultInjector faultInjectorOpt = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); var locationService = new MockPersistentStorageLocationService(solutionKey.Id, _persistentFolder.Path); _storageService = GetStorageService(locationService, faultInjectorOpt); var storage = _storageService.GetStorage(workspace, solutionKey, checkBranchId: true); // If we're injecting faults, we expect things to be strange if (faultInjectorOpt == null) { Assert.NotEqual(NoOpPersistentStorage.Instance, storage); } return(storage); }
internal async Task <IChecksummedPersistentStorage> GetStorageFromKeyAsync( Workspace workspace, SolutionKey solutionKey, IPersistentStorageFaultInjector?faultInjector = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); var locationService = new MockPersistentStorageLocationService(solutionKey.Id, _persistentFolder.Path); _storageService = GetStorageService((IMefHostExportProvider)workspace.Services.HostServices, locationService, faultInjector); var storage = await _storageService.GetStorageAsync(workspace, solutionKey, checkBranchId : true, CancellationToken.None); // If we're injecting faults, we expect things to be strange if (faultInjector == null) { Assert.NotEqual(NoOpPersistentStorage.Instance, storage); } return(storage); }
internal IChecksummedPersistentStorage GetStorage( Solution solution, IPersistentStorageFaultInjector?faultInjector = null) { // If we handed out one for a previous test, we need to shut that down first _storageService?.GetTestAccessor().Shutdown(); var locationService = new MockPersistentStorageLocationService(solution.Id, _persistentFolder.Path); _storageService = GetStorageService((IMefHostExportProvider)solution.Workspace.Services.HostServices, locationService, faultInjector); var storage = _storageService.GetStorage(solution, checkBranchId: true); // If we're injecting faults, we expect things to be strange if (faultInjector == null) { Assert.NotEqual(NoOpPersistentStorage.Instance, storage); } return(storage); }
internal IChecksummedPersistentStorage GetStorage( Solution solution, IPersistentStorageFaultInjector faultInjectorOpt = null) { // For the sake of tests, all solutions are bigger than our threshold, and thus deserve to get storage for them var solutionSizeTrackerMock = new Mock <ISolutionSizeTracker>(); solutionSizeTrackerMock.Setup(m => m.GetSolutionSize(solution.Workspace, solution.Id)) .Returns(solution.Workspace.Options.GetOption(StorageOptions.SolutionSizeThreshold) + 1); // If we handed out one for a previous test, we need to shut that down first _persistentLocationService?.RaiseShutdown(); _persistentLocationService = new MockPersistentStorageLocationService(solution.Id, _persistentFolder); var storage = GetStorageService(_persistentLocationService, solutionSizeTrackerMock.Object, faultInjectorOpt).GetStorage(solution, checkBranchId: true); // If we're injecting faults, we expect things to be strange if (faultInjectorOpt == null) { Assert.NotEqual(NoOpPersistentStorage.Instance, storage); } return(storage); }