public void Invokes_action_when_predicate_true_and_same_type()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention <LocalType1>(
                    new Func <Type, bool>[] { t => true },
                    c => actionInvoked = true);
                var type          = typeof(LocalType1);
                var configuration = new ModelConfiguration();

                convention.Apply(type, configuration);

                Assert.True(actionInvoked);
            }
Exemple #2
0
            public void Invokes_action_when_no_predicates()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention(
                    Enumerable.Empty <Func <Type, bool> >(),
                    c => actionInvoked = true);
                var type          = new MockType();
                var configuration = new ModelConfiguration();

                convention.Apply(type, configuration);

                Assert.True(actionInvoked);
            }
            public void Does_not_invoke_action_when_no_predicates_and_different_type()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention <LocalType1>(
                    Enumerable.Empty <Func <Type, bool> >(),
                    c => actionInvoked = true);
                var type          = typeof(object);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.False(actionInvoked);
            }
Exemple #4
0
            public void Invokes_action_when_single_predicate_true()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention(
                    new Func <Type, bool>[] { t => true },
                    c => actionInvoked = true);
                var type          = new MockType();
                var configuration = new ModelConfiguration();

                convention.Apply(type, configuration);

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

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

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

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

                Assert.False(actionInvoked);
            }
            public void Invokes_action_when_no_predicates_and_derived_type()
            {
                var actionInvoked = false;
                var convention = new TypeConvention<LocalType1>(
                    Enumerable.Empty<Func<Type, bool>>(),
                    c => actionInvoked = true);
                var type = typeof(LocalType2);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.True(actionInvoked);
            }
            public void Does_not_invoke_action_when_no_predicates_and_different_type()
            {
                var actionInvoked = false;
                var convention = new TypeConvention<LocalType1>(
                    Enumerable.Empty<Func<Type, bool>>(),
                    c => actionInvoked = true);
                var type = typeof(object);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.False(actionInvoked);
            }
            public void Invokes_action_when_predicate_true_and_same_type()
            {
                var actionInvoked = false;
                var convention = new TypeConvention<LocalType1>(
                    new Func<Type, bool>[] { t => true },
                    c => actionInvoked = true);
                var type = typeof(LocalType1);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.True(actionInvoked);
            }
Exemple #10
0
            public void Does_not_invoke_action_when_single_predicate_false()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention(
                    new Func <Type, bool>[] { t => false },
                    c => actionInvoked = true);
                var type          = new MockType();
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.False(actionInvoked);
            }
            public void Invokes_action_when_no_predicates_and_derived_type()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention <LocalType1>(
                    Enumerable.Empty <Func <Type, bool> >(),
                    c => actionInvoked = true);
                var type          = typeof(LocalType2);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.True(actionInvoked);
            }
            public void Does_not_invoke_action_and_short_circuts_when_different_type()
            {
                var predicateInvoked = false;
                var actionInvoked = false;
                var convention = new TypeConvention<LocalType1>(
                    new Func<Type, bool>[] { t => predicateInvoked = true },
                    c => actionInvoked = true);
                var type = typeof(object);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.False(predicateInvoked);
                Assert.False(actionInvoked);
            }
            public void Does_not_invoke_action_and_short_circuts_when_different_type()
            {
                var predicateInvoked = false;
                var actionInvoked    = false;
                var convention       = new TypeConvention <LocalType1>(
                    new Func <Type, bool>[] { t => predicateInvoked = true },
                    c => actionInvoked = true);
                var type          = typeof(object);
                var configuration = new EntityTypeConfiguration(type);

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

                Assert.False(predicateInvoked);
                Assert.False(actionInvoked);
            }
Exemple #14
0
            public void Invokes_action_when_all_predicates_true()
            {
                var actionInvoked = false;
                var convention    = new TypeConvention(
                    new Func <Type, bool>[]
                {
                    t => true,
                    t => true
                },
                    c => actionInvoked = true);
                var type          = new MockType();
                var configuration = new EntityTypeConfiguration(type);

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

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

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

                Assert.True(actionInvoked);
            }
Exemple #16
0
            public void Does_not_invoke_action_and_short_circuts_when_first_predicate_false()
            {
                var lastPredicateInvoked = false;
                var actionInvoked        = false;
                var convention           = new TypeConvention(
                    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, new ModelConfiguration());

                Assert.False(lastPredicateInvoked);
                Assert.False(actionInvoked);
            }
            public void Invokes_action_when_no_predicates()
            {
                var actionInvoked = false;
                var convention = new TypeConvention(
                    Enumerable.Empty<Func<Type, bool>>(),
                    c => actionInvoked = true);
                var type = new MockType();
                var configuration = new ModelConfiguration();

                convention.Apply(type, configuration);

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

                convention.Apply(type, configuration);

                Assert.True(actionInvoked);
            }
            public void Does_not_invoke_action_when_predicate_false_but_same_type()
            {
                var actionInvoked = false;
                var convention = new TypeConvention<LocalType1>(
                    new Func<Type, bool>[] { t => false },
                    c => actionInvoked = true);
                var type = typeof(LocalType1);
                var configuration = new ModelConfiguration();

                convention.Apply(type, configuration);

                Assert.False(actionInvoked);
            }
            public void Does_not_invoke_action_and_short_circuts_when_first_predicate_false()
            {
                var lastPredicateInvoked = false;
                var actionInvoked = false;
                var convention = new TypeConvention(
                    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, new ModelConfiguration());

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