Skip to content

Commit

Permalink
Fix | SqlDataSourceEnumeratorTest correct ConditionalFact (dotnet#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 and kant2002 committed Jun 29, 2023
1 parent daa8bd9 commit da88013
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 da88013

Please sign in to comment.