示例#1
0
        public void TestWordCount(string text, int expectedCount)
        {
            var stats = TextStatisticsService.CalculateStatistics(text);

            output.WriteLine(JsonConvert.SerializeObject(stats));
            Assert.Equal(expectedCount, stats.WordCount);
        }
示例#2
0
 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));
     }
 }