public void InvokeIndex()
        {
            var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
            var customizersHolder = new CustomizersHolder();
            var customizer = new ListPropertiesCustomizer<MyClass, int>(propertyPath, customizersHolder);
            var collectionMapper = new Mock<IListPropertiesMapper>();
            var listIndexMapper = new Mock<IListIndexMapper>();
            collectionMapper.Setup(x => x.Index(It.IsAny<Action<IListIndexMapper>>())).Callback<Action<IListIndexMapper>>(
                x => x.Invoke(listIndexMapper.Object));

            customizer.Index(x => x.Base(1));
            customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);

            listIndexMapper.Verify(x => x.Base(It.Is<int>(v => v == 1)));
        }
示例#2
0
        public void InvokeIndex()
        {
            var propertyPath      = new PropertyPath(null, ConfOrm.ForClass <MyClass> .Property(x => x.MyCollection));
            var customizersHolder = new CustomizersHolder();
            var customizer        = new ListPropertiesCustomizer <MyClass, int>(propertyPath, customizersHolder);
            var collectionMapper  = new Mock <IListPropertiesMapper>();
            var listIndexMapper   = new Mock <IListIndexMapper>();

            collectionMapper.Setup(x => x.Index(It.IsAny <Action <IListIndexMapper> >())).Callback <Action <IListIndexMapper> >(
                x => x.Invoke(listIndexMapper.Object));

            customizer.Index(x => x.Base(1));
            customizersHolder.InvokeCustomizers(propertyPath, collectionMapper.Object);

            listIndexMapper.Verify(x => x.Base(It.Is <int>(v => v == 1)));
        }