Open Closed

Regarding accessing tenant id in unit test cases #1228


User avatar
0
ChetanKumbhar created

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(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,

  1. Is this correct way to access tenant id in unit test cases if yes, then how should i fixed that exception.

  2. 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)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08