public void Throws_exception_when_setting_is_not_a_boolean() { var mocks = new MockRepository(); var settings = mocks.CreateMock<IApplicationConfiguration>(); using (mocks.Record()) { Expect.Call(settings.GetSetting("SampleSetting")).Return("NonBoolean"); } using (mocks.Playback()) { IConfigurationReader configurationReader = new ConfigurationReader(settings); configurationReader.GetRequiredBooleanSetting("SampleSetting"); } mocks.VerifyAll(); }
public void Reads_boolean_setting() { var mocks = new MockRepository(); var settings = mocks.CreateMock<IApplicationConfiguration>(); using (mocks.Record()) { Expect.Call(settings.GetSetting("BooleanSetting")).Return("false"); } using (mocks.Playback()) { IConfigurationReader configurationReader = new ConfigurationReader(settings); bool setting = configurationReader.GetRequiredBooleanSetting("BooleanSetting"); Assert.That(setting, Is.EqualTo(false)); } mocks.VerifyAll(); }