Ejemplo n.º 1
0
        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());
            }
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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);
            }
        }