You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using System.Data.SqlServerCe;
|
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Storage;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Storage.Internal;
|
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Internal;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.EntityFrameworkCore.Tests
|
|
|
|
|
|
{
|
|
|
|
|
|
public class SqlCeDataStoreConnectionTest
|
|
|
|
|
|
{
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
public void Creates_SQL_ServerCe_connection_string()
|
|
|
|
|
|
{
|
|
|
|
|
|
using (var connection = new SqlCeDatabaseConnection(CreateDependencies()))
|
|
|
|
|
|
{
|
|
|
|
|
|
Assert.IsType<SqlCeConnection>(connection.DbConnection);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static RelationalConnectionDependencies CreateDependencies(DbContextOptions options = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
options = options
|
|
|
|
|
|
?? new DbContextOptionsBuilder()
|
|
|
|
|
|
.UseSqlCe(@"Data Source=C:\data\EF7SQLCE.sdf;")
|
|
|
|
|
|
.Options;
|
|
|
|
|
|
|
|
|
|
|
|
return new RelationalConnectionDependencies(
|
|
|
|
|
|
options,
|
|
|
|
|
|
new DiagnosticsLogger<DbLoggerCategory.Database.Transaction>(
|
|
|
|
|
|
new LoggerFactory(),
|
|
|
|
|
|
new LoggingOptions(),
|
|
|
|
|
|
new DiagnosticListener("FakeDiagnosticListener")),
|
|
|
|
|
|
new DiagnosticsLogger<DbLoggerCategory.Database.Connection>(
|
|
|
|
|
|
new LoggerFactory(),
|
|
|
|
|
|
new LoggingOptions(),
|
|
|
|
|
|
new DiagnosticListener("FakeDiagnosticListener")),
|
|
|
|
|
|
new NamedConnectionStringResolver(options));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|