Exemplo n.º 1
0
        public ActionResult KeySearch(HttpPostedFileBase file, string text)
        {
            text = GetNeededText(file, text);
            if (text == null)
            {
                return(RedirectToAction("Index"));
            }
            string fileName = file?.FileName ?? "Untitled.txt";

            ViewBag.Keys     = CaesarEncoder.GetBestKeys(text);
            ViewBag.FileName = fileName;

            return(View("KeySearch"));
        }
Exemplo n.º 2
0
 public void KeySearching(string input, int expectedResult)
 {
     CaesarEncoder.Key[] keys = CaesarEncoder.GetBestKeys(input);
     Assert.AreEqual(expectedResult, keys[0].Shift);
 }