本文整理汇总了C#中CustomizersHolder.AddCustomizer方法的典型用法代码示例。如果您正苦于以下问题:C# CustomizersHolder.AddCustomizer方法的具体用法?C# CustomizersHolder.AddCustomizer怎么用?C# CustomizersHolder.AddCustomizer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomizersHolder
的用法示例。
在下文中一共展示了CustomizersHolder.AddCustomizer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeCustomizerOfDictionaryKeyManyToManyRelation
public void InvokeCustomizerOfDictionaryKeyManyToManyRelation()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyDictionary));
var customizersHolder = new CustomizersHolder();
var elementMapper = new Mock<IMapKeyManyToManyMapper>();
customizersHolder.AddCustomizer(propertyPath, (IMapKeyManyToManyMapper x) => x.Column("pizza"));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.Column(It.Is<string>(v => v == "pizza")), Times.Once());
}
示例2: InvokeCustomizerOfCollectionOneToManyRelation
public void InvokeCustomizerOfCollectionOneToManyRelation()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var elementMapper = new Mock<IOneToManyMapper>();
customizersHolder.AddCustomizer(propertyPath, (IOneToManyMapper x) => x.NotFound(NotFoundMode.Ignore));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.NotFound(It.Is<NotFoundMode>(v => v == NotFoundMode.Ignore)), Times.Once());
}
示例3: InvokeCustomizerOfCollectionElementRelation
public void InvokeCustomizerOfCollectionElementRelation()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var elementMapper = new Mock<IElementMapper>();
customizersHolder.AddCustomizer(propertyPath, (IElementMapper x) => x.Length(10));
customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object);
elementMapper.Verify(x => x.Length(It.Is<int>(v => v == 10)), Times.Once());
}
示例4: MergeShouldMergeCollectionPropertiesMapper
public void MergeShouldMergeCollectionPropertiesMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(propertyPath, (ICollectionPropertiesMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(propertyPath, (IBagPropertiesMapper)null);
called.Should().Be.True();
}
示例5: MergeShouldMergeElementMapper
public void MergeShouldMergeElementMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(propertyPath, (IElementMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(propertyPath, (IElementMapper)null);
Assert.That(called, Is.True);
}
示例6: WhenRegisteredCustomizerForDictionaryThenCallElementMapperAction
public void WhenRegisteredCustomizerForDictionaryThenCallElementMapperAction()
{
var orm = GetBaseMockedDomainInspector();
orm.Setup(x => x.IsDictionary(It.Is<MemberInfo>(m => m == ForClass<Person>.Property(p => p.Farm)))).Returns(true);
bool customizerInvoked = false;
var propertyPath = new PropertyPath(null, ForClass<Person>.Property(p => p.Farm));
var customizersHolder = new CustomizersHolder();
customizersHolder.AddCustomizer(propertyPath, (IOneToManyMapper x) => customizerInvoked = true);
var mapper = new Mapper(orm.Object, customizersHolder);
mapper.CompileMappingFor(new[] { typeof(Person) });
customizerInvoked.Should().Be.True();
}
示例7: MergeShouldMergeDynamicComponentAttributesMapper
public void MergeShouldMergeDynamicComponentAttributesMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(propertyPath, (IDynamicComponentAttributesMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(propertyPath, (IDynamicComponentAttributesMapper)null);
called.Should().Be.True();
}
示例8: MergeShouldMergeComponentAttributesMapper
public void MergeShouldMergeComponentAttributesMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(typeof(MyClass), (IComponentAttributesMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(typeof(MyClass), (IComponentAttributesMapper)null);
called.Should().Be.True();
}
示例9: MergeShouldMergeMapKeyManyToManyMapper
public void MergeShouldMergeMapKeyManyToManyMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(propertyPath, (IMapKeyManyToManyMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(propertyPath, (IMapKeyManyToManyMapper)null);
called.Should().Be.True();
}
示例10: InvokingCustomizerOnListThenInvokeCollectionPropertiesCustomizer
public void InvokingCustomizerOnListThenInvokeCollectionPropertiesCustomizer()
{
var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.MyCollection));
var customizersHolder = new CustomizersHolder();
var concreteCollectionMapper = new Mock<IListPropertiesMapper>();
customizersHolder.AddCustomizer(propertyPath, (ICollectionPropertiesMapper x) => x.BatchSize(10));
customizersHolder.InvokeCustomizers(propertyPath, concreteCollectionMapper.Object);
concreteCollectionMapper.Verify(x => x.BatchSize(It.Is<int>(v => v == 10)), Times.Once());
}
示例11: MergeShouldMergeUnionSubclassAttributesMapper
public void MergeShouldMergeUnionSubclassAttributesMapper()
{
var emptyHolder = new CustomizersHolder();
var holder = new CustomizersHolder();
var called = false;
holder.AddCustomizer(typeof(MyClass), (IUnionSubclassAttributesMapper x) => called = true);
emptyHolder.Merge(holder);
emptyHolder.InvokeCustomizers(typeof(MyClass), (IUnionSubclassAttributesMapper)null);
Assert.That(called, Is.True);
}