public void ArgumentReflector_Reflect_ExplicitCaseSensitivity_LowerCaseHandlerKey_LowerCasePropName_Verify_HandlerRun_PassedPropValue() { var passedValue = "value"; var relfectedValue = String.Empty; var target = new ArgumentReflector(new { key = passedValue }, true); target.Reflect(new PropertyHandlerDictionary { { "key", v => relfectedValue = (string)v } }); Assert.Equal(passedValue, relfectedValue); }
public void ArgumentReflector_Reflect_Verify_HandlerRun_And_PassedPropertyValue() { var passedValue = "value"; var relfectedValue = String.Empty; var target = new ArgumentReflector(new { key = passedValue }); target.Reflect(new PropertyHandlerDictionary { { "key", v => relfectedValue = (string)v } }); Assert.Equal(passedValue, relfectedValue); }
public void ArgumentReflector_Reflect_UnusedPropertyName_HandlerNotRun() { var passedValue = "value"; var relfectedValue = String.Empty; var target = new ArgumentReflector(new { otherkey = passedValue }, true); target.Reflect(new PropertyHandlerDictionary { { "key", v => relfectedValue = "handlerRun" } }); Assert.Equal(String.Empty, relfectedValue); }
public void ArgumentReflector_Reflect_HandlerDictionary_Null_ThrowsException() { var target = new ArgumentReflector(new { }); Assert.Throws<ArgumentNullException>(() => { target.Reflect((PropertyHandlerDictionary)null); }); }
public void ArgumentReflector_Reflect_HandlerDictionaryBuilder_VerifyBuiltSetIsEffectivelyRun() { var passedValue = "value"; var relfectedValue = String.Empty; var target = new ArgumentReflector(new { key = passedValue }); target.Reflect(prop => { prop.Named<string>("key", v => relfectedValue = v); }); Assert.Equal(passedValue, relfectedValue); }
public void ArgumentReflector_Reflect_HandlerDictionaryBuilder_Null_ThrowsException() { var obj = new { }; var target = new ArgumentReflector(obj); Assert.Throws<ArgumentNullException>(() => { target.Reflect((Action<PropertyHandlerDictionaryBuilder>)null); }); }