Skip to content

Instantly share code, notes, and snippets.

@citizenmatt
Created April 15, 2014 22:07
Show Gist options
  • Save citizenmatt/10781805 to your computer and use it in GitHub Desktop.
Save citizenmatt/10781805 to your computer and use it in GitHub Desktop.
ReSharper test with settings
[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