public void WhenFileConvertedThenHtmlIsOk() { var converter = new UnicodeFileToHtmTextConverter("../../Data/UnicodeToHtml.txt"); var html = converter.ConvertToHtml(); Assert.AreEqual("This is a sample<br />unicode file<br />With é à &<br />", html); }
public void WhenInvalidFileThenThrowException() { var converter = new UnicodeFileToHtmTextConverter("../../Data/UnexistingFile.txt"); var exceptionRaised = false; try { var html = converter.ConvertToHtml(); } catch (FileNotFoundException ex) { exceptionRaised = true; } Assert.IsTrue(exceptionRaised); }
public void TestMethod() { MockRepository mocks = new MockRepository(); TextReader reader = mocks.StrictMock<TextReader>(); Expect.Call(reader.ReadLine()).Return("hello привет"); Expect.Call(reader.ReadLine()).Return(null); mocks.ReplayAll(); UnicodeFileToHtmTextConverter unicode = new UnicodeFileToHtmTextConverter(reader); Assert.AreEqual("hello привет</b>",unicode.ConvertToHtml()); mocks.VerifyAll(); }
public void foobar() { UnicodeFileToHtmTextConverter converter = new UnicodeFileToHtmTextConverter("foobar.txt"); Assert.AreEqual("fixme", converter.GetFilename()); }
public void WhenInitializedThenInstanceSetedUp() { var converter = new UnicodeFileToHtmTextConverter("../../Data/UnicodeToHtml.txt"); Assert.IsNotNull(converter); }