Ejemplo n.º 1
0
        public void ReplaceAspExprs_Properly_Replaces_AppSettings_Type_Tag()
        {
            var inputText      = $"{WebFormsAspExpressionStartTag} {AppSettingsAspExpressionType}: {AppSettingsAspExpressionContent} {WebFormsNormalEndTag}";
            var expectedOutput = $"{RazorExplicitBindingStartTag}Configuration[\"{AppSettingsSectionName}:{AppSettingsAspExpressionContent}\"]{RazorExplicitBindingEndTag}";
            var actualOutput   = EmbeddedCodeReplacers.ReplaceAspExprs(inputText);

            Assert.AreEqual(expectedOutput, actualOutput);
        }
Ejemplo n.º 2
0
        public void ReplaceAspExprs_Properly_Replaces_Unknown_Type_Tag()
        {
            var inputText      = $"{WebFormsAspExpressionStartTag} {UnknownAspExpressionType}: {UnknownAspExpressionContent} {WebFormsNormalEndTag}";
            var expectedOutput = $"@({UnknownAspExpressionType}.{UnknownAspExpressionContent})";
            var actualOutput   = EmbeddedCodeReplacers.ReplaceAspExprs(inputText);

            Assert.AreEqual(expectedOutput, actualOutput);
        }
Ejemplo n.º 3
0
        public static string ConvertEmbeddedCode(string htmlString, string originalFilePath, ViewImportService viewImportService)
        {
            htmlString = EmbeddedCodeReplacers.ReplaceOneWayDataBinds(htmlString);
            htmlString = EmbeddedCodeReplacers.ReplaceRawExprs(htmlString);
            htmlString = EmbeddedCodeReplacers.ReplaceHTMLEncodedExprs(htmlString);
            htmlString = EmbeddedCodeReplacers.ReplaceAspExprs(htmlString);
            htmlString = EmbeddedCodeReplacers.ReplaceAspComments(htmlString);
            htmlString = EmbeddedCodeReplacers.ReplaceEmbeddedCodeBlocks(htmlString);

            return(htmlString);
        }