public async Task FindFile_NoCacheAsync() { await storeA.AddFileAsync(sourceSymbolFile, FILENAME, BUILD_ID); storeSequence.AddStore(storeA); var fileReference = await storeSequence.FindFileAsync(FILENAME, BUILD_ID); Assert.AreEqual((await storeA.FindFileAsync(FILENAME, BUILD_ID)).Location, fileReference.Location); }
public async Task FindFile_EmptyBuildIdAsync() { mockSymbolStore.FindFileAsync(FILENAME, BuildId.Empty, true, Arg.Any <TextWriter>()) .Returns(Task.FromResult(fileReference)); moduleFileFinder.SetSearchPaths(SEARCH_PATHS); Assert.AreEqual( PATH_IN_STORE, await moduleFileFinder.FindFileAsync(FILENAME, BuildId.Empty, true, searchLog)); StringAssert.Contains(ErrorStrings.ModuleBuildIdUnknown, searchLog.ToString()); }
public async Task FindFile_CascadeAsync() { await storeC.AddFileAsync(sourceSymbolFile, FILENAME, BUILD_ID); symbolServer.AddStore(storeA); symbolServer.AddStore(storeB); symbolServer.AddStore(storeC); var fileReference = await symbolServer.FindFileAsync(FILENAME, BUILD_ID); Assert.NotNull(await storeA.FindFileAsync(FILENAME, BUILD_ID)); Assert.NotNull(await storeB.FindFileAsync(FILENAME, BUILD_ID)); Assert.AreEqual((await storeA.FindFileAsync(FILENAME, BUILD_ID)).Location, fileReference.Location); }
public async Task FindFile_WithMultipeCachesAsync() { await storeB.AddFileAsync(sourceSymbolFile, FILENAME, BUILD_ID); storeSequence.AddStore(cacheA); storeSequence.AddStore(storeA); storeSequence.AddStore(cacheB); storeSequence.AddStore(storeB); var fileReference = await storeSequence.FindFileAsync(FILENAME, BUILD_ID); Assert.NotNull(await cacheB.FindFileAsync(FILENAME, BUILD_ID)); Assert.Null(await cacheA.FindFileAsync(FILENAME, BUILD_ID)); Assert.AreEqual((await cacheB.FindFileAsync(FILENAME, BUILD_ID)).Location, fileReference.Location); }
public void SetUp() { searchLog = new StringWriter(); fileReference = Substitute.For <IFileReference>(); fileReference.IsFilesystemLocation.Returns(true); fileReference.Location.Returns(PATH_IN_STORE); mockSymbolStore = Substitute.For <ISymbolStore>(); mockSymbolStore.FindFileAsync(FILENAME, UUID, true, Arg.Any <TextWriter>()) .Returns(Task.FromResult(fileReference)); mockSymbolPathParser = Substitute.For <SymbolPathParser>(); mockSymbolPathParser.Parse(SEARCH_PATHS).Returns(mockSymbolStore); moduleFileFinder = new ModuleFileFinder(mockSymbolPathParser); }
public async Task <string> FindFileAsync( string filename, BuildId uuid, bool isDebugInfoFile, TextWriter searchLog) { if (string.IsNullOrEmpty(filename)) { throw new ArgumentNullException(Strings.FilenameNullOrEmpty, nameof(filename)); } searchLog = searchLog ?? TextWriter.Null; await searchLog.WriteLineAsync($"Searching for {filename}"); Trace.WriteLine($"Searching for {filename}"); if (uuid == BuildId.Empty) { await searchLog.WriteLineAsync(ErrorStrings.ModuleBuildIdUnknown); Trace.WriteLine($"Warning: The build ID of {filename} is unknown."); } var fileReference = await _symbolStore.FindFileAsync(filename, uuid, isDebugInfoFile, searchLog); if (fileReference == null) { await searchLog.WriteLineAsync(ErrorStrings.FailedToFindFile(filename)); Trace.WriteLine(ErrorStrings.FailedToFindFile(filename)); return(null); } if (!fileReference.IsFilesystemLocation) { await searchLog.WriteLineAsync( ErrorStrings.FileNotOnFilesystem(fileReference.Location)); Trace.WriteLine($"Unable to load file. '{fileReference.Location}' must be " + $"cached in a filesystem location."); return(null); } return(fileReference.Location); }