Skip to content

Commit

Permalink
Fix tests for EFCore 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PanyushkinD authored and PanyushkinD committed Mar 23, 2018
1 parent f1e5167 commit 9f982ff
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ public void ShouldBeExpandedInExpressionTree()

var query = context.Users
.AsVisitable(new SpecificationExpander())
.Select(u => u.Posts.Where(postSpec));
.Select(u => u.Posts.Where(postSpec).ToList());

var expected = context.Users
.Select(u => u.Posts.Where(p => !p.IsDeleted));
.Select(u => u.Posts.Where(p => !p.IsDeleted).ToList());

Assert.AreEqual(expected.ToString(), query.ToString());

Assert.That.MethodCallsAreMatch(expected.Expression, query.Expression);

Assert.IsNotNull(query.Single());
// assert that we find one user with one post
query.Single().Single();
}
}

Expand Down Expand Up @@ -146,16 +147,23 @@ public void ShouldSupportConditionalLogicInExpressionTree()

var query = context.Users
.AsVisitable(new SpecificationExpander())
.Select(u => u.Posts.Where(new PostByContentSpec(content) || new PostByContentSpec(content)));
.Select(u => u.Posts
.Where(new PostByContentSpec(content)
|| new PostByContentSpec(content))
.ToList());

var expected = context.Users
.Select(u => u.Posts.Where(p => p.Content.Contains(content) || p.Content.Contains(content)));
.Select(u => u.Posts
.Where(p => p.Content.Contains(content)
|| p.Content.Contains(content))
.ToList());

Assert.AreEqual(expected.ToString(), query.ToString());

Assert.That.MethodCallsAreMatch(expected.Expression, query.Expression);

Assert.IsNotNull(query.Single());
// assert that we find one user with one post
query.Single().Single();
}
}

Expand Down
2 changes: 1 addition & 1 deletion EFCore.CommonTools.Tests/TestDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Threading.Tasks;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Diagnostics;

namespace EntityFrameworkCore.CommonTools.Tests
{
Expand Down
2 changes: 1 addition & 1 deletion EFCore.CommonTools/EntityFrameworkCore.CommonTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<RepositoryUrl>https://github.com/gnaeus/EntityFramework.CommonTools.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>EFCore v2; Improve AuditableEntities API</PackageReleaseNotes>
<PackageReleaseNotes>EFCore 2.0; Improve AuditableEntities API</PackageReleaseNotes>
<Copyright>Copyright © Dmitry Panyushkin 2017</Copyright>
<PackageTags>EF EFCore EntityFrameworkCore EntityFramework Entity Framework ChangeTracking Change Tracking Auditing Audit TransactionLog Transaction Log ComplexType Complex Type JSON</PackageTags>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<licenseUrl>https://github.com/gnaeus/EntityFramework.CommonTools/blob/master/LICENSE</licenseUrl>
<iconUrl>https://raw.githubusercontent.com/gnaeus/EntityFramework.CommonTools/master/icon.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes>EntityFramework v6.2; Improve AuditableEntities API</releaseNotes>
<releaseNotes>EntityFramework 6.2; Improve AuditableEntities API</releaseNotes>
<copyright>Copyright © Dmitry Panyushkin 2017</copyright>
<tags>EF EntityFramework Entity Framework ChangeTracking Change Tracking Auditing Audit TransactionLog Transaction Log ComplexType Complex Type JSON</tags>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,8 +818,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.0.0] - 2018-03-23
### Added
- EFCore v2 support
- EntityFramework v6.2 support
- EFCore 2.0 support
- EntityFramework 6.2 support

### Changed
- `ICreationAuditable.CreatorUser` renamed to `CreatorUserId`
Expand Down

0 comments on commit 9f982ff

Please sign in to comment.