public void ShouldReturnValueFromCreatorWhenCreatingOne() { var container = new KeyedFactoryContainer <int, int>(); container.RegisterFactory(5, 5); var value = container.CreateValue(5, factory => 3); Assert.AreEqual(3, value); }
public void ShouldPassToCreatorFactoryWithMatchingKeyWhenCreatingValue() { var container = new KeyedFactoryContainer <int, int>(); container.RegisterFactory(5, 10); var someFactory = 0; container.CreateValue <object>(5, factory => { someFactory = factory; return(null); }); Assert.AreEqual(10, someFactory); }
public void ShouldThrowWhenRegisteringNullKey() { var container = new KeyedFactoryContainer <object, object>(); container.RegisterFactory(null, new object()); }
public void ShouldThrowWhenRegisteringNullFactory() { var container = new KeyedFactoryContainer <int, object>(); container.RegisterFactory(5, null); }
public static void RegisterColumnSettingNameFactory(string name, ColumnSettingNameFactory factory) { _columnSettingNameFactories.RegisterFactory(name, factory); }