예제 #1
0
        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"));
        }
예제 #2
0
        public void DecryptArgumentoNull()
        {
            string textoEntrada = null;
            var    cesarCypher  = new CesarCypher();

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

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

            Assert.Equal(textoDecifrado, textoEsperado);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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()));
        }
예제 #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"));
        }
예제 #11
0
        public void Should_Not_Accept_Special_Characteres_When_Decrypt()
        {
            var cypher = new CesarCypher();

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("><!@#*&%"));
        }
예제 #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"));
        }
예제 #13
0
        public void Should_Not_Accept_Argument_Out_Of_Range_When_Crypt()
        {
            var cypher = new CesarCypher();

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

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

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

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

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

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

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

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

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

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

            Assert.Throws <ArgumentOutOfRangeException>(() => cypher.Decrypt("âãàáêẽèéîĩìíôõòóûũùú"));
        }
예제 #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ç"));
        }
예제 #26
0
        public void Should_Ensure_Letter_Or_Number_When_Decrypt()
        {
            var cypher = new CesarCypher();

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

            Assert.Equal("d", cypher.Crypt("a"));
        }
예제 #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));
        }
예제 #30
0
        public void Ignore_Spaces_When_Decrypt()
        {
            var cypher = new CesarCypher();

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