コード例 #1
0
        public void Apply_does_not_invoke_action_when_predicate_false_but_same_type()
        {
            var actionInvoked = false;
            var convention    = new EntityConventionOfType <LocalType1>(
                new Func <Type, bool>[] { t => false },
                c => actionInvoked = true);
            var type          = typeof(LocalType1);
            var configuration = new EntityTypeConfiguration(type);

            convention.Apply(type, () => configuration);

            Assert.False(actionInvoked);
        }
コード例 #2
0
        public void Apply_does_not_invoke_action_when_no_predicates_and_different_type()
        {
            var actionInvoked = false;
            var convention    = new EntityConventionOfType <LocalType1>(
                Enumerable.Empty <Func <Type, bool> >(),
                c => actionInvoked = true);
            var type          = typeof(object);
            var configuration = new EntityTypeConfiguration(type);

            convention.Apply(type, () => configuration);

            Assert.False(actionInvoked);
        }
コード例 #3
0
        public void Apply_does_not_invoke_action_and_short_circuts_when_different_type()
        {
            var predicateInvoked = false;
            var actionInvoked    = false;
            var convention       = new EntityConventionOfType <LocalType1>(
                new Func <Type, bool>[] { t => predicateInvoked = true },
                c => actionInvoked = true);
            var type          = typeof(object);
            var configuration = new EntityTypeConfiguration(type);

            convention.Apply(type, () => configuration);

            Assert.False(predicateInvoked);
            Assert.False(actionInvoked);
        }