public PuzzleTests() { testPuzzle = new EnigmaPuzzle(); testSettings = new AppSettings { Round1 = "MAKE THE RAIN STOP", Round2 = "THE SPARROW FLIES AT NIGHT", Round3 = "A BALOO IS A BEAR", Round4 = "SNOW FALLS AT DAWN" }; postRequestCorrect = new PuzzleRequest { Round = 1, Answer = "MAKE THE RAIN STOP" }; }
public ActionResult <PuzzleResponse> Post(PuzzleRequest request) { PuzzleResponse response = new PuzzleResponse { IsCorrect = false }; String compareTo = ""; switch (request.Round) { case 1: compareTo = _appSettings.Round1; break; case 2: compareTo = _appSettings.Round2; break; case 3: compareTo = _appSettings.Round3; break; case 4: compareTo = _appSettings.Round4; break; } response.ReturnMsg = StringUtilities.StringComparePercentange(compareTo.ToLower(), request.Answer.ToLower()); if (compareTo.ToUpper() == request.Answer.ToUpper()) { response.IsCorrect = true; } return(Ok(response)); }