Starts in:
1 DAY
20 HRS
42 MIN
39 SEC
Starts in:
1 D
20 H
42 M
39 S

Activities of "PDarioJer"

Fair enough :) In any case, the original problem is solved. Thanks for the help!

Actually, I found this post while looking for a solution: https://github.com/bUnit-dev/bUnit/discussions/305 Removing the SetupModule from the Testbase and replacing it with

testContext.JSInterop.Mode = JSRuntimeMode.Loose;

did the trick. I can work with this for now. Though, if you have any concerns with this approach, I would be open to hear them. I gotta admit that I don't fully understand what is going on here.

Hi,

while this worked to resolve the dependency, I encountered the following error when adding a form with a TextObject

Bunit.JSRuntimeUnhandledInvocationException: bUnit's JSInterop has not been configured to handle the call:

Bunit.JSRuntimeUnhandledInvocationException
bUnit's JSInterop has not been configured to handle the call:

    InvokeVoidAsync("initialize", Microsoft.AspNetCore.Components.ElementReference, "0HN55GR2KUKHU", null, null)

Configure bUnit's JSInterop to handle the call with following:

    SetupVoid("initialize", Microsoft.AspNetCore.Components.ElementReference, "0HN55GR2KUKHU", null, null)
or the following, to match any arguments:
    SetupVoid("initialize", _ => true)

The setup methods are available on an instance of the BunitJSInterop or
BunitJSModuleInterop type. The standard BunitJSInterop is available
through the TestContext.JSInterop property, and a BunitJSModuleInterop
instance is returned from calling SetupModule on a BunitJSInterop instance.

   at Bunit.BunitJSInterop.TryHandlePlannedInvocation[TValue](JSRuntimeInvocation invocation) in /_/src/bunit.web/JSInterop/BunitJSInterop.cs:line 83
   at Bunit.BunitJSInterop.HandleInvocation[TValue](JSRuntimeInvocation invocation) in /_/src/bunit.web/JSInterop/BunitJSInterop.cs:line 68
   at Bunit.JSInterop.Implementation.JSRuntimeExtensions.HandleInvokeAsync[TValue](BunitJSInterop jSInterop, String identifier, Object[] args) in /_/src/bunit.web/JSInterop/Implementation/JSRuntimeExtensions.cs:line 9
   at Bunit.BunitJSObjectReference.InvokeAsync[TValue](String identifier, Object[] args) in /_/src/bunit.web/JSInterop/Implementation/BunitJSObjectReference.cs:line 26
   at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, Object[] args)
   at Blazorise.Modules.BaseJSModule.InvokeSafeVoidAsync(String identifier, Object[] args)
   at Blazorise.TextEdit.OnFirstAfterRenderAsync()
   at Blazorise.BaseAfterRenderComponent.OnAfterRenderAsync(Boolean firstRender)
   at Blazorise.BaseComponent.OnAfterRenderAsync(Boolean firstRender)
   at Bunit.Rendering.TestRenderer.AssertNoUnhandledExceptions() in /_/src/bunit.core/Rendering/TestRenderer.cs:line 625
   at Bunit.Rendering.TestRenderer.Render[TResult](RenderFragment renderFragment, Func`2 activator) in /_/src/bunit.core/Rendering/TestRenderer.cs:line 480
   at Bunit.Rendering.TestRenderer.RenderFragment(RenderFragment renderFragment) in /_/src/bunit.core/Rendering/TestRenderer.cs:line 101
   at Bunit.Extensions.TestContextBaseRenderExtensions.RenderInsideRenderTree(TestContextBase testContext, RenderFragment renderFragment) in /_/src/bunit.core/Extensions/TestContextBaseRenderExtensions.cs:line 43
   at Bunit.Extensions.TestContextBaseRenderExtensions.RenderInsideRenderTree[TComponent](TestContextBase testContext, RenderFragment renderFragment) in /_/src/bunit.core/Extensions/TestContextBaseRenderExtensions.cs:line 23
   at Bunit.TestContext.Render[TComponent](RenderFragment renderFragment) in /_/src/bunit.web/TestContext.cs:line 68
   at Bunit.TestContext.RenderComponent[TComponent](Action`1 parameterBuilder) in /_/src/bunit.web/TestContext.cs:line 54
   at BookStore.Blazor.Tests.Index_Tests.Index_Test() in C:\Users\dpichowsky\source\abp\abp-samples\BlazorPageUniTest\test\BookStore.Blazor.Tests\Index_Tests.cs:line 25
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

I fear that this error is thrown because he cannot resolve a dynamically created javascript file. This, of course would make testing difficult while working with Blazorize. Do you have an idea on how to work around this or is this a bUnit issue?

Edit: I pushed the new changes into the repo

hi

Can you fork this sample and add your code to reproduce the error?

Thanks

https://github.com/abpframework/abp-samples/tree/master/BlazorPageUniTest

Hi,

I added my code. It shows the same error as in my project https://github.com/PDarioJer/abp-samples

Once I updated the nuGet packages to the new ABP version, my integration tests throw the following error. As you can see, I used the SampleTests as an example:

Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module MyProject.MyProjectTestBaseModule, MyProject.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: Method not found: 'System.String Volo.Abp.Localization.LanguageInfo.get_FlagIcon()'.. See the inner exception for details.  
---- System.MissingMethodException : Method not found: 'System.String Volo.Abp.Localization.LanguageInfo.get_FlagIcon()'.  

I have adjusted the LocalizationOptions according to the migration guide and I have also created a new migration and applied it

Full stacktrace:

ModuleManager.InitializeModules(ApplicationInitializationContext context)  
AbpApplicationBase.InitializeModules()  
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)  
AbpIntegratedTest`1.ctor()  
MyProjectTestBase`1.ctor()  
MyProjectDomainTestBase`1.ctor()  
SampleDomainTests`1.ctor() Zeile 20  
EfCoreSampleDomainTests.ctor()  
RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)  
----- Inner Stack Trace -----  
LanguageManagementDataSeeder.SeedAsync()  
AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)  
LanguageManagementDataSeeder.SeedAsync()  
LanguageManagementDataSeedContributor.SeedAsync(DataSeedContext context)  
DataSeeder.SeedAsync(DataSeedContext context)  
AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)  
CastleAbpMethodInvocationAdapter.ProceedAsync()  
UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)  
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)  
<<SeedTestData>b__0>d.MoveNext() Zeile 41  
--- End of stack trace from previous location ---  
TaskExtensions.WaitAndUnwrapException(Task task)  
<>c__DisplayClass15_0.<Run>b__0(Task t)  
ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)  
--- End of stack trace from previous location ---  
ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)  
Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)  
--- End of stack trace from previous location ---  
TaskExtensions.WaitAndUnwrapException(Task task)  
AsyncContext.Run(Func`1 action)  
AsyncHelper.RunSync(Func`1 action)  
MyProjectTestBaseModule.SeedTestData(ApplicationInitializationContext context) Zeile 37  
MyProjectTestBaseModule.OnApplicationInitialization(ApplicationInitializationContext context) Zeile 32  
OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)  
ModuleManager.InitializeModules(ApplicationInitializationContext context)  

Hi, we removed the FlagIcon property in this version, please see the migration guide. You should probably have an old NuGet package version somewhere in your test application, or in one of the dependent projects. Please check package versions manually. If you could not find the reason, feel free to open a new ticket and after that share your project with us, so we can better assist you.

Thank you. Apparently updating the packages via ABP Suite fixed the versioning problem.

Once I updated the nuGet packages to the new ABP version, my integration tests throw the following error. As you can see, I used the SampleTests as an example:

Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module MyProject.MyProjectTestBaseModule, MyProject.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: Method not found: 'System.String Volo.Abp.Localization.LanguageInfo.get_FlagIcon()'.. See the inner exception for details.
---- System.MissingMethodException : Method not found: 'System.String Volo.Abp.Localization.LanguageInfo.get_FlagIcon()'.

I have adjusted the LocalizationOptions according to the migration guide and I have also created a new migration and applied it

Full stacktrace:

ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest`1.ctor()
MyProjectTestBase`1.ctor()
MyProjectDomainTestBase`1.ctor()
SampleDomainTests`1.ctor() Zeile 20
EfCoreSampleDomainTests.ctor()
RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
----- Inner Stack Trace -----
LanguageManagementDataSeeder.SeedAsync()
AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
LanguageManagementDataSeeder.SeedAsync()
LanguageManagementDataSeedContributor.SeedAsync(DataSeedContext context)
DataSeeder.SeedAsync(DataSeedContext context)
AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapter.ProceedAsync()
UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
<<SeedTestData>b__0>d.MoveNext() Zeile 41
--- End of stack trace from previous location ---
TaskExtensions.WaitAndUnwrapException(Task task)
<>c__DisplayClass15_0.<Run>b__0(Task t)
ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
TaskExtensions.WaitAndUnwrapException(Task task)
AsyncContext.Run(Func`1 action)
AsyncHelper.RunSync(Func`1 action)
MyProjectTestBaseModule.SeedTestData(ApplicationInitializationContext context) Zeile 37
MyProjectTestBaseModule.OnApplicationInitialization(ApplicationInitializationContext context) Zeile 32
OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
ModuleManager.InitializeModules(ApplicationInitializationContext context)

Thank you, this helped!

Unfortunately, the GuidGenerator is a protected property, so I won't be able to set it manually. Getting the ItemManager through DI is an option, however, I don't want it to use the actual ItemRepository but a Substitute, so I can return a fake return value on the FindByItemNrAndVariantAsync(...) method.

My question here is: Is there a way to provide the domain service with an implementation of the GuidGenerator without using the IDomainService interface? Or alternatively, is there a way to get the ItemManager through dependency injection but with a mocked ItemRepository?

Showing 1 to 8 of 8 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06