public void Apply_invokes_action_when_no_predicates()
        {
            var actionInvoked = false;
            var convention = new EntityConvention(
                Enumerable.Empty<Func<Type, bool>>(),
                c => actionInvoked = true);
            var type = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.True(actionInvoked);
        }
        public void Apply_does_not_invoke_action_when_single_predicate_false()
        {
            var actionInvoked = false;
            var convention = new EntityConvention(
                new Func<Type, bool>[] { t => false },
                c => actionInvoked = true);
            var type = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.False(actionInvoked);
        }
Esempio n. 3
0
        public void Apply_does_not_invoke_action_when_single_predicate_false()
        {
            var actionInvoked = false;
            var convention    = new EntityConvention(
                new Func <Type, bool>[] { t => false },
                c => actionInvoked = true);
            var type          = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.False(actionInvoked);
        }
Esempio n. 4
0
        public void Apply_invokes_action_when_no_predicates()
        {
            var actionInvoked = false;
            var convention    = new EntityConvention(
                Enumerable.Empty <Func <Type, bool> >(),
                c => actionInvoked = true);
            var type          = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.True(actionInvoked);
        }
        public void Apply_invokes_action_when_all_predicates_true()
        {
            var actionInvoked = false;
            var convention = new EntityConvention(
                new Func<Type, bool>[]
                    {
                        t => true,
                        t => true
                    },
                c => actionInvoked = true);
            var type = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.True(actionInvoked);
        }
Esempio n. 6
0
        public void Apply_invokes_action_when_all_predicates_true()
        {
            var actionInvoked = false;
            var convention    = new EntityConvention(
                new Func <Type, bool>[]
            {
                t => true,
                t => true
            },
                c => actionInvoked = true);
            var type          = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.True(actionInvoked);
        }
        public void Apply_does_not_invoke_action_and_short_circuts_when_first_predicate_false()
        {
            var lastPredicateInvoked = false;
            var actionInvoked = false;
            var convention = new EntityConvention(
                new Func<Type, bool>[]
                    {
                        t => false,
                        t => lastPredicateInvoked = true
                    },
                c => actionInvoked = true);
            var type = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

            Assert.False(lastPredicateInvoked);
            Assert.False(actionInvoked);
        }
Esempio n. 8
0
        public void Apply_does_not_invoke_action_and_short_circuts_when_first_predicate_false()
        {
            var lastPredicateInvoked = false;
            var actionInvoked        = false;
            var convention           = new EntityConvention(
                new Func <Type, bool>[]
            {
                t => false,
                t => lastPredicateInvoked = true
            },
                c => actionInvoked = true);
            var type          = new MockType();
            var configuration = new EntityTypeConfiguration(type);

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

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