Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
     }
 }