Beispiel #1
0
        public void approve_public_api()
        {
            var assembly  = typeof(StringHumanizeExtensions).Assembly;
            var publicApi = PublicApiGenerator.CreatePublicApiForAssembly(assembly);

            Approvals.Verify(publicApi);
        }
Beispiel #2
0
        public void ApproveCore()
        {
            var assemblyPath = Path.GetFullPath(typeof(PatternMatch).Assembly.Location);
            var asm          = AssemblyDefinition.ReadAssembly(assemblyPath);
            var publicApi    = Filter(PublicApiGenerator.CreatePublicApiForAssembly(asm));

            Approvals.Verify(publicApi);
        }
Beispiel #3
0
        public void ApproveClusterTools()
        {
            var assemblyPath = Path.GetFullPath(typeof(ClusterSingletonManager).Assembly.Location);
            var asm          = AssemblyDefinition.ReadAssembly(assemblyPath);
            var publicApi    = Filter(PublicApiGenerator.CreatePublicApiForAssembly(asm));

            Approvals.Verify(publicApi);
        }
Beispiel #4
0
        private static void AssertPublicApi(AssemblyDefinition assemblyDefinition, Type[] types, string expectedOutput, bool includeAssemblyAttributes)
        {
            var typesNames   = new HashSet <string>(types.Select(t => t.FullName));
            var actualOutput = PublicApiGenerator.CreatePublicApiForAssembly(assemblyDefinition, t => typesNames.Contains(t.FullName), includeAssemblyAttributes);

            actualOutput = StripEmptyLines.Replace(actualOutput, string.Empty);
            Assert.Equal(expectedOutput, actualOutput);
        }
    public void Approve()
    {
        var assemblyPath = Path.GetFullPath(typeof(EndpointSLAAttribute).Assembly.Location);
        var asm          = AssemblyDefinition.ReadAssembly(assemblyPath);
        var publicApi    = Filter(PublicApiGenerator.CreatePublicApiForAssembly(asm));

        Approvals.Verify(publicApi);
    }
    public void Approve()
    {
        Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
        var assemblyPath = Path.GetFullPath(typeof(AutofacBuilder).Assembly.Location);
        var asm          = AssemblyDefinition.ReadAssembly(assemblyPath);
        var publicApi    = Filter(PublicApiGenerator.CreatePublicApiForAssembly(asm));

        Approvals.Verify(publicApi);
    }
Beispiel #7
0
        public void ApproveAzureServiceBusTransport()
        {
            Directory.SetCurrentDirectory(TestContext.CurrentContext.TestDirectory);
            var assemblyPath = Path.GetFullPath(typeof(AzureServiceBusTransport).Assembly.Location);
            var asm          = AssemblyDefinition.ReadAssembly(assemblyPath);
            var publicApi    = PublicApiGenerator.CreatePublicApiForAssembly(asm, definition => true, false);

            Approvals.Verify(publicApi);
        }
        private static void ApproveApi(string frameworkVersion)
        {
            string     codeBase            = Assembly.GetExecutingAssembly().CodeBase;
            UriBuilder uri                 = new UriBuilder(new Uri(codeBase));
            string     assemblyPath        = Uri.UnescapeDataString(uri.Path);
            var        containingDirectory = Path.GetDirectoryName(assemblyPath);
            var        configurationName   = new DirectoryInfo(containingDirectory).Parent.Name;
            var        assemblyFile        = $@"..\..\..\..\..\src\FakeItEasy\bin\{configurationName}\{frameworkVersion}\FakeItEasy.dll";

            var assembly = Assembly.LoadFile(Path.GetFullPath(assemblyFile));

            Approvals.Verify(PublicApiGenerator.GetPublicApi(assembly));
        }
Beispiel #9
0
        public void ApproveApiNetStd()
        {
            // Approvals and PublicApiGenerator aren't available for .NET Core, so
            // we'll load the .NET Standard FakeItEasy assembly from disk and
            // examine it.
            string     codeBase            = Assembly.GetExecutingAssembly().CodeBase;
            UriBuilder uri                 = new UriBuilder(new Uri(codeBase));
            string     assemblyPath        = Uri.UnescapeDataString(uri.Path);
            var        containingDirectory = Path.GetDirectoryName(assemblyPath);
            var        configurationName   = new DirectoryInfo(containingDirectory).Name;
            var        assemblyFile        = @"..\..\..\..\src\FakeItEasy.netstd\bin\" + configurationName + @"\FakeItEasy.dll";

            var assembly = Assembly.LoadFrom(assemblyFile);

            Approvals.Verify(PublicApiGenerator.GetPublicApi(assembly));
        }
Beispiel #10
0
        public void approve_public_api()
        {
            var assemblyPath = typeof(StringHumanizeExtensions).Assembly.Location;

            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);

            Approvals.Verify(publicApi);
        }
Beispiel #11
0
 public void ApproveApi()
 {
     Approvals.Verify(PublicApiGenerator.GetPublicApi(typeof(A).Assembly));
 }