public void SolvePuzzle(string stream, int expectedScore) { var puzzleService = new PuzzleService(); int score = puzzleService.Solve(stream); Assert.True(score == expectedScore); }
public void WhenPuzzleIsValid_ShouldReturnCorrectSolution() { mockLogger = new Mock <ILogger <PuzzleService> >(); logger = mockLogger.Object; sut = new PuzzleService(logger); Int32[][] actualResult = sut.GetSolvedSudoku6x6(testData.GetValidPuzzle0()); Int32[][] expectedResult = testData.GetValidPuzzle0Solution(); Assert.IsTrue(actualResult.AreEqual(expectedResult)); }
public void WhenPuzzleIsInvalid_ShouldReturnNoSolution() { mockLogger = new Mock <ILogger <PuzzleService> >(); logger = mockLogger.Object; sut = new PuzzleService(logger); var actualResult = sut.GetSolvedSudoku6x6(testData.GetInvalidPuzzle()); var expectedResult = (int[][])null; Assert.AreEqual(expectedResult, actualResult); }
public override void OnEnterStatus() { if (!isInit) { RhythmLibrary.Init(); PuzzleService.Init(); } OpenUI <CountDownWindow>(); }
public List <string> GetWords() { try { PuzzleService service = new PuzzleService(); return(service.GetWords(ConfigurationManagerHelper.GetKey("WordsPath"))); } catch (Exception) { return(new List <string>()); } }
public DTOSearchResult SearchWord([FromBody] DTOSearch word) { try { PuzzleService service = new PuzzleService(); return(service.SearchWord(word)); } catch (Exception) { return(new DTOSearchResult() { Breakdown = new List <LettersModel>(), Word = string.Empty }); } }
public void InvalidStream_GarbageEndExpected(string stream) { var puzzleService = new PuzzleService(); try { int score = puzzleService.Solve(stream); Assert.False(true, "No error was detected."); } catch (InvalidStreamException ex) when(ex.Message == InvalidStreamMessage.MissingGarbageEnding) { Assert.True(true); } catch (Exception ex) { Assert.False(true, String.Format("Incorrect exception thrown: {0}", ex.Message)); } }
static void CreateAnswer() { PuzzleService.Reset(); //去掉已出的所有句子 for (int i = 0; i <= s_currentLine; i++) { PuzzleService.RemoveSentence(currentPoemData.m_content[i]); } PuzzleService.RemoveSentence(GetCurrentContent()); s_correctIndex = GetRandomIndex(true); //正确答案 m_questions[s_correctIndex] = GetCurrentContent(); //错误答案 m_questions[GetRandomIndex(false)] = PuzzleService.GetErrorAnswer(GetCurrentContent()); m_questions[GetRandomIndex(false)] = PuzzleService.GetErrorAnswer(GetCurrentContent()); m_questions[GetRandomIndex(false)] = PuzzleService.GetErrorAnswer(GetCurrentContent()); if (LanguageManager.s_currentLanguage == SystemLanguage.ChineseTraditional) { m_questions[0] = ZhConverter.Convert(m_questions[0], ZhConverter.To.Traditional); m_questions[1] = ZhConverter.Convert(m_questions[1], ZhConverter.To.Traditional); m_questions[2] = ZhConverter.Convert(m_questions[2], ZhConverter.To.Traditional); m_questions[3] = ZhConverter.Convert(m_questions[3], ZhConverter.To.Traditional); } if (s_GameModel == GameModel.Arcade && HP == 0) { return; } GlobalEvent.DispatchEvent(GameEventEnum.QuestionChange); }
/// <summary> /// Note: This is a DI constructor, but the BS.TestSuite requires a no param constructor, /// so services are being defined there /// </summary> public PuzzleServiceTest(PuzzleService puzzleService) { this.puzzleService = puzzleService; }
public PuzzleServiceTest() { this.puzzleService = new PuzzleService(); }