Skip to content

Commit 42c4aab

Browse files
committed
Added test case for issue 32
1 parent d8773e1 commit 42c4aab

File tree

6 files changed

+90
-1
lines changed

6 files changed

+90
-1
lines changed

build/GlobalAssemblyInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919

2020
[assembly: AssemblyVersion("2.2.0")]
2121
[assembly: AssemblyFileVersion("2.2.0.0")]
22-
[assembly: AssemblyInformationalVersion("2.2.0-preview5")]
22+
[assembly: AssemblyInformationalVersion("2.2.0")]

test/EFCore.Jet.Integration.Test/EFCore.Jet.Integration.Test.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@
251251
<Compile Include="Model76_FullCreate\SqlCeTest.cs" />
252252
<Compile Include="Model77_DateTimeOffset\SqlCeTest.cs" />
253253
<Compile Include="Model78_MigrationUpdate\Test.cs" />
254+
<Compile Include="Model79_CantSaveDecimalValue\Context.cs" />
255+
<Compile Include="Model79_CantSaveDecimalValue\JetTest.cs" />
256+
<Compile Include="Model79_CantSaveDecimalValue\Table.cs" />
257+
<Compile Include="Model79_CantSaveDecimalValue\Test.cs" />
254258
<Compile Include="Model_MainTests\Context.cs" />
255259
<Compile Include="Model_MainTests\SqlServerTest.cs" />
256260
<Compile Include="Model_MainTests\SqlCeTest.cs" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Data.Common;
2+
using Microsoft.EntityFrameworkCore;
3+
4+
5+
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
6+
{
7+
public class Context : DbContext
8+
{
9+
10+
public Context(DbConnection connection) :
11+
base(TestBase<Context>.GetContextOptions(connection))
12+
{
13+
TestBase<Context>.TryCreateTables(this);
14+
}
15+
16+
public DbSet<Table> Table { get; set; }
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Data.Common;
3+
using System.Data.Jet;
4+
using System.Data.OleDb;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting;
6+
7+
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
8+
{
9+
[TestClass]
10+
public class Model79_CantSaveDecimalValue : Test
11+
{
12+
protected override DbConnection GetConnection()
13+
{
14+
// ReSharper disable once CollectionNeverUpdated.Local
15+
16+
OleDbConnectionStringBuilder oleDbConnectionStringBuilder = new OleDbConnectionStringBuilder();
17+
//oleDbConnectionStringBuilder.Provider = "Microsoft.Jet.OLEDB.4.0";
18+
//oleDbConnectionStringBuilder.DataSource = @".\Empty.mdb";
19+
oleDbConnectionStringBuilder.Provider = "Microsoft.ACE.OLEDB.15.0";
20+
oleDbConnectionStringBuilder.DataSource = Helpers.GetTestDirectory() + "\\BrandNewDatabase.accdb";
21+
return new JetConnection(oleDbConnectionStringBuilder.ToString());
22+
}
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
2+
{
3+
public class Table
4+
{
5+
public int Id { get; set; }
6+
public decimal DecimalValue { get; set; }
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Data.Common;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Microsoft.VisualStudio.TestTools.UnitTesting;
8+
9+
namespace EFCore.Jet.Integration.Test.Model79_CantSaveDecimalValue
10+
{
11+
public abstract class Test
12+
{
13+
14+
protected abstract DbConnection GetConnection();
15+
16+
17+
[TestMethod]
18+
public void Model79_CantSaveDecimalValue()
19+
{
20+
21+
using (DbConnection connection = GetConnection())
22+
{
23+
using (var context = new Context(connection))
24+
{
25+
var t = new Table();
26+
context.Table.Add(t);
27+
t.DecimalValue = 1.23M;
28+
context.SaveChanges();
29+
}
30+
}
31+
32+
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)