public void AlwaysMatch()
        {
            var inspector = new Mock <IDomainInspector>();
            var pattern   = new JoinedSubclassKeyAsRootIdColumnApplier(inspector.Object);

            pattern.Match(null).Should().Be.True();
        }
        public void WhenNoPoidMemberThenDoesNotSet()
        {
            var inspector = new Mock<IDomainInspector>();
            var pattern = new JoinedSubclassKeyAsRootIdColumnApplier(inspector.Object);
            var mapper = new Mock<IJoinedSubclassAttributesMapper>();
            var keyMapper = new Mock<IKeyMapper>();
            mapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>(
                x => x.Invoke(keyMapper.Object));

            pattern.Apply(typeof(Inherited), mapper.Object);

            keyMapper.Verify(km => km.Column(It.IsAny<string>()), Times.Never());
        }
        public void WhenNoPoidMemberThenDoesNotSet()
        {
            var inspector = new Mock <IDomainInspector>();
            var pattern   = new JoinedSubclassKeyAsRootIdColumnApplier(inspector.Object);
            var mapper    = new Mock <IJoinedSubclassAttributesMapper>();
            var keyMapper = new Mock <IKeyMapper>();

            mapper.Setup(x => x.Key(It.IsAny <Action <IKeyMapper> >())).Callback <Action <IKeyMapper> >(
                x => x.Invoke(keyMapper.Object));

            pattern.Apply(typeof(Inherited), mapper.Object);

            keyMapper.Verify(km => km.Column(It.IsAny <string>()), Times.Never());
        }
        public void WhenBaseIsPoIdThenUsePoId()
        {
            var inspector = new Mock<IDomainInspector>();
            inspector.Setup(x => x.IsPersistentId(It.Is<MemberInfo>(mi => mi.Name == "PoId"))).Returns(true);
            var pattern = new JoinedSubclassKeyAsRootIdColumnApplier(inspector.Object);
            var mapper = new Mock<IJoinedSubclassAttributesMapper>();
            var keyMapper = new Mock<IKeyMapper>();
            mapper.Setup(x => x.Key(It.IsAny<Action<IKeyMapper>>())).Callback<Action<IKeyMapper>>(
                x => x.Invoke(keyMapper.Object));

            pattern.Apply(typeof(Inherited), mapper.Object);

            keyMapper.Verify(km => km.Column(It.Is<string>(s => s == "PoId")));
        }
        public void WhenBaseIsPoIdThenUsePoId()
        {
            var inspector = new Mock <IDomainInspector>();

            inspector.Setup(x => x.IsPersistentId(It.Is <MemberInfo>(mi => mi.Name == "PoId"))).Returns(true);
            var pattern   = new JoinedSubclassKeyAsRootIdColumnApplier(inspector.Object);
            var mapper    = new Mock <IJoinedSubclassAttributesMapper>();
            var keyMapper = new Mock <IKeyMapper>();

            mapper.Setup(x => x.Key(It.IsAny <Action <IKeyMapper> >())).Callback <Action <IKeyMapper> >(
                x => x.Invoke(keyMapper.Object));

            pattern.Apply(typeof(Inherited), mapper.Object);

            keyMapper.Verify(km => km.Column(It.Is <string>(s => s == "PoId")));
        }
 public void AlwaysMatch()
 {
     var inspector = new Mock<IDomainInspector>();
     var pattern = new JoinedSubclassKeyAsRootIdColumnApplier(inspector.Object);
     pattern.Match(null).Should().Be.True();
 }