Esempio 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"));
        }
Esempio n. 2
0
 public void KeySearching(string input, int expectedResult)
 {
     CaesarEncoder.Key[] keys = CaesarEncoder.GetBestKeys(input);
     Assert.AreEqual(expectedResult, keys[0].Shift);
 }