public void Constructor_WithNameAndInitalValue_IsValueSetIsFalse() { // Arrange & Act var @switch = new CompatibilitySwitch <bool>("TestProperty", initialValue: true); // Assert Assert.True(@switch.Value); Assert.False(@switch.IsValueSet); }
public void ValueInterface_SettingValue_SetsIsValueSetToTrue() { // Arrange var @switch = new CompatibilitySwitch <bool>("TestProperty"); // Act ((ICompatibilitySwitch)@switch).Value = true; // Assert Assert.True(@switch.Value); Assert.True(@switch.IsValueSet); }
public void ValueNonInterface_SettingValue_SetsIsValueSetToTrue() { // Arrange var @switch = new CompatibilitySwitch <bool>("TestProperty"); // Act @switch.Value = false; // You don't need to actually change the value, just caling the setting works // Assert Assert.False(@switch.Value); Assert.True(@switch.IsValueSet); }
public TestOptions() { _testProperty = new CompatibilitySwitch <bool>(nameof(TestProperty)); _switches = new ICompatibilitySwitch[] { _testProperty }; }