public void ProjectPathSet() { var pathTable = new PathTable(); AbsolutePath firstPath = AbsolutePath.Create(pathTable, X("/X/bar")); AbsolutePath secondPath = AbsolutePath.Create(pathTable, X("/X/foo")); var p = CreateResult( pathTable, ObservedInput.CreateFileContentRead(firstPath, ContentHashingUtilities.EmptyHash), ObservedInput.CreateFileContentRead(secondPath, ContentHashingUtilities.EmptyHash)); ObservedPathSet projected = p.GetPathSet(unsafeOptions: null); ObservedPathSetTestUtilities.AssertPathSetsEquivalent( projected, ObservedPathSetTestUtilities.CreatePathSet(pathTable, firstPath, secondPath)); }
private static ObservedPathSet SerializeRoundTripAndAssertEquivalent(PathTable pathTable, ObservedPathSet original, PathExpander pathExpander = null) { using (var mem = new MemoryStream()) { using (var writer = new BuildXLWriter(stream: mem, debug: true, leaveOpen: true, logStats: true)) { original.Serialize(pathTable, writer, pathExpander); } mem.Position = 0; ObservedPathSet roundtrip; using (var reader = new BuildXLReader(stream: mem, debug: true, leaveOpen: true)) { var maybeRoundtrip = ObservedPathSet.TryDeserialize(pathTable, reader, pathExpander); XAssert.IsTrue(maybeRoundtrip.Succeeded, "Failed to deserialize a path set unexpectedly"); roundtrip = maybeRoundtrip.Result; } ObservedPathSetTestUtilities.AssertPathSetsEquivalent(original, roundtrip); return(roundtrip); } }