diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ConnectionServiceTests.cs b/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ConnectionServiceTests.cs
index 80904b96..3bc7b14c 100644
--- a/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ConnectionServiceTests.cs
+++ b/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ConnectionServiceTests.cs
@@ -891,5 +891,74 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
}
});
}
+
+ ///
+ /// Test that the connection complete notification type can be created.
+ ///
+ [Fact]
+ public void TestConnectionCompleteNotificationIsCreated()
+ {
+ Assert.NotNull(ConnectionCompleteNotification.Type);
+ }
+
+ ///
+ /// Test that the connection summary comparer creates a hash code correctly
+ ///
+ [Theory]
+ [InlineData(true, null, null ,null)]
+ [InlineData(false, null, null, null)]
+ [InlineData(false, null, null, "sa")]
+ [InlineData(false, null, "test", null)]
+ [InlineData(false, null, "test", "sa")]
+ [InlineData(false, "server", null, null)]
+ [InlineData(false, "server", null, "sa")]
+ [InlineData(false, "server", "test", null)]
+ [InlineData(false, "server", "test", "sa")]
+ public void TestConnectionSummaryComparerHashCode(bool objectNull, string serverName, string databaseName, string userName)
+ {
+ // Given a connection summary and comparer object
+ ConnectionSummary summary = null;
+ if (!objectNull)
+ {
+ summary = new ConnectionSummary()
+ {
+ ServerName = serverName,
+ DatabaseName = databaseName,
+ UserName = userName
+ };
+ }
+ ConnectionSummaryComparer comparer = new ConnectionSummaryComparer();
+
+ // If I compute a hash code
+ int hashCode = comparer.GetHashCode(summary);
+ if (summary == null || (serverName == null && databaseName == null && userName == null))
+ {
+ // Then I expect it to be 31 for a null summary
+ Assert.Equal(31, hashCode);
+ }
+ else
+ {
+ // And not 31 otherwise
+ Assert.NotEqual(31, hashCode);
+ }
+ }
+
+ [Fact]
+ public void ConnectParamsAreInvalidIfConnectionIsNull()
+ {
+ // Given connection parameters where the connection property is null
+ ConnectParams parameters = new ConnectParams();
+ parameters.OwnerUri = "my/sql/file.sql";
+ parameters.Connection = null;
+
+ string errorMessage;
+
+ // If I check if the parameters are valid
+ Assert.False(parameters.IsValid(out errorMessage));
+
+ // Then I expect an error message
+ Assert.NotNull(errorMessage);
+ Assert.NotEmpty(errorMessage);
+ }
}
}
diff --git a/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ReliableConnectionTests.cs b/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ReliableConnectionTests.cs
index 4a1a42e2..95194a55 100644
--- a/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ReliableConnectionTests.cs
+++ b/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ReliableConnectionTests.cs
@@ -720,6 +720,22 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
Assert.True(SqlSchemaModelErrorCodes.IsInterpretationErrorCode(Interpretation.InterpretationBaseCode+ 1));
Assert.True(SqlSchemaModelErrorCodes.IsStatementFilterError(StatementFilter.StatementFilterBaseCode + 1));
}
+
+ [Fact]
+ public void RetryCallbackEventArgsTest()
+ {
+ var exception = new Exception();
+ var timespan = TimeSpan.FromMinutes(1);
+
+ // Given a RetryCallbackEventArgs object with certain parameters
+ var args = new RetryCallbackEventArgs(5, exception, timespan);
+
+ // If I check the properties on the object
+ // Then I expect the values to be the same as the values I passed into the constructor
+ Assert.Equal(5, args.RetryCount);
+ Assert.Equal(exception, args.Exception);
+ Assert.Equal(timespan, args.Delay);
+ }
}
}