Skip to content

Commit

Permalink
EF Core 7.0 supported
Browse files Browse the repository at this point in the history
  • Loading branch information
romantitov committed Nov 21, 2022
1 parent 2c30611 commit b36838e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<RepositoryUrl>https://github.com/romantitov/MockQueryable</RepositoryUrl>
<PackageTags>Mock EntityFrameworkCore Queryable mock EF UnitTests EntityFrameworkCore</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes> Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 </PackageReleaseNotes>
<Version>6.0.1</Version>
<AssemblyVersion>6.0.0.1</AssemblyVersion>
<FileVersion>6.0.0.1</FileVersion>
<PackageReleaseNotes>Supported EntityFrameworkCore 7.0.0 </PackageReleaseNotes>
<Version>7.0.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.0.0.0</FileVersion>
<Company></Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<RepositoryUrl>https://github.com/romantitov/MockQueryable</RepositoryUrl>
<PackageTags>Mock EntityFrameworkCore Queryable mock EF UnitTests EntityFrameworkCore</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes> Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 </PackageReleaseNotes>
<Version>6.0.1</Version>
<AssemblyVersion>6.0.0.1</AssemblyVersion>
<FileVersion>6.0.0.1</FileVersion>
<PackageReleaseNotes>Supported EntityFrameworkCore 7.0.0 </PackageReleaseNotes>
<Version>7.0.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.0.0.0</FileVersion>
<Company></Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
Expand All @@ -37,7 +37,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<RepositoryUrl>https://github.com/romantitov/MockQueryable</RepositoryUrl>
<PackageTags>Mock EntityFrameworkCore Queryable mock EF EFCore UnitTests FakeItEasy</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes> Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 </PackageReleaseNotes>
<Version>6.0.1</Version>
<AssemblyVersion>6.0.0.1</AssemblyVersion>
<FileVersion>6.0.0.1</FileVersion>
<PackageReleaseNotes>Supported EntityFrameworkCore 7.0.0 </PackageReleaseNotes>
<Version>7.0.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.0.0.0</FileVersion>
<Company></Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
Expand Down
8 changes: 4 additions & 4 deletions src/MockQueryable/MockQueryable.Moq/MockQueryable.Moq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<RepositoryUrl>https://github.com/romantitov/MockQueryable</RepositoryUrl>
<PackageTags>Mock EntityFrameworkCore Queryable mock EF EFCore UnitTests EntityFrameworkCore Moq</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes> Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 </PackageReleaseNotes>
<Version>6.0.1</Version>
<AssemblyVersion>6.0.0.1</AssemblyVersion>
<FileVersion>6.0.0.1</FileVersion>
<PackageReleaseNotes>Supported EntityFrameworkCore 7.0.0 </PackageReleaseNotes>
<Version>7.0.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.0.0.0</FileVersion>
<Company></Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<RepositoryUrl>https://github.com/romantitov/MockQueryable</RepositoryUrl>
<PackageTags>Mock EntityFrameworkCore Queryable mock EF EFCore UnitTests EntityFrameworkCore NSubstitute</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageReleaseNotes> Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 </PackageReleaseNotes>
<Version>6.0.1</Version>
<AssemblyVersion>6.0.0.1</AssemblyVersion>
<FileVersion>6.0.0.1</FileVersion>
<PackageReleaseNotes>Supported EntityFrameworkCore 7.0.0 </PackageReleaseNotes>
<Version>7.0.0</Version>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.0.0.0</FileVersion>
<Company></Company>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>logo.png</PackageIcon>
Expand Down
8 changes: 6 additions & 2 deletions src/MockQueryable/MockQueryable.Sample/MyServiceMoqTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
using MockQueryable.Moq;
using Moq;
using NUnit.Framework;
Expand Down Expand Up @@ -113,9 +116,10 @@ public async Task DbSetCreateUser(string firstName, string lastName, DateTime da
//arrange
var userEntities = new List<UserEntity>();
var mock = userEntities.AsQueryable().BuildMockDbSet();

mock.Setup(set => set.AddAsync(It.IsAny<UserEntity>(), It.IsAny<CancellationToken>()))
.Callback((UserEntity entity, CancellationToken _) => userEntities.Add(entity));
var userRepository = new TestDbSetRepository(mock.Object);
.Callback((UserEntity entity, CancellationToken _) => userEntities.Add(entity));
var userRepository = new TestDbSetRepository(mock.Object);
var service = new MyService(userRepository);
//act
await service.CreateUserIfNotExist(firstName, lastName, dateOfBirth);
Expand Down

0 comments on commit b36838e

Please sign in to comment.