public void NIGHT_FindsExpectedLines() { WordHexagon hexagon = new WordHexagon(); hexagon.SetHorizontalLineAtIndex(2, "night"); List <string> results = hexagon.FindDiagonalLineAtIndex(2); Assert.AreEqual("aegis", results[0]); }
public void KNIGHT_FindsExpectedLines() { WordHexagon hexagon = new WordHexagon(4); hexagon.SetHorizontalLineAtIndex(2, "knight"); List <string> results = hexagon.FindDiagonalLineAtIndex(1); //should start with K Assert.AreEqual("kabob", results[0]); foreach (var result in results) { StringAssert.StartsWith("k", result, $"Expected {result} to start with k."); } }
public void ExcludesSingleVersionsOfWords() { WordHexagon hexagon = new WordHexagon(4); hexagon.SetHorizontalLineAtIndex(1, "rocks"); var candidates = hexagon.FindDiagonalLineAtIndex(0); bool foundRock = false; foreach (string candidate in candidates) { if (candidate == "rock") { foundRock = true; } } Assert.IsFalse(foundRock, "Should not have found ROCK because ROCKS is already in the puzzle."); }