public void LoadCorrectlyTest() { var assembly = typeof(SchoolViewModel).Assembly; using (var kernel = new ConversionKernel(assembly)) { // Make sure the XML documentation is loaded var assemblyName = assembly.GetProjectName(); var xmlDocPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{assemblyName}.xml"); kernel.LoadXmlDocumentation(xmlDocPath); Assert.IsNotNull(kernel.Documentation); Assert.IsTrue(kernel.Documentation.Initialized); Assert.IsTrue(kernel.Documentation.Members.Any()); } }
/// <summary> /// Compile a model for DefinitelyTyped. /// </summary> protected static void CompileDefinitelyTyped(ConversionKernel kernel, string fileName = "reference", bool minify = false) { // Make sure the XML documentation is loaded var assemblyName = typeof(TestBase).Assembly.GetProjectName(); kernel.LoadXmlDocumentation(); var converter = kernel.CreateConverterForTypeScript(TypeScriptSpecification.Declaration); var converted = converter.Convert(); if (minify) { fileName += ".min"; } converter.WriteToFile(converted, FilePath, fileName, minify); }
public void CompileTest() { var assembly = typeof(SchoolViewModel).Assembly; using (var kernel = new ConversionKernel(assembly)) { // Make sure the XML documentation is loaded var assemblyName = assembly.GetProjectName(); var xmlDocPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{assemblyName}.xml"); kernel.LoadXmlDocumentation(xmlDocPath); // Convert the available models and look if the result is as expected. CompileJavaScript(kernel, JavaScriptVersion.V5); CompileTypeScript(kernel); CompileDefinitelyTyped(kernel); } }