Exemplo n.º 1
0
        /// <summary>
        /// An extension method that generates the Visibility Matrix for the current Api and writes it to a text file.
        /// </summary>
        /// <param name="api">The <see cref="ApiBase"/> instance to build the Visibility Matrix for.</param>
        /// <param name="sourceDirectory">
        /// A string containing the relative or absolute path to use as the root. The default is "". If you want to be able to have it as part of the project,
        /// so you can check it into source control, use "..//..//".
        /// </param>
        /// <param name="suffix">A string to append to the Api name when writing the text file.</param>
        public static void WriteCurrentVisibilityMatrix(this ApiBase api, string sourceDirectory = "", string suffix = "ApiSurface")
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }

            var filePath = $"{sourceDirectory}{api.GetType().Name}-{suffix}.txt";
            var report   = api.GenerateVisibilityMatrix();

            System.IO.File.WriteAllText(filePath, report);
        }