Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test project in template runs with errors #283

Closed
CopyPasteRepeat opened this issue Mar 27, 2024 · 2 comments
Closed

Unit test project in template runs with errors #283

CopyPasteRepeat opened this issue Mar 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@CopyPasteRepeat
Copy link

CopyPasteRepeat commented Mar 27, 2024

All of the unit tests within ExternalClaimsTransformerTest project in the template run into errors.

The error occurs in all cases when tests try to resolve ExternalClaimsTransformer service from serviceprovider within line

var sut = builder.GetRequiredService<ExternalClaimsTransformer<ApplicationUser>>();

A registration seems to be missing, but I haven't been able to figure out what exactly is missing or which extension still needs to be added to the registration.

This is the stack trace:

Message: 
System.InvalidOperationException : Unable to resolve service for type 'Aguacongas.IdentityServer.Abstractions.IFlushableCache1[Aguacongas.IdentityServer.Store.Entity.ExternalClaimTransformation]' while attempting to activate 'Aguacongas.IdentityServer.Store.CacheAdminStore2[Aguacongas.IdentityServer.EntityFramework.Store.AdminStore`2[Aguacongas.IdentityServer.Store.Entity.ExternalClaimTransformation,Aguacongas.IdentityServer.EntityFramework.Store.ConfigurationDbContext],Aguacongas.IdentityServer.Store.Entity.ExternalClaimTransformation]'.

Stack Trace: 
CallSiteFactory.CreateArgumentCallSites(ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain callSiteChain)
CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, Int32 slot)
CallSiteFactory.TryCreateExact(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
CallSiteFactory.CreateCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
CallSiteFactory.CreateArgumentCallSites(ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain callSiteChain, ParameterInfo[] parameters, Boolean throwIfCallSiteNotFound)
CallSiteFactory.CreateConstructorCallSite(ResultCache lifetime, ServiceIdentifier serviceIdentifier, Type implementationType, CallSiteChain callSiteChain)
CallSiteFactory.TryCreateExact(ServiceDescriptor descriptor, ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain, Int32 slot)
CallSiteFactory.TryCreateExact(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
CallSiteFactory.CreateCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
CallSiteFactory.GetCallSite(ServiceIdentifier serviceIdentifier, CallSiteChain callSiteChain)
ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
ServiceProvider.GetService(Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
ExternalClaimsTransformerTest.TransformPrincipal_should_transform_claims() line 58
--- End of stack trace from previous location ---

@CopyPasteRepeat CopyPasteRepeat added the bug Something isn't working label Mar 27, 2024
@aguacongas aguacongas transferred this issue from Aguafrommars/TheIdServer Mar 28, 2024
aguacongas pushed a commit that referenced this issue Mar 30, 2024
aguacongas pushed a commit that referenced this issue Mar 30, 2024
## [5.0.1](5.0.0...5.0.1) (2024-03-30)

### Bug Fixes

* external claims transformer tests ([8a07b8a](8a07b8a)), closes [#283](#283)
@aguacongas
Copy link
Member

aguacongas commented Mar 30, 2024

Fixed in 5.0.1. If you don't want to recreate a solution, apply changes to ExternalClaimsTransformerTest.cs

@CopyPasteRepeat
Copy link
Author

Great, thanks! @aguacongas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants