public void ByteDestinationLargerThanSourceDecodeRequestLineReturnsCorrenctLenght() { var source = Encoding.UTF8.GetBytes("/a%20b".ToCharArray()); var length = UrlDecoder.DecodeRequestLine(source.AsSpan(), new byte[source.Length + 10], false); Assert.Equal(4, length); }
public void StringDestinationLargerThanSourceDecodeRequestLineReturnsCorrenctLenght() { var source = "/a%20b".ToCharArray(); var length = UrlDecoder.DecodeRequestLine(source.AsSpan(), new char[source.Length + 10]); Assert.Equal(4, length); }
public void ByteDecodeRequestLine(byte[] input, byte[] expected) { var destination = new byte[input.Length]; int length = UrlDecoder.DecodeRequestLine(input.AsSpan(), destination.AsSpan(), false); Assert.True(destination.AsSpan(0, length).SequenceEqual(expected.AsSpan())); }
public void StringDecodeRequestLine(string input, string expected) { var destination = new char[input.Length]; int length = UrlDecoder.DecodeRequestLine(input.AsSpan(), destination.AsSpan()); Assert.True(destination.AsSpan(0, length).SequenceEqual(expected.AsSpan())); }
public void ByteDestinationShorterThanSourceDecodeRequestLineThrows() { var source = new byte[2]; Assert.Throws <ArgumentException>(() => UrlDecoder.DecodeRequestLine(source.AsSpan(), source.AsSpan(0, 1), false)); }
public void StringDestinationShorterThanSourceDecodeRequestLineThrows() { var source = new char[2]; Assert.Throws <ArgumentException>(() => UrlDecoder.DecodeRequestLine(source.AsSpan(), source.AsSpan(0, 1))); }