コード例 #1
0
        public void HasDeleteAction_sets_the_DeleteAction()
        {
            var configuration =
                new NavigationPropertyConfiguration(
                    typeof(LightweighEntity).GetDeclaredProperty("ValidNavigationProperty"));
            var lightweightConfiguration = new ConventionNavigationPropertyConfiguration(configuration, new ModelConfiguration());

            lightweightConfiguration.HasDeleteAction(OperationAction.Cascade);
            Assert.Equal(OperationAction.Cascade, configuration.DeleteAction);

            configuration.DeleteAction = OperationAction.None;
            lightweightConfiguration.HasDeleteAction(OperationAction.Cascade);
            Assert.Equal(OperationAction.None, configuration.DeleteAction);
        }
コード例 #2
0
        public void Methods_dont_throw_if_configuration_is_null()
        {
            var config = new ConventionNavigationPropertyConfiguration(null, null);

            Assert.Null(config.ClrPropertyInfo);
            config.HasConstraint <IndependentConstraintConfiguration>();
            config.HasDeleteAction(OperationAction.Cascade);
            config.HasInverseEndMultiplicity(RelationshipMultiplicity.ZeroOrOne);
            config.HasInverseNavigationProperty(p => new MockPropertyInfo());
            config.IsDeclaringTypePrincipal(true);
            config.HasRelationshipMultiplicity(RelationshipMultiplicity.ZeroOrOne);
        }