mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 17:23:27 -05:00
Add tests to improve code coverage (#187)
* DbColumn and ReliableConnection tests * More retry connection tests * More tests * Fix broken peek definition integration tests * Fix test bug * Add a couple batch tests * Add some more tests * More tests for code coverage. * Validation and Diagnostic tests * A few more tests * A few mote test changes. * Update file path tests to run on Windows only
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#if LIVE_CONNECTION_TESTS
|
||||
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution.DataStorage;
|
||||
@@ -60,8 +61,13 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution.DataStorage
|
||||
reader.Read();
|
||||
Assert.False(storageReader.IsDBNull(0));
|
||||
|
||||
Assert.NotNull(storageReader.GetValue(0));
|
||||
|
||||
string shortName = storageReader.GetCharsWithMaxCapacity(0, 2);
|
||||
Assert.True(shortName.Length == 2);
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => storageReader.GetBytesWithMaxCapacity(0, 0));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => storageReader.GetCharsWithMaxCapacity(0, 0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,10 +94,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution.DataStorage
|
||||
[Fact]
|
||||
public void StringWriterWithMaxCapacityTest()
|
||||
{
|
||||
var writer = new StorageDataReader.StringWriterWithMaxCapacity(null, 100);
|
||||
var writer = new StorageDataReader.StringWriterWithMaxCapacity(null, 4);
|
||||
string output = "...";
|
||||
writer.Write(output);
|
||||
Assert.True(writer.ToString().Equals(output));
|
||||
writer.Write('.');
|
||||
Assert.True(writer.ToString().Equals(output + '.'));
|
||||
writer.Write(output);
|
||||
writer.Write('.');
|
||||
Assert.True(writer.ToString().Equals(output + '.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user