-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new class for converter testing created
- Loading branch information
Showing
3 changed files
with
46 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
|
||
namespace Mark | ||
{ | ||
[TestFixture] | ||
class Converter_should | ||
{ | ||
[Test] | ||
public void throw_exception_if_no_such_file() | ||
{ | ||
Assert.Throws<FileNotFoundException>(() => Converter.ConvertFile("no_such_file.txt")); | ||
} | ||
|
||
[Test] | ||
public void create_file_with_html_extension() | ||
{ | ||
Converter.ConvertFile("sample.txt"); | ||
Assert.True(File.Exists("sample.html")); | ||
} | ||
|
||
[Test] | ||
public void convert_empty_file_into_file_with_html_tag() | ||
{ | ||
Converter.ConvertFile("empty.txt"); | ||
var result = new StreamReader("empty.html").ReadToEnd().Split(Converter.LineEndings, StringSplitOptions.RemoveEmptyEntries); | ||
var expected = new StreamReader("emptyResult.txt").ReadToEnd().Split(Converter.LineEndings, StringSplitOptions.RemoveEmptyEntries); | ||
Assert.AreEqual(expected, result); | ||
} | ||
|
||
[Test] | ||
public void add_p_tags_around_paragraphs() | ||
{ | ||
string text = "This\nis\nfirst paragraph\n \nThis is\nsecond\n"; | ||
string result = Converter.ConvertString(text); | ||
Assert.AreEqual("<html>\n<p>\nThis is first paragraph\n</p>\n<p>\nThis is second\n</p>\n</html>\n", result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters