Beispiel #1
0
        public void X()
        {
            var fileText  = "First line<br /><br />Second line<br />";
            var converter = new UnicodeFileToHtmlTextConverter("C:\\Users\\EllaJennings\\Documents\\CPD\\github-projects\\katas\\Racing-Car-Katas\\CSharp\\UnicodeFileToHtmlTextConverter.Tests\\TextFile1.txt");
            var result    = converter.ConvertToHtml();

            Assert.That(result, Is.EqualTo(fileText));
        }
        public void GivenAnAmpersand_WhenConvertToHtml_ThenReturnEquivalentHtmlEntity()
        {
            createFile(filePath, "&");
            htmlTextConverter = new UnicodeFileToHtmlTextConverter(filePath, new HtmlEncoderImpl());

            string htmlText = htmlTextConverter.ConvertToHtml();

            Assert.AreEqual("&amp;<br />", htmlText);
        }
        public void GivenASingleQuotationMark_WhenConvertToHtml_ThenReturnEquivalentHtmlEntity()
        {
            createFile(filePath, "\'");
            htmlTextConverter = new UnicodeFileToHtmlTextConverter(filePath, new HtmlEncoderImpl());

            string htmlText = htmlTextConverter.ConvertToHtml();

            Assert.AreEqual("&quot;<br />", htmlText);
        }
        public void GivenAnEmptyUnicodeFile_WhenConvertToHtml_ThenReturnEmptyString()
        {
            createFile(filePath, string.Empty);
            htmlTextConverter = new UnicodeFileToHtmlTextConverter(filePath, new HtmlEncoderImpl());

            string htmlText = htmlTextConverter.ConvertToHtml();

            Assert.AreEqual(string.Empty, htmlText);
        }
        public void GivenAUnicodeFile_WhenConvertToHtml_ThenReturnEquivalentHtmlEntities()
        {
            createFile(filePath, "<html>\"ab\"" + "\r\n" +
                       "&\'e\'");
            htmlTextConverter = new UnicodeFileToHtmlTextConverter(filePath, new HtmlEncoderImpl());

            string htmlText = htmlTextConverter.ConvertToHtml();

            Assert.AreEqual("&lt;html&gt;&quot;ab&quot;<br />&amp;&quot;e&quot;<br />", htmlText);
        }
Beispiel #6
0
        public void FileNameIsSetCorrectlyWhenHtmlConverterInitialised()
        {
            UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter("foobar.txt");

            Assert.AreEqual("foobar.txt", converter.GetFilename());
        }
        public void Foobar()
        {
            UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter("foobar.txt");

            Assert.Equal("fixme", converter.GetFilename());
        }