Skip to content

Commit 9f0c7a1

Browse files
SNOW-2004510: Fix build warnings (#1124)
1 parent 2128b93 commit 9f0c7a1

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

Snowflake.Data.Tests/IntegrationTests/SFBindTestIT.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#nullable enable
1+
#nullable enable
22

33
using System;
44
using System.Data;
@@ -200,8 +200,8 @@ public void TestBindNullValue(object nullValue)
200200
}
201201
}
202202

203-
private static IEnumerable<object> NullTestCases() =>
204-
new object[] { DBNull.Value, null };
203+
private static IEnumerable<object?> NullTestCases() =>
204+
new object?[] { DBNull.Value, null };
205205

206206
[Test]
207207
public void TestBindValue()

Snowflake.Data.Tests/IntegrationTests/SFDbDataReaderIT.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Linq;
33
using System.Data.Common;
44
using System.Data;
@@ -1048,15 +1048,17 @@ public void TestGetStream()
10481048
{
10491049
byte[] col1ToBytes = Encoding.UTF8.GetBytes(testChars);
10501050
byte[] buf = new byte[col1ToBytes.Length];
1051-
stream.Read(buf, 0, col1ToBytes.Length);
1051+
var readBytes = stream.Read(buf, 0, col1ToBytes.Length);
1052+
Assert.AreEqual(col1ToBytes.Length, readBytes);
10521053
Assert.IsTrue(-1 == stream.ReadByte()); // No more data
10531054
Assert.IsTrue(col1ToBytes.SequenceEqual(buf));
10541055
}
10551056

10561057
using (var stream = reader.GetStream(1))
10571058
{
10581059
byte[] buf = new byte[testBytes.Length];
1059-
stream.Read(buf, 0, testBytes.Length);
1060+
var readBytes = stream.Read(buf, 0, testBytes.Length);
1061+
Assert.AreEqual(testBytes.Length, readBytes);
10601062
Assert.IsTrue(-1 == stream.ReadByte()); // No more data
10611063
Assert.IsTrue(testBytes.SequenceEqual(buf));
10621064
}
@@ -1065,7 +1067,8 @@ public void TestGetStream()
10651067
{
10661068
byte[] col3ToBytes = Encoding.UTF8.GetBytes(testDouble.ToString());
10671069
byte[] buf = new byte[col3ToBytes.Length];
1068-
stream.Read(buf, 0, col3ToBytes.Length);
1070+
var readBytes = stream.Read(buf, 0, col3ToBytes.Length);
1071+
Assert.AreEqual(col3ToBytes.Length, readBytes);
10691072
Assert.IsTrue(-1 == stream.ReadByte()); // No more data
10701073
Assert.IsTrue(col3ToBytes.SequenceEqual(buf));
10711074
}

Snowflake.Data.Tests/IntegrationTests/SFPutGetTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,8 @@ private static string[] splitLines(Stream stream)
794794
{
795795
var bytes = new byte[stream.Length];
796796
stream.Position = 0;
797-
stream.Read(bytes, 0, (int) stream.Length);
797+
var readBytes = stream.Read(bytes, 0, (int) stream.Length);
798+
Assert.AreEqual(stream.Length, readBytes);
798799
return Encoding.UTF8.GetString(bytes).Split('\n');
799800
}
800801

Snowflake.Data.Tests/UnitTests/ConcatenatedStreamTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Snowflake.Data.Tests.Util;
1+
using Snowflake.Data.Tests.Util;
22
using NUnit.Framework;
33
using System;
44
using System.IO;
@@ -109,7 +109,7 @@ public void TestReadMoreBytesThanBufferSize()
109109
try
110110
{
111111
// An ArgumentException is thrown when 4 bytes is read from a buffer of size 3
112-
_concatStream.Read(buffer, 0, 4);
112+
var readBytes = _concatStream.Read(buffer, 0, 4);
113113
Assert.Fail("An ArgumentException should've been thrown");
114114
}
115115
catch (Exception ex)

0 commit comments

Comments
 (0)