Ejemplo n.º 1
0
        public void EncodedSpan_is_empty___0()
        {
            var sut       = new Base64Encoder();
            var emptySpan = Array.Empty <T>().AsSpan();

            int actual = sut.GetDecodedLengthImpl <T>(emptySpan);

            Assert.AreEqual(0, actual);
        }
Ejemplo n.º 2
0
        public void EncodedSpan_is_empty___0()
        {
            var sut       = new Base64Encoder();
            var emptySpan = ReadOnlySpan <T> .Empty;

            int actual = sut.GetDecodedLengthImpl <T>(emptySpan);

            Assert.AreEqual(0, actual);
        }
Ejemplo n.º 3
0
        public void Issue_32_EncodedLength_is_lt_4___throws_ArgumentOutOfRange(int encodedLength)
        {
            T a = Unsafe.As <char, T>(ref Unsafe.AsRef('='));

            T[] encoded = Enumerable.Repeat(a, encodedLength).ToArray();

            var sut = new Base64Encoder();

            Exception exception = Assert.Catch(() => sut.GetDecodedLengthImpl <T>(encoded));

            Assert.Multiple(() =>
            {
                Assert.IsInstanceOf <ArgumentOutOfRangeException>(exception);
                string msg = $"The 'encodedLength' is outside the allowed range by the base64 standard. It must be >= 4.";
                StringAssert.StartsWith(msg, exception.Message);
            });
        }