public void PropertyHandlerDictionary_AddTypedHandlerT_Verify_Adds_Handler() { var target = new PropertyHandlerDictionary(); var keyName = "key"; target.AddTypedHandler<string>(keyName, prop => { }); Assert.Equal(1, target.Keys.Count); Assert.True(target.ContainsKey(keyName)); }
public void PropertyHandlerDictionaryBuilder_NamedT_PropertyName_Handler_AddsHandler() { var handlerDictionary = new PropertyHandlerDictionary(); var target = new PropertyHandlerDictionaryBuilder(handlerDictionary); var keyName = "key"; var actionRunFlag = false; Action<string> handler = (a) => { actionRunFlag = true; }; target.Named<string>(keyName, handler); Assert.True(handlerDictionary.ContainsKey(keyName)); handlerDictionary[keyName]("value"); Assert.True(actionRunFlag); }
public void PropertyHandlerDictionaryBuilder_Named_PropertyName_Handler_AddsHandler() { var handlerDictionary = new PropertyHandlerDictionary(); var target = new PropertyHandlerDictionaryBuilder(handlerDictionary); var keyName = "key"; Action<object> handler = (a) => { }; target.Named(keyName, handler); Assert.True(handlerDictionary.ContainsKey(keyName)); Assert.Equal(handler, handlerDictionary[keyName]); }