public SettingsProviderTests() { applicationSettingsStore = Substitute.For<ISettingsStorage>(); backingStore = new Dictionary<string, string>(); applicationSettingsStore.Load("TestSettings.settings").Returns(backingStore); applicationSettingsStore .When(s=>s.Save("TestSettings.settings", Arg.Any<Dictionary<string, string>>())) .Do(c=> { backingStore.Clear(); foreach (var setting in c.Arg<Dictionary<string, string>>()) { backingStore.Add(setting.Key, setting.Value); } }); settingsRetreiver = new SettingsProvider(applicationSettingsStore); settingsSaver = new SettingsProvider(applicationSettingsStore); }