Example #1
0
        public void ThrowException_When_InverseProperty_DoesNotExist()
        {
            var blogProperty = typeof(Post4).GetProperty("Blog");

            void action() => AssociatedMemberFinder.GetAssociatedMember(blogProperty);

            Assert.Throws <ForeignKeyMismatchException>(action);
        }
Example #2
0
        public void ThrowException_When_MoreThanOneMember_Refers_AsTheir_InverseProperty()
        {
            var blogProperty = typeof(Post7).GetProperty("Blog");

            void action() => AssociatedMemberFinder.GetAssociatedMember(blogProperty);

            Assert.Throws <ForeignKeyMismatchException>(action);
        }
Example #3
0
        public void ThrowException_When_HasBoth_ForeignKey_And_InverseProperty()
        {
            foreach (var type in new[] { typeof(Post2), typeof(Post22) })
            {
                var blogProperty = type.GetProperty("Blog");
                void action() => AssociatedMemberFinder.GetAssociatedMember(blogProperty);

                Assert.Throws <ForeignKeyMismatchException>(action);
            }
        }
Example #4
0
        public void ThrowException_When_ForeignKey_DoesNotExist()
        {
            foreach (var type in new[] { typeof(Post3), typeof(Post33) })
            {
                var blogProperty = type.GetProperty("Blog");
                void action() => AssociatedMemberFinder.GetAssociatedMember(blogProperty);

                Assert.Throws <ForeignKeyMismatchException>(action);
            }
        }