public void TestWordCount(string text, int expectedCount) { var stats = TextStatisticsService.CalculateStatistics(text); output.WriteLine(JsonConvert.SerializeObject(stats)); Assert.Equal(expectedCount, stats.WordCount); }
public IActionResult Post([FromBody] TextParsingInput input) { try { var result = TextStatisticsService.CalculateStatistics(input.Text); //await persister.SaveRequest(new PersistedRequestResponse(input, result)); return(Ok(result)); } catch (Exception e) { return(StatusCode(500, e)); } }