|
17 | 17 | #if BASELINE |
18 | 18 | using GetValueWhenNullException = System.Data.SqlTypes.SqlNullValueException; |
19 | 19 | using GetGuidWhenNullException = MySql.Data.MySqlClient.MySqlException; |
| 20 | +using GetBytesWhenNullException = System.NullReferenceException; |
20 | 21 | #else |
21 | 22 | using GetValueWhenNullException = System.InvalidCastException; |
22 | 23 | using GetGuidWhenNullException = System.InvalidCastException; |
| 24 | +using GetBytesWhenNullException = System.InvalidCastException; |
23 | 25 | #endif |
24 | 26 |
|
25 | 27 | namespace SideBySide |
@@ -824,13 +826,20 @@ public void QueryBlob(string column, int padLength) |
824 | 826 | if (data.Length < padLength) |
825 | 827 | Array.Resize(ref data, padLength); |
826 | 828 |
|
827 | | -#if BASELINE |
828 | | - DoQuery<NullReferenceException>("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, GetBytes); |
829 | | - // https://bugs.mysql.com/bug.php?id=93374 |
830 | | - // DoQuery<NullReferenceException>("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, GetStreamBytes); |
831 | | -#else |
832 | | - DoQuery<InvalidCastException>("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, GetBytes); |
833 | | - DoQuery<InvalidCastException>("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, GetStreamBytes); |
| 829 | + DoQuery<GetBytesWhenNullException>("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, GetBytes); |
| 830 | +#if !BASELINE // https://bugs.mysql.com/bug.php?id=93374 |
| 831 | + DoQuery("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, GetStreamBytes); |
| 832 | + DoQuery("blobs", "`" + column + "`", "BLOB", new object[] { null, data }, reader => reader.GetStream(0), matchesDefaultType: false, assertEqual: (e, a) => |
| 833 | + { |
| 834 | + using (var stream = (Stream) a) |
| 835 | + { |
| 836 | + Assert.True(stream.CanRead); |
| 837 | + Assert.False(stream.CanWrite); |
| 838 | + var bytes = new byte[stream.Length]; |
| 839 | + Assert.Equal(bytes.Length, stream.Read(bytes, 0, bytes.Length)); |
| 840 | + Assert.Equal(e, bytes); |
| 841 | + } |
| 842 | + }, getFieldValueType: typeof(Stream)); |
834 | 843 | #endif |
835 | 844 | } |
836 | 845 |
|
|
0 commit comments