Starts in:
2 DAYS
14 HRS
47 MIN
59 SEC
Starts in:
2 D
14 H
47 M
59 S
Open Closed

Regarding Issue in Unit Test Case. #1206


User avatar
0
ChetanKumbhar created

Hi,

I have added following services, in my one of service. IPermissionGrantRepository _permissionGrantRepository IPermissionChecker _permissionChecker IPermissionStore _permissionStore

There is no issue while working with api. But now i am testing this in unit test projects. I am getting following error. ***********.InvoiceApplicationTests.GetListAsync Duration: 1 ms

Message: Autofac.Core.DependencyResolutionException : An exception was thrown while activating .InvoiceAppService. ---- Autofac.Core.DependencyResolutionException : None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type '.InvoiceAppService' can be invoked with the available services and parameters: Cannot resolve parameter 'Volo.Abp.PermissionManagement.IPermissionGrantRepository permissionGrantRepository' of constructor 'Void .ctor(.IInvoiceRepository, Volo.Abp.Linq.IAsyncQueryableExecuter, Microsoft.Extensions.Localization.IStringLocalizer1[***********.InvoiceManagementResource], Microsoft.Extensions.Logging.ILogger1[.InvoiceAppService], Volo.Abp.Uow.IUnitOfWorkManager, Volo.Abp.PermissionManagement.IPermissionGrantRepository, Volo.Abp.Authorization.Permissions.IPermissionChecker, Volo.Abp.Authorization.Permissions.IPermissionStore)'. Stack Trace: InstanceLookup.CreateInstance(IEnumerable1 parameters) InstanceLookup.Execute() ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request) ResolveOperation.ResolveComponent(ResolveRequest request) ResolveOperation.Execute(ResolveRequest request) LifetimeScope.ResolveComponent(ResolveRequest request) ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable1 parameters) ResolutionExtensions.Resolve(IComponentContext context, Type serviceType) AutofacServiceProvider.GetRequiredService(Type serviceType) ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) AbpTestBaseWithServiceProvider.GetRequiredServiceT InvoiceApplicationTests.ctor() line 24 ----- Inner Stack Trace ----- ReflectionActivator.GetValidConstructorBindings(ConstructorInfo[] availableConstructors, IComponentContext context, IEnumerable1 parameters) ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable1 parameters) InstanceLookup.CreateInstance(IEnumerable`1 parameters)

I have added following referances 

using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp; using Volo.Abp.Uow; using Microsoft.Extensions.DependencyInjection;

in **\test*.EntityFrameworkCore.Tests\EntityFrameworkCore project. still i am getting same error.

what configuration i am missing.

  • ABP Framework version: v3.0.4
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

1 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    Can you check *****ApplicationTestModule class in your test project for if there is a missing configuration or dependency.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06