public void BeAbleToUseATestTypeSettingRemovertoRemoveASetting()
        {
            var removers = new Dictionary<Type, Func<ISetting, bool>>();
            Func<ISetting, bool> fakeRemover = FakeRemovers.Remove;
            var fakeSetting = Isolate.Fake.Instance<ISetting>();
            Isolate.WhenCalled(() => fakeSetting.Type).WillReturn(typeof(ConnectionStringSettings));
            Isolate.WhenCalled(() => fakeRemover.Invoke(fakeSetting)).WillReturn(true);
            removers.Add(typeof(ConnectionStringSettings), fakeRemover);

            var source = new MyTestSettingSource(null, removers);
            try
            {
                source.Add(fakeSetting);
                Assert.IsTrue(source.Any(s => s.Key == fakeSetting.Key));
                source.Remove(fakeSetting);
                Isolate.Verify.WasCalledWithExactArguments(() => fakeRemover.Invoke(fakeSetting));
            }
            catch (Exception e)
            {
                Assert.Fail(e.ToString());
            }
        }
        public void BeAbleToUseATestTypeSettingWriterToWriteASetting()
        {
            var writers = new Dictionary<Type, Action<ISetting>>();
            Action<ISetting> fakeWriter = FakeWriters.Write;
            var setting = Isolate.Fake.Instance<ISetting>();
            Isolate.WhenCalled(() => setting.Type).WillReturn(typeof(ConnectionStringSettings));
            Isolate.WhenCalled(() => fakeWriter.Invoke(setting)).IgnoreCall();
            writers.Add(typeof(ConnectionStringSettings), fakeWriter);

            try
            {
                var source = new MyTestSettingSource(writers, new Dictionary<Type, Func<ISetting, bool>>()) {setting};
                Isolate.Verify.WasCalledWithExactArguments(() => fakeWriter.Invoke(setting));

            }
            catch (Exception e)
            {
                Assert.Fail(e.ToString());
            }
        }
 private static MyTestSettingSource SetupSettingSourceWithoutWritersOrReadersOrRemovers()
 {
     var fakeRemovers = Isolate.Fake.Instance<IDictionary<Type, Func<ISetting, bool>>>();
     var fakeWriters = Isolate.Fake.Instance<IDictionary<Type, Action<ISetting>>>();
     var source = new MyTestSettingSource(fakeWriters, fakeRemovers);
     return source;
 }