Exemplo n.º 1
0
        public void CallingTheResetValueMethodThrowsWhenIsLockedIsTrue()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.LockValue();

            Assert.Throws <InvalidOperationException>(() => semimutable.ResetValue());
        }
Exemplo n.º 2
0
        public void HasDefaultValueIsTrueWhenResetValueIsCalled()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.Value = 2;
            semimutable.ResetValue();

            Assert.True(semimutable.HasDefaultValue);
        }
Exemplo n.º 3
0
        public void ResetChangesValueBackToDefault()
        {
            var semimutable = new Semimutable <int>(1);

            semimutable.Value = 2;

            semimutable.ResetValue();

            Assert.True(semimutable.HasDefaultValue);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Resets the value of the <see cref="Root"/> property to the default instance.
 /// <para>NOTE: This method should only be called at the beginning of an application. Any calls to this method after
 /// the <see cref="Root"/> property has been accessed (i.e. when <see cref="IsLocked"/> is true) will
 /// result in an <see cref="InvalidOperationException"/> being thrown.</para>
 /// </summary>
 /// <param name="additionalValues">When specified, these key/value pairs are applied to the resulting
 /// instance of <see cref="IConfiguration"/>.</param>
 /// <exception cref="InvalidOperationException">If the <see cref="IsLocked"/> property is true.</exception>
 public static void ResetRoot(IEnumerable <KeyValuePair <string, string> > additionalValues = null)
 {
     if (additionalValues == null)
     {
         _root.ResetValue();
     }
     else
     {
         SetRoot(() => GetDefaultRoot(additionalValues));
     }
 }
Exemplo n.º 5
0
 internal static void ResetDefaultResolverConstructorSelector()
 {
     UnlockDefaultResolverConstructorSelector();
     _defaultResolverConstructorSelector.ResetValue();
 }
 internal static void ResetConverter()
 {
     UnlockConverter();
     _converter.ResetValue();
 }
Exemplo n.º 7
0
 internal static void ResetExtraPrimitivishTypes()
 {
     UnlockExtraPrimitivishTypes();
     _extraPrimitivishTypes.ResetValue();
 }
Exemplo n.º 8
0
 internal static void ResetKeyValueStore()
 {
     UnlockKeyValueStore();
     _keyValueStore.ResetValue();
 }