/// <summary>
        /// Checks to make sure tha the specified code produces the expected API.
        /// </summary>
        /// <param name="filePrefix">The prefix to the code..</param>
        public static void CheckApi([CallerMemberName] string filePrefix = null)
        {
            string assemblyFilePath = null;

            try
            {
                var codeFilePath = Path.Combine(_rootDirectory, filePrefix + ".cs");
                var apiFilePath  = Path.Combine(_rootDirectory, filePrefix + ".txt");

                if (!File.Exists(apiFilePath))
                {
                    File.Create(apiFilePath).Close();
                }

                var code = File.ReadAllText(codeFilePath);
                assemblyFilePath = CreateAssembly(code);

                var publicApi   = MetadataApi.GeneratePublicApi(assemblyFilePath);
                var expectedApi = File.ReadAllText(apiFilePath);

                var receivedFileName = filePrefix + ".received.txt";
                File.WriteAllText(receivedFileName, publicApi);

                TestHelpers.CheckEquals(publicApi, expectedApi, receivedFileName, apiFilePath);
            }
            finally
            {
                if (assemblyFilePath != null)
                {
                    File.Delete(assemblyFilePath);
                }
            }
        }
Esempio n. 2
0
        public void TestEquals()
        {
            var assembly = Assembly.GetAssembly(typeof(RxApp));
            var oldApi   = ApiGenerator.GeneratePublicApi(assembly, new ApiGeneratorOptions());

            var newApi = MetadataApi.GeneratePublicApi(assembly);

            File.WriteAllText("old.txt", oldApi);
            File.WriteAllText("new.txt", newApi);

            TestHelpers.CheckEquals(newApi, oldApi, "new.txt", "old.txt");
        }
Esempio n. 3
0
 public void MetadataApiGenerator() => MetadataApi.GeneratePublicApi(typeof(string).Assembly);
Esempio n. 4
0
        public void CoreLibProducesContent()
        {
            var value = MetadataApi.GeneratePublicApi(Assembly.GetAssembly(typeof(string)));

            Assert.IsNotNull(value);
        }
Esempio n. 5
0
        public void RxUIGeneratesContent()
        {
            var value = MetadataApi.GeneratePublicApi(Assembly.GetAssembly(typeof(RxApp)));

            Assert.IsNotNull(value);
        }