public void StringCompare_NoMatches() { string subtext = "test"; string text = "TES"; StringCompare compare = new StringCompare(subtext, text); string result = compare.Indexes; Assert.IsTrue(String.IsNullOrEmpty(result)); }
public void StringCompare_MatchAtTheBeginning() { System.Diagnostics.Debugger.Launch(); string subtext = "test"; string text = "TESt"; StringCompare compare = new StringCompare(subtext, text); string result = compare.Indexes; Assert.AreEqual("0", result); }
public void StringCompare_MultipleMatches() { System.Diagnostics.Debugger.Launch(); string subtext = "test"; string text = "aTEStTestTest"; StringCompare compare = new StringCompare(subtext, text); string result = compare.Indexes; Assert.AreEqual("1,5,9", result); }
// POST api/evaluatetext public CompareResult Post([FromBody]CompareRequest request) { if (!ModelState.IsValid) { //logg results return null; } StringCompare sc = new StringCompare(request.subtext, request.text); CompareResult result = new CompareResult(){ Text = request.text, Subtext = request.subtext, result = sc.Indexes }; return result; }