Created
April 15, 2014 22:07
-
-
Save citizenmatt/10781805 to your computer and use it in GitHub Desktop.
ReSharper test with settings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void TestSomething() | |
{ | |
Lifetimes.Using(lifetime => { | |
// Defined in BaseTest. Injects a writable storage at high priority | |
// to accept changes to settings, and which is thrown away when the | |
// lifetime terminates | |
ChangeSettingsTemporarily(lifetime); | |
var settingsStore = ShellInstance.GetComponent<ISettingsStore>().BindToContextLive(lifetime, ContextRange.ApplicationWide); | |
// Use your own settings object and properties in place of FooSettings | |
settingsStore.SetValue((FooSettings f) => f.SomeFlag, true); | |
settingsStore.SetValue((FooSettings f) => f.OtherFlag, false); | |
// Do normal test stuff... | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment