I have below class with a single property
public class TestService
{
public bool TestFlag { get; set; }
}
I am injecting this service as singleton like below
AddSingleton<TestService>();
I have used this in one of the class like
bool flag = _testService.TestFlag;
if (flag)
{ }
else
{ }
and I am setting this property in test cases so that the if-else block will execute as per test case need.
It's working fine. But would like to know if this code has any hidden issues or is there any better way of doing this in .net core?