Beispiel #1
0
        public void CodeAndDecodeTheText_GivenText_ShouldDecodeCorrectly()
        {
            //Arrange
            var input    = "a";
            var keyValue = "2";
            //Act
            var output = Decoder.CodeAndDecodeTheText(input, keyValue, false);

            //Assert
            Assert.AreEqual("Ź", output);
        }
Beispiel #2
0
        public void CodeAndDecodeTheText_GivenText_ShouldCodeCorrectly()
        {
            //Arrange
            var input    = "ab cd";
            var keyValue = "2";
            //Act
            var output = Decoder.CodeAndDecodeTheText(input, keyValue, true);

            //Assert
            Assert.AreEqual(output, "BĆDĘ");
        }
Beispiel #3
0
        public void CodeAndDecodeTheText_GivenText_ShouldCodeAndDecodeCorrectly(string input, int keyValue)
        {
            //Arrange

            //Act
            var stringKey = keyValue.ToString();
            var output    = Decoder.CodeAndDecodeTheText(input, stringKey, true);
            var decoded   = Decoder.CodeAndDecodeTheText(output, stringKey, false);

            //Assert
            Assert.AreEqual(decoded, input.Replace(" ", String.Empty).ToUpper());
        }
Beispiel #4
0
        public void CodeAndDecodeTheText_GivenText_ShouldCodeAndDecodeCorrectlyx1000000()
        {
            //Arrange
            Random generator = new Random();

            for (int i = 0; i < 1000000; i++)
            {
                var stringKey = generator.Next(-100, 100).ToString();
                var input     = RandomString(generator.Next(1, 250));
                //Act
                var output  = Decoder.CodeAndDecodeTheText(input, stringKey, true);
                var decoded = Decoder.CodeAndDecodeTheText(output, stringKey, false);
                //Assert
                Assert.AreEqual(decoded, input.Replace(" ", String.Empty).ToUpper());
            }
        }