public static void ApprovePublicApi(string assemblyPath) { var assemblyResolver = new DefaultAssemblyResolver(); assemblyResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath)); var readSymbols = File.Exists(Path.ChangeExtension(assemblyPath, ".pdb")); var asm = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters(ReadingMode.Deferred) { ReadSymbols = readSymbols, AssemblyResolver = assemblyResolver, }); var publicApi = PublicApiGenerator.CreatePublicApiForAssembly(asm); var writer = new ApprovalTextWriter(publicApi, "cs"); var approvalNamer = new AssemblyPathNamer(assemblyPath); ApprovalTests.Approvals.Verify(writer, approvalNamer, ApprovalTests.Approvals.GetReporter()); }
public static void ApprovePublicApi(string assemblyPath) { var assemblyResolver = new DefaultAssemblyResolver(); assemblyResolver.AddSearchDirectory(Path.GetDirectoryName(assemblyPath)); var readSymbols = File.Exists(Path.ChangeExtension(assemblyPath, ".pdb")); var asm = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters(ReadingMode.Deferred) { ReadSymbols = readSymbols, AssemblyResolver = assemblyResolver, }); var publicApi = PublicApiGenerator.CreatePublicApiForAssembly(asm); publicApi.ShouldMatchApproved(c => c .WithFileExtension(".cs") .UseCallerLocation()); }