public void RegexNegativTest() // Negativtest: Der Teststring sollte nicht formatiert werden { BeforeFormatHtml beforeFormatHtml = new BeforeFormatHtml(); string htmlString = @"<p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US""></span></p> <p class=""MsoNormal""><b><span lang=""FR"" style=""font-size:11.0pt;font-family:"Calibri",sans-serif"">De :</span></b><span lang=""FR"" style=""font-size:11.0pt;font-family:"Calibri",sans-serif"">"; string result = beforeFormatHtml.FormatHtmlString(htmlString); Assert.AreEqual(htmlString, result); // Das Resultat muss dem htmlString entsprechen, da es keine Änderungen geben sollte }
public void RegexTest() // Einzeiliger Teststring { BeforeFormatHtml beforeFormatHtml = new BeforeFormatHtml(); string htmlString = "<p class=\"MsoNormal\"><span style=\"font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D\"><o:p> </o:p></span></p>"; string formatted = "<p class=\"MsoNormal\"><span style=\"font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D\"></span></p>"; string result = beforeFormatHtml.FormatHtmlString(htmlString); Assert.AreEqual(formatted, result); // Der Kommentar sollte korrekt formatiert sein }
public void RegexMultipleLineTest() // Mehrzeiliger Teststring { BeforeFormatHtml beforeFormatHtml = new BeforeFormatHtml(); string htmlString = @"<p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D""><o:p> </o:p></span></p> <p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D""><o:p>TEST</o:p></span></p> <p class=""MsoNormal"">Should not delete</p> <p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D""><o:p> </o:p></span></p>"; string formatted = @"<p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D""></span></p> <p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"">TEST</span></p> <p class=""MsoNormal"">Should not delete</p> <p class=""MsoNormal""><span style=""font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D""></span></p>"; string result = beforeFormatHtml.FormatHtmlString(htmlString); Assert.AreEqual(formatted, result); // Der Kommentar sollte korrekt formatiert sein }