Пример #1
0
 public static void ApprovePublicApi(Assembly assembly)
 {
     var publicApi = PublicApiGenerator.PublicApiGenerator.GetPublicApi(assembly);
     var writer = new ApprovalTextWriter(publicApi, "cs");
     var approvalNamer = new AssemblyPathNamer(assembly.Location);
     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);
            var writer = new ApprovalTextWriter(publicApi, "cs");
            ApprovalTests.Approvals.Verify(writer, new UnitTestFrameworkNamer(), ApprovalTests.Approvals.GetReporter());
        }