diff --git a/tests/EdFi.Security.DataAccess.UnitTests/EdFi.Security.DataAccess.UnitTests.csproj b/tests/EdFi.Security.DataAccess.UnitTests/EdFi.Security.DataAccess.UnitTests.csproj index 71a61cce7..8417fdd50 100644 --- a/tests/EdFi.Security.DataAccess.UnitTests/EdFi.Security.DataAccess.UnitTests.csproj +++ b/tests/EdFi.Security.DataAccess.UnitTests/EdFi.Security.DataAccess.UnitTests.csproj @@ -16,7 +16,8 @@ true - + + diff --git a/tests/EdFi.Security.DataAccess.UnitTests/StubSecurityContext.cs b/tests/EdFi.Security.DataAccess.UnitTests/StubSecurityContext.cs index 4166d7b46..1a861c2d8 100644 --- a/tests/EdFi.Security.DataAccess.UnitTests/StubSecurityContext.cs +++ b/tests/EdFi.Security.DataAccess.UnitTests/StubSecurityContext.cs @@ -4,12 +4,12 @@ // See the LICENSE and NOTICES files in the project root for more information. using System.Collections.Generic; -using System.Data.Entity; -using System.Data.Entity.Infrastructure; using System.Linq; using EdFi.Security.DataAccess.Contexts; using EdFi.Security.DataAccess.Models; using FakeItEasy; +using Microsoft.EntityFrameworkCore; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace EdFi.Security.DataAccess.UnitTests { @@ -23,22 +23,27 @@ public static ISecurityContext GetMockedSecurityContext() { var securityContext = A.Fake(); // The underlying SecurityRepository implementation expects this application, so force it to be there in the fake - securityContext.Applications = GetFakeDbSet().SetupData(new List { new Application { ApplicationId = 1, ApplicationName = "Ed-Fi ODS API" } }); - securityContext.Actions = GetFakeDbSet().SetupData(); - securityContext.AuthorizationStrategies = GetFakeDbSet().SetupData(); - securityContext.ClaimSets = GetFakeDbSet().SetupData(); - securityContext.ClaimSetResourceClaimActions = GetFakeDbSet().SetupData(); - securityContext.ResourceClaims = GetFakeDbSet().SetupData(); - securityContext.ResourceClaimActions = GetFakeDbSet().SetupData(); - securityContext.ClaimSetResourceClaimActionAuthorizationStrategyOverrides = GetFakeDbSet().SetupData(); - securityContext.ResourceClaimActionAuthorizationStrategies = GetFakeDbSet().SetupData(); + + securityContext.Applications = GetFakeDbSet(); + securityContext.Actions = GetFakeDbSet(); + securityContext.AuthorizationStrategies = GetFakeDbSet(); + securityContext.ClaimSets = GetFakeDbSet(); + securityContext.ClaimSetResourceClaimActions = GetFakeDbSet(); + securityContext.ResourceClaims = GetFakeDbSet(); + securityContext.ResourceClaimActions = GetFakeDbSet(); + securityContext.ClaimSetResourceClaimActionAuthorizationStrategyOverrides = GetFakeDbSet(); + securityContext.ResourceClaimActionAuthorizationStrategies = GetFakeDbSet(); return securityContext; + } + private static DbSet GetFakeDbSet() where T : class { - return A.Fake>(o => o.Implements(typeof(IQueryable)).Implements(typeof(IDbAsyncEnumerable))); - } + var fake = A.Fake>(o => o.Implements(typeof(IQueryable)).Implements(typeof(IAsyncEnumerable))); + + return fake; + } } -} +} \ No newline at end of file