예제 #1
0
        public void ShouldReturnValueFromCreatorWhenCreatingOne()
        {
            var container = new KeyedFactoryContainer <int, int>();

            container.RegisterFactory(5, 5);

            var value = container.CreateValue(5, factory => 3);

            Assert.AreEqual(3, value);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public void ShouldThrowWhenRegisteringNullKey()
        {
            var container = new KeyedFactoryContainer <object, object>();

            container.RegisterFactory(null, new object());
        }
예제 #4
0
        public void ShouldThrowWhenRegisteringNullFactory()
        {
            var container = new KeyedFactoryContainer <int, object>();

            container.RegisterFactory(5, null);
        }
예제 #5
0
 public static void RegisterColumnSettingNameFactory(string name, ColumnSettingNameFactory factory)
 {
     _columnSettingNameFactories.RegisterFactory(name, factory);
 }