How is it right to test the passer?
-
I'm writing a wig-text passer, a text that generates html-text. Thus, certain sets of symbols should be transformed into certain html theories. For example,
{{background:текст @color:red}}
transformed into<span style="background-color:red;">набегов</span>
The different tags are quite large and theoretically combined, and may lead to unforeseen behaviour that would be avoided. In other words, the flow of password mistakes to each other can work correctly. Such mistakes flow regularly and the more different strategies the more possible combinations and errors. I'd like to test and find such mistakes at the test stage. But I don't really know how to test this passer properly and how to write that test. You can try to write some "etal" html that should be produced when applying a sparsing to some wiki marking and with which to check the result. But this option seems a little inconclusive. Tell me if anyone knows how that's how it's gonna be right to test this same passer and how do they even test them?
-
Start with simple modular tests. Start writing something like:
[TestFixture] public class WikiParserTest { private WikiParser parser;
[SetUp] public void setUp() { this.parser = new WikiParser(ParsingRules.Instance); } [Test] public void background_parsing_test() { string wikiText = "{{background:текст @color:red}}"; string expectedHtml = "<span style="background-color: red;">текст</span>"; Assert.AreEqual(expectedHtml, this.parser.Parse(wikiText); }
}