Example #1
0
            public void ReturnsExpectedResult()
            {
                HtmlGenerator generator = new HtmlGenerator();

                WordPuzzles.Puzzle.InnerAnacrosticPuzzle puzzle = new WordPuzzles.Puzzle.InnerAnacrosticPuzzle {
                    PhraseAsString = "max peel"
                };
                puzzle.AddWordToClues("example");
                puzzle.PlaceLetters();
                generator.Puzzle = puzzle;

                const string EXPECTED_HTML =
                    @"<tr>
	<td>
	Clue for example:
	</td>

	<td>
	<input type=""text"" size=""1"" maxlength=""1"" id=""letter0"" onFocus=""colorMeAndMyMatch(0,'yellow');"" onBlur=""colorMeAndMyMatch(0,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter1"" onFocus=""colorMeAndMyMatch(1,'yellow');"" onBlur=""colorMeAndMyMatch(1,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter2"" onFocus=""colorMeAndMyMatch(2,'yellow');"" onBlur=""colorMeAndMyMatch(2,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter3"" onFocus=""colorMeAndMyMatch(3,'yellow');"" onBlur=""colorMeAndMyMatch(3,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter4"" onFocus=""colorMeAndMyMatch(4,'yellow');"" onBlur=""colorMeAndMyMatch(4,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter5"" onFocus=""colorMeAndMyMatch(5,'yellow');"" onBlur=""colorMeAndMyMatch(5,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter6"" onFocus=""colorMeAndMyMatch(6,'yellow');"" onBlur=""colorMeAndMyMatch(6,'white');""
	/>
	</td>
</tr>
";

                Assert.AreEqual(EXPECTED_HTML, generator.CreateTableRowForWord(puzzle.Clues[0], 0));
            }
Example #2
0
            public void WithCustomClue_ReturnsExpectedString()
            {
                WordPuzzles.Puzzle.InnerAnacrosticPuzzle puzzle = new WordPuzzles.Puzzle.InnerAnacrosticPuzzle {
                    PhraseAsString = "i'm x."
                };
                puzzle.AddWordToClues("mix");
                puzzle.Clues[0].CustomizedClue = "Customized Clue";
                puzzle.PlaceLetters();

                HtmlGenerator htmlGenerator = new HtmlGenerator {
                    Puzzle = puzzle
                };
                const string EXPECTED_HTML =
                    @"<tr>
	<td>
	Customized Clue:
	</td>

	<td>
	<input type=""text"" size=""1"" maxlength=""1"" id=""letter0"" onFocus=""colorMeAndMyMatch(0,'yellow');"" onBlur=""colorMeAndMyMatch(0,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter1"" onFocus=""colorMeAndMyMatch(1,'yellow');"" onBlur=""colorMeAndMyMatch(1,'white');""
	/><input type=""text"" size=""1"" maxlength=""1"" id=""letter2"" onFocus=""colorMeAndMyMatch(2,'yellow');"" onBlur=""colorMeAndMyMatch(2,'white');""
	/>
	</td>
</tr>
";

                Assert.AreEqual(EXPECTED_HTML, htmlGenerator.CreateTableRowForWord(puzzle.Clues[0], 0));
            }