0
davidharrison created
Hi Guys,
I've recently begun building out unit tests in our .net zero project and I don't currently fully understand how the unit tests manage user context.
I've noticed that the AbpSession.UserId value when the tests are running is set to user 2. How does the testing framework chose this user and set as user context?
Is it possible to change which user context all the tests or certain tests run under?
Thanks,
David
1 Answer(s)
-
0
Hi,
There is a method called LoginAsDefaultTenantAdmin in the base test class, see https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/test/MyCompanyName.AbpZeroTemplate.Tests/AppTestBase.cs#L30.
And this method is called in every test class as you can see. You can create a similar method and use it instead.