Exemplo n.º 1
0
        public void TryEncode_SmallerOutput_Fails(Base16 encoder)
        {
            var input  = new byte[4];
            var output = new char[0];

            Assert.IsFalse(encoder.TryEncode(input, output, out int numCharsWritten));
            Assert.AreEqual(0, numCharsWritten);
        }
Exemplo n.º 2
0
        public void TryEncode_SmallerOutput_Fails(Base16 encoder)
        {
            var input  = new byte[4];
            var output = new char[0];

            Assert.That(encoder.TryEncode(input, output, out int numCharsWritten), Is.False);
            Assert.That(numCharsWritten, Is.EqualTo(0));
        }
Exemplo n.º 3
0
        public void TryEncode_RegularInput_Succeeds(Base16 encoder, byte[] input, string expectedOutput)
        {
            var output = new char[input.Length * 2];

            Assert.IsTrue(encoder.TryEncode(input, output, out int numCharsWritten));
            Assert.AreEqual(output.Length, numCharsWritten);
            Assert.AreEqual(expectedOutput, new string(output));
        }
Exemplo n.º 4
0
        public void TryEncode_RegularInput_Succeeds(Base16 encoder, byte[] input, string expectedOutput)
        {
            var output = new char[input.Length * 2];

            Assert.That(encoder.TryEncode(input, output, out int numCharsWritten), Is.True);
            Assert.That(numCharsWritten, Is.EqualTo(output.Length));
            Assert.That(new string(output), Is.EqualTo(expectedOutput));
        }