public static async Task<TemporaryDirectory> CopyTestAssets(string name) { var assetPath = Path.Join(Directory.GetCurrentDirectory(), "assets", name); if (!Directory.Exists(assetPath)) throw new IOException($"Could not find the '{name}' test asset."); var tempDir = new TemporaryDirectory(); try { tempDir.CopyFrom(assetPath); return tempDir; } catch (Exception) { await tempDir.DisposeAsync(); throw; } }