I am trying to unit test a method in my MyViewModel
which extends from BaseViewModel
. The BaseViewModel
has a method like this
protected bool DoSomething()
{
if (something)
{
ServiceLocator.Current.GetInstance ...; //ERROR
return true;
}
else
{
return false;
}
}
DoSomething
is called pretty much in every view model. The app works as expected but I am trying to unit test (NUnit) and every method that calls DoSomething
is failing in unit tests
The error I get is
error CS0119: 'ServiceLocator' is a type, which is not valid in the given context