Hi,
I am trying to access tenant id in unit test case project. Following configurations i have done in to my project.
set tenant id in App setting json of project "TenantId": "**********************************"
after this i have done some configuration in TestBaseModul.cs
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = true;
});
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
SeedTestData(context);
var app = context.GetApplicationBuilder();
app.UseMultiTenancy();
}
Now i am getting Object referance not set to instance .....exception. I have two question,
- Is this correct way to access tenant id in unit test cases if yes, then how should i fixed that exception.
- If not then, how should i access tenant id in Unit test cases.
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:
10 Answer(s)
-
0
hi
You can refer the unit test of abp framework.
https://github.com/abpframework/abp/blob/dev/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs#L27 https://github.com/abpframework/abp/blob/dev/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs#L55
https://docs.abp.io/en/abp/latest/Multi-Tenancy#change-the-current-tenant
-
0
hi,
This is not worked, in my project I have called 2nd api inside main service, When i call that a main service throguh postman or web brawser, i am getting tenant id in 2nd api. but same when i call main service into unit test cases, I am getting tenant id as null. I am trying to get that tenant through Unit test cases.
can we connect though online session.?
-
0
Hi, It's bit of urgen, can we connect through online session for this issue??
-
0
Hi,
Any update ?
-
0
hi ChetanKumbhar
Can you share a simple project to reproduce your problem? liming.ma@volosoft.com
-
0
Hi,
I can not share this one because its size & security, instead this can we connect in online session ?. In that session i can explain briefly to you.
-
0
hi
I believe that the problem can be seen remotely, but I need a project to understand and solve, can you use a template project to show your problem?
-
0
Hi,
I can show project & what problem i am facing remotely, but creating template project now it bit taking time because we created modules & separated hosts. & this needs to fix on immediate level.
-
0
https://zoom.us/j/95101853668?pwd=QkMwblFMOVdBd1JKUXdQMzNOK2tDQT09
-
0
This question has been automatically marked as stale because it has not had recent activity.