示例#1
0
        public void Constructor_WithNameAndInitalValue_IsValueSetIsFalse()
        {
            // Arrange & Act
            var @switch = new CompatibilitySwitch <bool>("TestProperty", initialValue: true);

            // Assert
            Assert.True(@switch.Value);
            Assert.False(@switch.IsValueSet);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
 public TestOptions()
 {
     _testProperty = new CompatibilitySwitch <bool>(nameof(TestProperty));
     _switches     = new ICompatibilitySwitch[] { _testProperty };
 }