public void Should_Keep_Numbers_Out_When_Decrypt()
        {
            var cypher = new CesarCypher();

            //Assert.Equal("a1b2c3d4e5f6g7h8i9j0", cypher.Decrypt("d1e2f3g4h5i6j7k8l9m0"));
            Assert.Equal("the quick brown fox jumps over the lazy dog", cypher.Decrypt("wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj"));
        }
Example #2
0
        public void DecryptArgumentoNull()
        {
            string textoEntrada = null;
            var    cesarCypher  = new CesarCypher();

            var excecao = Assert.Throws <ArgumentNullException>(
                () => cesarCypher.Decrypt(textoEntrada)
                );
        }
Example #3
0
        public void DecryptTextoComAcento()
        {
            string textoEntrada = "Chão";
            var    cesarCypher  = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(
                () => cesarCypher.Decrypt(textoEntrada)
                );
        }
Example #4
0
        public void DecryptTextoVazio()
        {
            string textoEntrada   = "";
            string textoEsperado  = "";
            var    cesarCypher    = new CesarCypher();
            string textoDecifrado = cesarCypher.Decrypt(textoEntrada);

            Assert.Equal(textoDecifrado, textoEsperado);
        }
Example #5
0
        public void DecryptTextoComNumerosEspacos()
        {
            string textoEntrada  = "aWkh1 Txlfn2 Eurz3 Ira4 Mxpsv5 Ryhu6 Wkh7 Odcb8 Grj9 0";
            string textoEsperado = "xthe1 quick2 brow3 fox4 jumps5 over6 the7 lazy8 dog9 0";

            var    cesarCypher    = new CesarCypher();
            string textoDecifrado = cesarCypher.Decrypt(textoEntrada);

            Assert.Equal(textoDecifrado, textoEsperado);
        }
Example #6
0
        public void CryptTextoComNumerosEspacos()
        {
            string textoEntrada  = "The1 Quick2 Brow3 Fox4 Jumps5 Over6 The7 Lazy8 Dog9 0";
            string textoEsperado = "wkh1 txlfn2 eurz3 ira4 mxpsv5 ryhu6 wkh7 odcb8 grj9 0";

            var    cesarCypher  = new CesarCypher();
            string textoCifrado = cesarCypher.Crypt(textoEntrada);

            Assert.Equal(textoCifrado, textoEsperado);
        }
Example #7
0
        public void Should_Not_Accept_Argument_Out_Range_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("ç"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("é"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("&"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("*"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("%"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt(";"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("ª"));
            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("º"));
        }
        public void Should_Keep_Numbers_Out_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("a1b2c3d4e5f6g7h8i9j0", cypher.Decrypt("d1e2f3g4h5i6j7k8l9m0"));
        }
        public void Should_Be_Lower_When_DeCrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("a1b2c3d4e5f6g7h8i9j0", cypher.Decrypt("d1e2f3g4h5i6j7k8l9m0".ToUpper()));
        }
Example #10
0
        public void Should_Decrypt_Message()
        {
            var cypher = new CesarCypher();

            Assert.Equal("the quick brown fox jumps over the lazy dog", cypher.Decrypt("wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj"));
        }
Example #11
0
        public void Should_Not_Accept_Special_Characteres_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("><!@#*&%"));
        }
Example #12
0
        public void Example_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj", cypher.Crypt("the quick brown fox jumps over the lazy dog"));
        }
Example #13
0
        public void Should_Not_Accept_Argument_Out_Of_Range_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Crypt("é palhaçada"));
        }
Example #14
0
        public void Teste_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("teste 123 com espaco xyz", cypher.Decrypt("whvwh 123 frp hvsdfr abc"));
        }
Example #15
0
        public void Should_Retun_Numbers_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("xyz", cypher.Decrypt("ABC"));
        }
Example #16
0
        public void Empty_Message_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal(string.Empty, cypher.Crypt(string.Empty));
        }
Example #17
0
        public void Overflow_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("zabc", cypher.Crypt("wxyz"));
        }
Example #18
0
        public void Teste_Crypt_Maiuscula()
        {
            var cypher = new CesarCypher();

            Assert.Equal("whvwh frp hvsdfr abc", cypher.Crypt("Teste COM espaco XYZ"));
        }
Example #19
0
        public void Underflow_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("wxyz", cypher.Decrypt("zabc"));
        }
Example #20
0
        public void Teste_Decrypt_Maiuscula()
        {
            var cypher = new CesarCypher();

            Assert.Equal("teste com espaco xyz", cypher.Decrypt("Whvwh FRP hvsdfr ABC"));
        }
Example #21
0
        public void Should_Return_Only_Blank_Spaces_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("     ", cypher.Decrypt("     "));
        }
Example #22
0
        public void Teste_Decrypt_Branco()
        {
            var cypher = new CesarCypher();

            Assert.Equal(" ", cypher.Decrypt(" "));
        }
Example #23
0
        public void Should_Not_Accept_Accentuation_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("âãàáêẽèéîĩìíôõòóûũùú"));
        }
Example #24
0
        public void Teste_Crypt_Erro_Caracter_Invalido()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Crypt("Teste COM ç"));
        }
        public void Should_Not_Accept_Special_Char_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Crypt("a0ç"));
        }
Example #26
0
        public void Should_Ensure_Letter_Or_Number_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("é palhaçada"));
        }
        public void Should_Keep_Numbers_Out_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("d", cypher.Crypt("a"));
        }
Example #28
0
        public void Ignore_UpperCase_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("def", cypher.Crypt("ABC"));
        }
        public void Should_Not_Accept_Null_When_Crypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentNullException>(() => cypher.Crypt(null));
        }
Example #30
0
        public void Ignore_Spaces_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Equal("a b c", cypher.Decrypt("d e f"));
        }