From b36838e3833e27054a285a34d46781e01afffa54 Mon Sep 17 00:00:00 2001 From: Roman Titov Date: Mon, 21 Nov 2022 11:42:49 +0100 Subject: [PATCH] EF Core 7.0 supported --- .../MockQueryable.Core/MockQueryable.Core.csproj | 8 ++++---- .../MockQueryable.EntityFrameworkCore.csproj | 10 +++++----- .../MockQueryable.FakeItEasy.csproj | 8 ++++---- .../MockQueryable.Moq/MockQueryable.Moq.csproj | 8 ++++---- .../MockQueryable.NSubstitute.csproj | 8 ++++---- .../MockQueryable.Sample/MyServiceMoqTests.cs | 8 ++++++-- 6 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/MockQueryable/MockQueryable.Core/MockQueryable.Core.csproj b/src/MockQueryable/MockQueryable.Core/MockQueryable.Core.csproj index b79b422..154d005 100644 --- a/src/MockQueryable/MockQueryable.Core/MockQueryable.Core.csproj +++ b/src/MockQueryable/MockQueryable.Core/MockQueryable.Core.csproj @@ -13,10 +13,10 @@ https://github.com/romantitov/MockQueryable Mock EntityFrameworkCore Queryable mock EF UnitTests EntityFrameworkCore true - Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 - 6.0.1 - 6.0.0.1 - 6.0.0.1 + Supported EntityFrameworkCore 7.0.0 + 7.0.0 + 7.0.0.0 + 7.0.0.0 LICENSE logo.png diff --git a/src/MockQueryable/MockQueryable.EntityFrameworkCore/MockQueryable.EntityFrameworkCore.csproj b/src/MockQueryable/MockQueryable.EntityFrameworkCore/MockQueryable.EntityFrameworkCore.csproj index 5545067..097aab3 100644 --- a/src/MockQueryable/MockQueryable.EntityFrameworkCore/MockQueryable.EntityFrameworkCore.csproj +++ b/src/MockQueryable/MockQueryable.EntityFrameworkCore/MockQueryable.EntityFrameworkCore.csproj @@ -14,10 +14,10 @@ https://github.com/romantitov/MockQueryable Mock EntityFrameworkCore Queryable mock EF UnitTests EntityFrameworkCore true - Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 - 6.0.1 - 6.0.0.1 - 6.0.0.1 + Supported EntityFrameworkCore 7.0.0 + 7.0.0 + 7.0.0.0 + 7.0.0.0 LICENSE logo.png @@ -37,7 +37,7 @@ - + diff --git a/src/MockQueryable/MockQueryable.FakeItEasy/MockQueryable.FakeItEasy.csproj b/src/MockQueryable/MockQueryable.FakeItEasy/MockQueryable.FakeItEasy.csproj index d7aa29a..12e9df9 100644 --- a/src/MockQueryable/MockQueryable.FakeItEasy/MockQueryable.FakeItEasy.csproj +++ b/src/MockQueryable/MockQueryable.FakeItEasy/MockQueryable.FakeItEasy.csproj @@ -13,10 +13,10 @@ https://github.com/romantitov/MockQueryable Mock EntityFrameworkCore Queryable mock EF EFCore UnitTests FakeItEasy true - Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 - 6.0.1 - 6.0.0.1 - 6.0.0.1 + Supported EntityFrameworkCore 7.0.0 + 7.0.0 + 7.0.0.0 + 7.0.0.0 LICENSE logo.png diff --git a/src/MockQueryable/MockQueryable.Moq/MockQueryable.Moq.csproj b/src/MockQueryable/MockQueryable.Moq/MockQueryable.Moq.csproj index 6ba3620..54fbcd6 100644 --- a/src/MockQueryable/MockQueryable.Moq/MockQueryable.Moq.csproj +++ b/src/MockQueryable/MockQueryable.Moq/MockQueryable.Moq.csproj @@ -13,10 +13,10 @@ https://github.com/romantitov/MockQueryable Mock EntityFrameworkCore Queryable mock EF EFCore UnitTests EntityFrameworkCore Moq true - Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 - 6.0.1 - 6.0.0.1 - 6.0.0.1 + Supported EntityFrameworkCore 7.0.0 + 7.0.0 + 7.0.0.0 + 7.0.0.0 LICENSE logo.png diff --git a/src/MockQueryable/MockQueryable.NSubstitute/MockQueryable.NSubstitute.csproj b/src/MockQueryable/MockQueryable.NSubstitute/MockQueryable.NSubstitute.csproj index 89df584..124be16 100644 --- a/src/MockQueryable/MockQueryable.NSubstitute/MockQueryable.NSubstitute.csproj +++ b/src/MockQueryable/MockQueryable.NSubstitute/MockQueryable.NSubstitute.csproj @@ -13,10 +13,10 @@ https://github.com/romantitov/MockQueryable Mock EntityFrameworkCore Queryable mock EF EFCore UnitTests EntityFrameworkCore NSubstitute true - Fixed issue #58 ToListAsync() returns empty list after package update to 6.0.0 - 6.0.1 - 6.0.0.1 - 6.0.0.1 + Supported EntityFrameworkCore 7.0.0 + 7.0.0 + 7.0.0.0 + 7.0.0.0 LICENSE logo.png diff --git a/src/MockQueryable/MockQueryable.Sample/MyServiceMoqTests.cs b/src/MockQueryable/MockQueryable.Sample/MyServiceMoqTests.cs index fd74dfa..5fa418b 100644 --- a/src/MockQueryable/MockQueryable.Sample/MyServiceMoqTests.cs +++ b/src/MockQueryable/MockQueryable.Sample/MyServiceMoqTests.cs @@ -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; @@ -113,9 +116,10 @@ public async Task DbSetCreateUser(string firstName, string lastName, DateTime da //arrange var userEntities = new List(); var mock = userEntities.AsQueryable().BuildMockDbSet(); + mock.Setup(set => set.AddAsync(It.IsAny(), It.IsAny())) - .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);