Esempio n. 1
0
 private string GetSettingName(string settingName, DataGridColumn column, int columnIndex, DependencyProperty storedProperty)
 {
     if (SettingNameFactory != null)
     {
         return(SettingNameFactory(settingName, column, columnIndex, storedProperty));
     }
     return(_columnSettingNameFactories.CreateValue <string>(SettingNameFactoryKey, factory => factory(settingName, column, columnIndex, storedProperty)));
 }
        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 ShouldThrowWhenCreatingValueWithNullCreator()
        {
            var container = new KeyedFactoryContainer <object, int>();

            container.CreateValue <int>(new object(), null);
        }
        public void ShouldThrowWhenCreatingValueWithNullKey()
        {
            var container = new KeyedFactoryContainer <object, int>();

            container.CreateValue(null, factory => factory);
        }
        public void ShouldThrowWhenCreatingFromFactoryThatIsNotRegistered()
        {
            var container = new KeyedFactoryContainer <int, int>();

            container.CreateValue(5, factory => factory);
        }