Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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));
        }