Skip to content

Commit

Permalink
Fix | SqlDataSourceEnumeratorTest correct ConditionalFact (#2058)
Browse files Browse the repository at this point in the history
Skip test if SQLBrowser is missing or not running.
  • Loading branch information
David-Engel authored Jun 12, 2023
1 parent 244a340 commit 2b31810
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,17 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests
#endif
public class SqlDataSourceEnumeratorTest
{
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.IsNotUsingManagedSNIOnWindows))]
private static bool IsEnvironmentAvailable()
{
ServiceController[] services = ServiceController.GetServices(Environment.MachineName);
ServiceController service = services.FirstOrDefault(s => s.ServiceName == "SQLBrowser");

return DataTestUtility.IsNotUsingManagedSNIOnWindows() &&
service != null &&
service.Status == ServiceControllerStatus.Running;
}

[ConditionalFact(nameof(IsEnvironmentAvailable))]
[PlatformSpecific(TestPlatforms.Windows)]
public void SqlDataSourceEnumerator_NativeSNI()
{
Expand Down

0 comments on commit 2b31810

Please sign in to comment.