public void InvokeDirectMethods() { var propertyPath = new PropertyPath(null, ConfOrm.ForClass <MyClass> .Property(x => x.Dictionary)); var customizersHolder = new CustomizersHolder(); var customizer = new MapKeyCustomizer(propertyPath, customizersHolder); var elementMapper = new Mock <IMapKeyMapper>(); customizer.Type(typeof(MyUserType)); customizer.Type <MyUserType>(); customizer.Type(NHibernateUtil.String); customizer.Length(10); customizer.Column("pizza"); customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object); elementMapper.Verify(x => x.Type(It.Is <Type>(v => v == typeof(MyUserType))), Times.Once()); elementMapper.Verify(x => x.Type <MyUserType>(), Times.Once()); elementMapper.Verify(x => x.Type(It.Is <IType>(v => v.GetType() == NHibernateUtil.String.GetType())), Times.Once()); elementMapper.Verify(x => x.Length(It.Is <int>(v => v == 10)), Times.Once()); elementMapper.Verify(x => x.Column(It.Is <string>(v => v == "pizza")), Times.Once()); }
public void InvokeDirectMethods() { var propertyPath = new PropertyPath(null, ForClass<MyClass>.Property(x => x.Dictionary)); var customizersHolder = new CustomizersHolder(); var customizer = new MapKeyCustomizer(propertyPath, customizersHolder); var elementMapper = new Mock<IMapKeyMapper>(); customizer.Type(typeof(MyUserType)); customizer.Type<MyUserType>(); customizer.Type(NHibernateUtil.String); customizer.Length(10); customizer.Column("pizza"); customizersHolder.InvokeCustomizers(propertyPath, elementMapper.Object); elementMapper.Verify(x => x.Type(It.Is<Type>(v => v == typeof(MyUserType))), Times.Once()); elementMapper.Verify(x => x.Type<MyUserType>(), Times.Once()); elementMapper.Verify(x => x.Type(It.Is<IType>(v => v.GetType() == NHibernateUtil.String.GetType())), Times.Once()); elementMapper.Verify(x => x.Length(It.Is<int>(v => v == 10)), Times.Once()); elementMapper.Verify(x => x.Column(It.Is<string>(v => v == "pizza")), Times.Once()); }