public void ShouldValidateArtifactDuringBuild_returns_true_if_designer_info_option_does_not_contain_ValidateOnBuild_value()
        {
            var modelManager             = new Mock <ModelManager>(null, null).Object;
            var modelProvider            = new Mock <XmlModelProvider>().Object;
            var entityDesignArtifactMock =
                new Mock <EntityDesignArtifact>(modelManager, new Uri("urn:dummy"), modelProvider);

            using (var designerInfoRoot = new EFDesignerInfoRoot(entityDesignArtifactMock.Object, new XElement("_")))
            {
                using (var designerProperty = new DesignerProperty(null, new XElement("_")))
                {
                    var optionsDesignerInfoMock = new Mock <OptionsDesignerInfo>(designerInfoRoot, new XElement("_"));
                    optionsDesignerInfoMock
                    .Setup(o => o.ValidateOnBuild)
                    .Returns(designerProperty);

                    designerInfoRoot
                    .AddDesignerInfo(
                        "Options",
                        optionsDesignerInfoMock.Object);

                    entityDesignArtifactMock
                    .Setup(a => a.DesignerInfo)
                    .Returns(designerInfoRoot);

                    Assert.True(
                        EdmUpdateSolutionEvents.ShouldValidateArtifactDuringBuild(entityDesignArtifactMock.Object));
                }
            }
        }
Example #2
0
        public void CreateUpdateCodeGenStrategyCommand_returns_null_when_attempting_to_update_CodeGenStrategy_to_same_value()
        {
            var modelManager             = new Mock <ModelManager>(null, null).Object;
            var modelProvider            = new Mock <XmlModelProvider>().Object;
            var entityDesignArtifactMock =
                new Mock <EntityDesignArtifact>(modelManager, new Uri("urn:dummy"), modelProvider);

            using (var designerInfoRoot = new EFDesignerInfoRoot(entityDesignArtifactMock.Object, new XElement("_")))
            {
                const string designerPropertyName = "CodeGenerationStrategy";
                designerInfoRoot
                .AddDesignerInfo(
                    "Options",
                    SetupOptionsDesignerInfo(designerPropertyName, "None"));

                entityDesignArtifactMock
                .Setup(a => a.DesignerInfo)
                .Returns(designerInfoRoot);

                Assert.Null(EdmUtils.SetCodeGenStrategyToNoneCommand(entityDesignArtifactMock.Object));
            }
        }
Example #3
0
        CreateUpdateCodeGenStrategyCommand_returns_UpdateDefaultableValueCommand_when_updating_CodeGenStrategy_value_from_empty_string()
        {
            var modelManager             = new Mock <ModelManager>(null, null).Object;
            var modelProvider            = new Mock <XmlModelProvider>().Object;
            var entityDesignArtifactMock =
                new Mock <EntityDesignArtifact>(modelManager, new Uri("urn:dummy"), modelProvider);

            using (var designerInfoRoot = new EFDesignerInfoRoot(entityDesignArtifactMock.Object, new XElement("_")))
            {
                const string designerPropertyName = "CodeGenerationStrategy";
                designerInfoRoot
                .AddDesignerInfo(
                    "Options",
                    SetupOptionsDesignerInfo(designerPropertyName, string.Empty));

                entityDesignArtifactMock
                .Setup(a => a.DesignerInfo)
                .Returns(designerInfoRoot);

                Assert.IsType <UpdateDefaultableValueCommand <string> >(
                    EdmUtils.SetCodeGenStrategyToNoneCommand(entityDesignArtifactMock.Object));
            }
        }