Beispiel #1
0
        // [TestCase ("Clients/Xamarin.Interactive.Client")]
        public void EnsureNoApiDifferenceAndLint(string basePath)
        {
            basePath = Path.Combine(TestHelpers.PathToRepoRoot, basePath);
            var assemblyName     = Path.GetFileName(basePath);
            var assemblyFileName = Path.Combine(
                basePath,
                "bin",
                TestHelpers.Configuration,
                "netstandard2.0",
                assemblyName + ".dll");
            var apiReference = Path.Combine(
                TestHelpers.PathToRepoRoot,
                "docs",
                assemblyName + ".api.cs");

            var writer = new StringWriter();
            var linter = new ApiDump.LintTool();
            var driver = new ApiDump.Driver(assemblyFileName);

            driver.AddVisitorTool(linter);
            driver.Write(writer);

            writer.ToString().ShouldEqual(
                File.ReadAllText(apiReference),
                ShouldEqualOptions.LineDiff);

            if (linter.Issues.Count > 0)
            {
                Assert.Fail(string.Join(
                                "\n\n",
                                linter.Issues.Select(issue => issue.Description)));
            }
        }
Beispiel #2
0
        public void EnsureNoApiDifferenceAndLint(
            string basePath,
            string assemblyFileName,
            string apiReference)
        {
            basePath         = Path.Combine(TestHelpers.PathToRepoRoot, basePath);
            assemblyFileName = Path.Combine(
                basePath,
                "bin",
                TestHelpers.Configuration,
                "netstandard2.0",
                assemblyFileName);
            apiReference = Path.Combine(basePath, apiReference);

            var writer = new StringWriter();
            var linter = new ApiDump.LintTool();
            var driver = new ApiDump.Driver(assemblyFileName);

            driver.AddVisitorTool(linter);
            driver.Write(writer);

            writer.ToString().ShouldEqual(
                File.ReadAllText(apiReference),
                ShouldEqualOptions.LineDiff);

            foreach (var issue in linter.Issues)
            {
                Assert.Fail(issue.Description);
            }
        }