public void TestNoIndexOutOfRange() { var predictor = new TextPredictor(); var results = predictor.Predict(435566893, _testWords.ToList()); Assert.IsTrue(true); }
public void TestNoMatch() { var predictor = new TextPredictor(); var results = predictor.Predict(777, _testWords.ToList()); Assert.IsTrue(results.Count == 0); }
public void TestfooIs366() { var predictor = new TextPredictor(); var results = predictor.Predict(366, _testWords.ToList()); Assert.IsTrue(results.Contains("foo")); Assert.IsTrue(results.Count == 1); }
public void Test2633IsCodeAndBode() { var predictor = new TextPredictor(); var results = predictor.Predict(2633, _testWords.ToList()); Assert.IsTrue(results.Contains("Code")); Assert.IsTrue(results.Contains("Bode")); Assert.IsTrue(results.Count == 2); }
public JsonResult Predict(string text) { int code; if (!int.TryParse(text, out code)) { return(Json(null, JsonRequestBehavior.AllowGet)); } var predictor = new TextPredictor(); var data = new Data(); return(Json(predictor.Predict(code, data.GetAllWords().ToList()), JsonRequestBehavior.AllowGet)); }