public void TestValidFileId(int pathId, int rewriteCount) { var file = new FileArtifact(new AbsolutePath(pathId), rewriteCount); var file2 = FileId.Parse(FileId.ToString(file)); XAssert.AreEqual(file, file2); }
internal SymbolFile( Func <string, bool> symlinkTester, Client bxlClient, string filePath, string fileId, ContentHash hash, IEnumerable <DebugEntryData> debugEntries) { Contract.Requires(symlinkTester != null); Contract.Requires(bxlClient != null); Contract.Requires(!string.IsNullOrEmpty(filePath)); Contract.Requires(!string.IsNullOrEmpty(fileId)); Contract.Requires(debugEntries == null || debugEntries.All(de => de.BlobIdentifier == null)); // It's not clear whether the symbol endpoint can play nicely with dedup hashes, so locking it down to VSO0 for now. Contract.Requires(hash.HashType == HashType.Vso0, "support only VSO0 hashes (for now)"); m_symlinkTester = symlinkTester; m_bxlClient = bxlClient; FullFilePath = Path.GetFullPath(filePath); m_file = FileId.Parse(fileId); Hash = hash; if (debugEntries != null) { var blobIdentifier = new Microsoft.VisualStudio.Services.BlobStore.Common.BlobIdentifier(Hash.ToHashByteArray()); var entries = new List <DebugEntryData>(debugEntries); entries.ForEach(entry => entry.BlobIdentifier = blobIdentifier); m_debugEntries = entries; } }
internal SymbolFile( Func <string, bool> symlinkTester, Client bxlClient, string filePath, string fileId, ContentHash hash, IEnumerable <IDebugEntryData> debugEntries) { Contract.Requires(symlinkTester != null); Contract.Requires(bxlClient != null); Contract.Requires(!string.IsNullOrEmpty(filePath)); Contract.Requires(!string.IsNullOrEmpty(fileId)); Contract.Requires(hash.IsValid); // It's not clear whether the symbol endpoint can play nicely with dedup hashes, so locking it down to VSO0 for now. Contract.Requires(hash.HashType == HashType.Vso0, "support only VSO0 hashes (for now)"); if (debugEntries != null) { var blobIdentifier = new BlobIdentifier(hash.ToHashByteArray()); Contract.Assert(debugEntries.All(e => e.BlobIdentifier == blobIdentifier)); m_debugEntries = new List <IDebugEntryData>(debugEntries); } m_symlinkTester = symlinkTester; m_bxlClient = bxlClient; FullFilePath = Path.GetFullPath(filePath); m_file = FileId.Parse(fileId); Hash = hash; }
internal DropItemForBuildXLFile( Func <string, bool> symlinkTester, Client client, string filePath, string fileId, FileContentInfo fileContentInfo, string relativeDropPath = null) : base(filePath, relativeDropPath, fileContentInfo) { Contract.Requires(symlinkTester != null); Contract.Requires(client != null); Contract.Requires(!string.IsNullOrEmpty(filePath)); Contract.Requires(!string.IsNullOrEmpty(fileId)); m_symlinkTester = symlinkTester; m_file = FileId.Parse(fileId); m_client = client; m_chunkDedup = fileContentInfo.Hash.HashType.IsValidDedup(); Hash = fileContentInfo.Hash; }
[InlineData("1:not-an-int")] // second field not an int public void TestInvalidFileId(string fileIdStr) { XAssert.IsFalse(FileId.TryParse(fileIdStr, out _)); Assert.Throws <ArgumentException>(() => FileId.Parse(fileIdStr)); }