Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mtanneryd-marketmath committed Jun 19, 2023
2 parents 71f351f + 98345e7 commit 0d53dfe
Show file tree
Hide file tree
Showing 20 changed files with 157 additions and 95 deletions.
23 changes: 7 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,13 @@ bin/
obj/
packages/
.vs/
/Tanneryd.BulkOperations.EF6/.vs
/Tanneryd.BulkOperations.EF6/packages
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/bin
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/obj
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NET47.Tests/bin
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NET47.Tests/obj
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NetCore.Tests/bin
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NetCore.Tests/obj
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/nuget_api.txt
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.nuspec
.idea/
*.nupkg
*.user
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.Tests/EF/StebbingContext.cs
Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NetStd/nuget_api.txt
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NET47.ModelFirst.Tests/bin/Debug
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NET47.ModelFirst.Tests/obj
Tanneryd.BulkOperations.EF6/.idea/
Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.NET47.ModelFirst.Tests/bin/
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/nuget_api.txt
/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6/Tanneryd.BulkOperations.EF6.nuspec





Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
<LangVersion>Latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<LangVersion>Latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tanneryd.BulkOperations.EF6.Model;
using Tanneryd.BulkOperations.EF6.NET47.Tests.Models.DM.Blog;
using Tanneryd.BulkOperations.EF6.NET47.Tests.Models.DM.Prices;
using Tanneryd.BulkOperations.EF6.NET47.Tests.Models.EF;

namespace Tanneryd.BulkOperations.EF6.NET47.Tests.Tests.Update
Expand All @@ -39,6 +41,75 @@ public void CleanUp()
CleanupUnitTestContext();
}

[TestMethod]
public void ModifiedEntitiesWithNullableColumnShouldBeUpdated()
{
using var db1 = new UnitTestContext();
using var db2 = new UnitTestContext();
var initialPrices = new Price[]
{
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "A",
Value = 1m
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "B",
Value = null
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "C",
Value = null
},
};
db1.Prices.AddRange(initialPrices);
db1.SaveChanges();

var updatedPrices = new Price[]
{
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "A",
Value = 1.50m
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "B",
Value = null
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "C",
Value = 2.0m
},
};

db1.BulkUpdateAll(new BulkUpdateRequest
{
Entities = updatedPrices,
KeyPropertyNames = new[] { "Date", "Name" },
UpdatedColumnNames = new[] { "Value" },
});
var prices = db2.Prices.OrderBy(p => p.Name).ToArray();
Assert.AreEqual("A", prices[0].Name);
Assert.AreEqual(new DateTime(2023, 5, 29), prices[0].Date);
Assert.AreEqual(1.50m, prices[0].Value);
Assert.AreEqual("B", prices[1].Name);
Assert.AreEqual(new DateTime(2023, 5, 29), prices[1].Date);
Assert.AreEqual(null, prices[1].Value);
Assert.AreEqual("C", prices[2].Name);
Assert.AreEqual(new DateTime(2023, 5, 29), prices[2].Date);
Assert.AreEqual(2.0m, prices[2].Value);
}

[TestMethod]
public void ModifiedEntityShouldBeUpdated()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedAllSources>True</EmbedAllSources>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
//optionsBuilder.UseSqlServer(@"data source=.\SQLEXPRESS;initial catalog=Tanneryd.BulkOperations.EFCore.Tests.Models.EF.UnitTestContext;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True");
optionsBuilder.UseSqlServer(@"data source=(localdb)\MSSQLLocalDB;initial catalog=Tanneryd.BulkOperations.EFCore.Tests.Models.EF.UnitTestContext;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True");
optionsBuilder.UseSqlServer(@"data source=.\SQLEXPRESS;initial catalog=Tanneryd.BulkOperations.EFCore.Tests.Models.EF.UnitTestContext;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True;TrustServerCertificate=true");
//optionsBuilder.UseSqlServer(@"data source=(localdb)\MSSQLLocalDB;initial catalog=Tanneryd.BulkOperations.EFCore.Tests.Models.EF.UnitTestContext;persist security info=True;Integrated Security=SSPI;MultipleActiveResultSets=True;TrustServerCertificate=true");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -37,6 +38,75 @@ public void CleanUp()
CleanupUnitTestContext();
}

[TestMethod]
public void ModifiedEntitiesWithNullableColumnShouldBeUpdated()
{
using var db1 = new UnitTestContext();
using var db2 = new UnitTestContext();
var initialPrices = new Price[]
{
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "A",
Value = 1m
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "B",
Value = null
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "C",
Value = null
},
};
db1.Prices.AddRange(initialPrices);
db1.SaveChanges();

var updatedPrices = new Price[]
{
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "A",
Value = 1.50m
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "B",
Value = null
},
new Price
{
Date = new DateTime(2023, 5, 29),
Name = "C",
Value = 2.0m
},
};

db1.BulkUpdateAll(new BulkUpdateRequest
{
Entities = updatedPrices,
KeyPropertyNames = new[] { "Date", "Name" },
UpdatedColumnNames = new[] { "Value" },
});
var prices = db2.Prices.OrderBy(p=>p.Name).ToArray();
Assert.AreEqual("A",prices[0].Name );
Assert.AreEqual(new DateTime(2023, 5, 29), prices[0].Date);
Assert.AreEqual(1.50m, prices[0].Value);
Assert.AreEqual("B",prices[1].Name);
Assert.AreEqual(new DateTime(2023, 5, 29), prices[1].Date);
Assert.AreEqual(null, prices[1].Value);
Assert.AreEqual("C", prices[2].Name);
Assert.AreEqual(new DateTime(2023, 5, 29), prices[2].Date);
Assert.AreEqual(2.0m, prices[2].Value);
}

[TestMethod]
public void ModifiedEntityShouldBeUpdated()
{
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedAllSources>True</EmbedAllSources>
<LangVersion>Latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="netmw_feed" value="https://pkgs.dev.azure.com/marketmath/NetMW/_packaging/netmw_feed/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

0 comments on commit 0d53dfe

Please sign in to comment.