Problem in writing application test #14258
Replies: 3 comments 2 replies
-
You can set the
|
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
You can set the
|
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
Hi,
Imagine I have two application services:
WebInfoAppService
andMainAppService
MainAppService is:
now I want to write a test for this class:
I should use Substitute.For in order to set return value for
IsConnectedAsync
method ofIWebInfoAppService
class so i have to declareMainAppService
Without usingGetRequiredService<IMainAppService>()
the problem is**CurrentUser**
always null and if i useGetRequiredService<IMainAppService>()
, CurrentUser will filled with data. what should I do to either change class behavior after it's injected or get data in CurrentUser if I declare WebInfoAppService directly?Beta Was this translation helpful? Give feedback.
All reactions