コード例 #1
0
        public void AnalyzingSelfFindsThisMethodAndOtherStuff()
        {
            using (var tempFileManager = new TempFileManager())
            {
                var humanReadableFile    = tempFileManager.GetNew();
                var computerReadableFile = tempFileManager.GetNew();
                RunMain(m_ThisProjectFile, humanReadableFile, computerReadableFile, "TestCode;AssemblyApiTests", @"OurCode;AssemblyApi\.");
                var lines = File.ReadAllLines(humanReadableFile.FullName);

                var linesContainingThisMethod = lines.Where(l => l.Contains(nameof(AnalyzingSelfFindsThisMethodAndOtherStuff))).ToList();
                Assert.That(linesContainingThisMethod, Has.Count.EqualTo(1));

                Assert.That(lines, Has.Length.GreaterThan(15));
            }
        }
コード例 #2
0
        private static FileInfo WriteHumanReadable(IEnumerable <IApiNode> apiNodes, TempFileManager tempFileManager)
        {
            var outputFile = tempFileManager.GetNew();

            new PublicApiWriter().WriteHumanReadable(apiNodes, outputFile, CancellationToken.None).Wait();
            return(outputFile);
        }
コード例 #3
0
 private static IReadOnlyCollection <IApiNode> RoundTripApi(IReadOnlyCollection <IApiNode> originalApiNodes)
 {
     using (var tempFileManager = new TempFileManager())
     {
         var outputFile = tempFileManager.GetNew();
         JsonSerialization.WriteJson(originalApiNodes, outputFile);
         return(JsonSerialization.ReadJson(outputFile));
     }
 }