public void PropertyHandlerDictionaryBuilder_NamedT_PropertyNameNull_ThrowsException() { var handlerDictionary = new PropertyHandlerDictionary(); var target = new PropertyHandlerDictionaryBuilder(handlerDictionary); Assert.Throws<ArgumentNullException>(() => { target.Named<string>(null, a => { }); }); }
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_HandlerNull_ThrowsException() { var handlerDictionary = new PropertyHandlerDictionary(); var target = new PropertyHandlerDictionaryBuilder(handlerDictionary); Assert.Throws<ArgumentNullException>(() => { target.Named("key", null); }); }
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]); }