public void GetServerType_returns_OnPremises_for_real_local_test_database() { using (var context = new RealDatabase()) { context.Database.CreateIfNotExists(); var connection = context.Database.Connection; connection.Open(); Assert.Equal(ServerType.OnPremises, SqlVersionUtils.GetServerType(connection)); connection.Close(); } }
public void GetServerType_returns_correct_ServerType_for_real_test_database() { using (var context = new RealDatabase()) { context.Database.CreateIfNotExists(); var connection = context.Database.Connection; connection.Open(); var expectedServerType = DatabaseTestHelpers.IsSqlAzure(connection.ConnectionString) ? ServerType.Cloud : ServerType.OnPremises; Assert.Equal(expectedServerType, SqlVersionUtils.GetServerType(connection)); connection.Close(); } }
public void GetServerType_dispatches_commands_to_interceptors() { var connection = CreateConnectionForAzureQuery(5).Object; var interceptor = new TestReaderInterceptor(); Interception.AddInterceptor(interceptor); try { SqlVersionUtils.GetServerType(connection); } finally { Interception.RemoveInterceptor(interceptor); } Assert.Equal(1, interceptor.Commands.Count); Assert.Same(connection.CreateCommand(), interceptor.Commands.Single()); }
public void GetServerType_returns_OnPremises_for_server_with_EngineEdtion_not_equal_to_five() { Assert.Equal(ServerType.OnPremises, SqlVersionUtils.GetServerType(CreateConnectionForAzureQuery(1).Object)); }
public void GetServerType_returns_Cloud_for_server_with_EngineEdtion_equal_to_five() { Assert.Equal(ServerType.Cloud, SqlVersionUtils.GetServerType(CreateConnectionForAzureQuery(5).Object)); }