2.2-servicing
bubibubi 8 years ago
parent 848defc96f
commit f5c4ffdce1

@ -34,7 +34,7 @@ namespace System.Data.Jet.JetStoreSchemaDefinition
RegexOptions.IgnoreCase);
_regExExtractFilenameFromConnectionString = new Regex(
@"provider=.*;\s*data\s+source\s*=\s*(?<filename>.*)\s*;??.*$",
@"provider=.*;\s*data\s+source\s*=\s*(?<filename>[^;]*)\s*;?.*$",
RegexOptions.IgnoreCase);

@ -0,0 +1,45 @@
using System;
using System.IO;
using EntityFrameworkCore.Jet;
using Microsoft.EntityFrameworkCore;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EFCore.Jet.Integration.Test
{
[TestClass]
public class DatabaseHandlingTest
{
[TestMethod]
public void EnsureDeleted_Github21()
{
File.Delete(DatabaseHandlingTestContext.GetDbPath());
using (var ctx = new DatabaseHandlingTestContext())
{
ctx.Database.EnsureCreated();
}
Assert.IsTrue(File.Exists(DatabaseHandlingTestContext.GetDbPath()), "The db has not been created");
using (var ctx = new DatabaseHandlingTestContext())
{
ctx.Database.EnsureDeleted();
}
Assert.IsFalse(File.Exists(DatabaseHandlingTestContext.GetDbPath()), "The db has not been deleted");
}
public class DatabaseHandlingTestContext : DbContext
{
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseJet($"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={GetDbPath()};");
}
public static string GetDbPath()
{
return Path.Combine(Helpers.GetTestDirectory(), "db.mdb");
}
}
}
}

@ -202,6 +202,7 @@
<Compile Include="BooleanMaterializationTest2.cs" />
<Compile Include="BooleanMaterializationTest1.cs" />
<Compile Include="CanonicalFunctionsTest2.cs" />
<Compile Include="DatabaseHandlingTest.cs" />
<Compile Include="DefaultValueTest.cs" />
<Compile Include="DmlBaseTest.cs" />
<Compile Include="DmlSqlTest.cs" />

Loading…
Cancel
Save