Esempio n. 1
0
        public void Should_Encode_And_Decode_String()
        {
            // Arrange
            var xe      = new XorEncoder(0x13);
            var message = "encrypt_and_decrypt";

            // Act
            var encodedMessage = xe.Encode(message);
            var decodedMessage = xe.Decode(encodedMessage);

            // Assert
            Assert.True(string.Equals(decodedMessage, message),
                        $"Expected: {message}; Actual: {decodedMessage}");
        }
Esempio n. 2
0
        public void Should_Decode_String()
        {
            // Arrange
            var xe       = new XorEncoder(0x89);
            var message  = "/ez6/db6/fvg5+4=";
            var expected = "test_string";

            // Act
            var decodedMessage = xe.Decode(message);

            // Assert
            Assert.True(string.Equals(decodedMessage, expected),
                        $"Expected: {expected}; Actual: {decodedMessage}");
        }