public void CallingTheResetValueMethodThrowsWhenIsLockedIsTrue() { var semimutable = new Semimutable <int>(1); semimutable.LockValue(); Assert.Throws <InvalidOperationException>(() => semimutable.ResetValue()); }
public void HasDefaultValueIsTrueWhenResetValueIsCalled() { var semimutable = new Semimutable <int>(1); semimutable.Value = 2; semimutable.ResetValue(); Assert.True(semimutable.HasDefaultValue); }
public void ResetChangesValueBackToDefault() { var semimutable = new Semimutable <int>(1); semimutable.Value = 2; semimutable.ResetValue(); Assert.True(semimutable.HasDefaultValue); }
/// <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)); } }
internal static void ResetDefaultResolverConstructorSelector() { UnlockDefaultResolverConstructorSelector(); _defaultResolverConstructorSelector.ResetValue(); }
internal static void ResetConverter() { UnlockConverter(); _converter.ResetValue(); }
internal static void ResetExtraPrimitivishTypes() { UnlockExtraPrimitivishTypes(); _extraPrimitivishTypes.ResetValue(); }
internal static void ResetKeyValueStore() { UnlockKeyValueStore(); _keyValueStore.ResetValue(); }