public IActionResult Post([FromBody] TextParsingInput input, SortType sortType) { try { var result = TextSortingService.SortText(input.Text, sortType); //await persister.SaveRequest(new PersistedRequestResponse(input, result)); return(Ok(result)); } catch (Exception e) { return(StatusCode(500, e)); } }
public void TestAlphabetizingSortOfSentences() { var sorted = TextSortingService.SortText("This is a sample text to sort. And another one would be this.", SortType.Alphabetical); Assert.Equal("And another one would be this. This is a sample text to sort.", sorted); }
public void TestAlphabetizingSortOfWords() { var sorted = TextSortingService.SortText("This is a sample text to sort", SortType.Alphabetical); Assert.Equal("a is sample sort text This to", sorted); }