Exemple #1
0
        public void OnPostGetEncryptedText(string text, string key)
        {
            var folder = Path.Combine(webHostEnvironment.WebRootPath, "files");
            VigenereCipherHandler encoder = new VigenereCipherHandler(text, key);

            FormattedTextEn = encoder.EncodeText();
            FilePath        = Path.Combine(folder, GetIpValue() + "_" + "formattedText.txt");
            System.IO.File.WriteAllText(FilePath, FormattedTextEn);
        }
Exemple #2
0
        public void VigenereCipherHandlerIsNotNull()
        {
            // Arrange
            VigenereCipherHandler vigenereCipherHandler = new VigenereCipherHandler("", "");
            // Act
            string result = vigenereCipherHandler.DecodeText();

            // Assert
            Assert.NotNull(result);
        }
Exemple #3
0
        public void VigenereCipherHandlerEncode()
        {
            // Arrange
            VigenereCipherHandler vigenereCipherHandler = new VigenereCipherHandler("привет", "пока");
            // Act
            string result = vigenereCipherHandler.EncodeText();

            // Assert
            Assert.Equal("яяувфб", result);
        }
Exemple #4
0
        public void VigenereCipherHandlerDecode()
        {
            // Arrange
            VigenereCipherHandler vigenereCipherHandler = new VigenereCipherHandler("бщцфаирщри, бл ячъбиуъ щбюэсяёш гфуаа!!!", "скорпион");
            // Act
            string result = vigenereCipherHandler.DecodeText();

            // Assert
            Assert.Equal("поздравляю, ты получил исходный текст!!!", result);
        }