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

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

            Assert.Throws <ForeignKeyMismatchException>(action);
        }
Beispiel #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);
        }
Beispiel #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);
            }
        }
Beispiel #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);
            }
        }