You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 23, 2024. It is now read-only.
I'm trying to do TDD but I'm finding it hard to deal with Preferences and Shell.Current objects that can't be injected and are created by Maui at running time.
I reviewed your brilliant application and found that you access all of them through services, freeing the View Models of references.
But, isn't it just passing the buck? At the end, the services aren't tested. I can test MVVM fine, but not Services.
Is that the case? You don't have a way to test your services in your code?
To illustrate:
This comes from the Settings Service:
public string AuthAccessToken
{
get => Preferences.Get(AccessToken, AccessTokenDefault);
set => Preferences.Set(AccessToken, value);
}
Now, I don't know a way to mock or stub the Preferences static class in the last two lines. If I want to test the service, I can't, because the Preferences static object is not injected but created behind the scenes.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm trying to do TDD but I'm finding it hard to deal with Preferences and Shell.Current objects that can't be injected and are created by Maui at running time.
I reviewed your brilliant application and found that you access all of them through services, freeing the View Models of references.
But, isn't it just passing the buck? At the end, the services aren't tested. I can test MVVM fine, but not Services.
Is that the case? You don't have a way to test your services in your code?
To illustrate:
This comes from the Settings Service:
public string AuthAccessToken
{
get => Preferences.Get(AccessToken, AccessTokenDefault);
set => Preferences.Set(AccessToken, value);
}
Now, I don't know a way to mock or stub the Preferences static class in the last two lines. If I want to test the service, I can't, because the Preferences static object is not injected but created behind the scenes.
The text was updated successfully, but these errors were encountered: