Added test case for issue 32

2.2-servicing v2.2.0
bubibubi 7 years ago
parent d8773e19c1
commit 42c4aabdfd

@ -19,4 +19,4 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion("2.2.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyInformationalVersion("2.2.0-preview5")]
[assembly: AssemblyInformationalVersion("2.2.0")]

@ -251,6 +251,10 @@
<Compile Include="Model76_FullCreate\SqlCeTest.cs" />
<Compile Include="Model77_DateTimeOffset\SqlCeTest.cs" />
<Compile Include="Model78_MigrationUpdate\Test.cs" />
<Compile Include="Model79_CantSaveDecimalValue\Context.cs" />
<Compile Include="Model79_CantSaveDecimalValue\JetTest.cs" />
<Compile Include="Model79_CantSaveDecimalValue\Table.cs" />
<Compile Include="Model79_CantSaveDecimalValue\Test.cs" />
<Compile Include="Model_MainTests\Context.cs" />
<Compile Include="Model_MainTests\SqlServerTest.cs" />
<Compile Include="Model_MainTests\SqlCeTest.cs" />

@ -0,0 +1,18 @@
using System.Data.Common;
using Microsoft.EntityFrameworkCore;
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
{
public class Context : DbContext
{
public Context(DbConnection connection) :
base(TestBase<Context>.GetContextOptions(connection))
{
TestBase<Context>.TryCreateTables(this);
}
public DbSet<Table> Table { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using System.Data.Common;
using System.Data.Jet;
using System.Data.OleDb;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
{
[TestClass]
public class Model79_CantSaveDecimalValue : Test
{
protected override DbConnection GetConnection()
{
// ReSharper disable once CollectionNeverUpdated.Local
OleDbConnectionStringBuilder oleDbConnectionStringBuilder = new OleDbConnectionStringBuilder();
//oleDbConnectionStringBuilder.Provider = "Microsoft.Jet.OLEDB.4.0";
//oleDbConnectionStringBuilder.DataSource = @".\Empty.mdb";
oleDbConnectionStringBuilder.Provider = "Microsoft.ACE.OLEDB.15.0";
oleDbConnectionStringBuilder.DataSource = Helpers.GetTestDirectory() + "\\BrandNewDatabase.accdb";
return new JetConnection(oleDbConnectionStringBuilder.ToString());
}
}
}

@ -0,0 +1,8 @@
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
{
public class Table
{
public int Id { get; set; }
public decimal DecimalValue { get; set; }
}
}

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
{
public abstract class Test
{
protected abstract DbConnection GetConnection();
[TestMethod]
public void Model79_CantSaveDecimalValue()
{
using (DbConnection connection = GetConnection())
{
using (var context = new Context(connection))
{
var t = new Table();
context.Table.Add(t);
t.DecimalValue = 1.23M;
context.SaveChanges();
}
}
}
}
}
Loading…
Cancel
Save