public void Configure_should_call_configure_function_configurations()
        {
            var modificationFunctionsConfiguration = new ModificationStoredProceduresConfiguration();

            var mockModificationFunctionConfiguration = new Mock<ModificationStoredProcedureConfiguration>();

            modificationFunctionsConfiguration.Insert(mockModificationFunctionConfiguration.Object);
            modificationFunctionsConfiguration.Update(mockModificationFunctionConfiguration.Object);
            modificationFunctionsConfiguration.Delete(mockModificationFunctionConfiguration.Object);

            var entitySet = new EntitySet();
            entitySet.ChangeEntityContainerWithoutCollectionFixup(new EntityContainer("C", DataSpace.CSpace));

            var storageModificationFunctionMapping
                = new ModificationFunctionMapping(
                    entitySet,
                    new EntityType("E", "N", DataSpace.CSpace),
                    new EdmFunction("F", "N", DataSpace.SSpace),
                    new ModificationFunctionParameterBinding[0],
                    null,
                    null);

            modificationFunctionsConfiguration.Configure(
                new EntityTypeModificationFunctionMapping(
                    new EntityType("E", "N", DataSpace.CSpace),
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping),
                ProviderRegistry.Sql2008_ProviderManifest);

            mockModificationFunctionConfiguration
                .Verify(
                    m => m.Configure(storageModificationFunctionMapping, It.IsAny<DbProviderManifest>()),
                    Times.Exactly(3));
        }
        public void Update_when_config_action_should_call_method_on_internal_configuration()
        {
            var modificationFunctionsConfiguration = new ModificationStoredProceduresConfiguration<Order>();

            ModificationStoredProcedureConfigurationBase configuration = null;

            modificationFunctionsConfiguration.Update(c => { configuration = c; });

            Assert.Same(
                configuration.Configuration,
                modificationFunctionsConfiguration.Configuration.UpdateModificationStoredProcedureConfiguration);
        }
        public void Update_when_config_action_should_call_method_on_internal_configuration()
        {
            var modificationFunctionsConfiguration = new ModificationStoredProceduresConfiguration <Order>();

            ModificationStoredProcedureConfigurationBase configuration = null;

            modificationFunctionsConfiguration.Update(c => { configuration = c; });

            Assert.Same(
                configuration.Configuration,
                modificationFunctionsConfiguration.Configuration.UpdateModificationStoredProcedureConfiguration);
        }
        public void Can_clone_configuration()
        {
            var modificationFunctionsConfiguration = new ModificationStoredProceduresConfiguration();

            var modificationFunctionConfiguration = new ModificationStoredProcedureConfiguration();

            modificationFunctionsConfiguration.Insert(modificationFunctionConfiguration);
            modificationFunctionsConfiguration.Update(modificationFunctionConfiguration);
            modificationFunctionsConfiguration.Delete(modificationFunctionConfiguration);

            var clone = modificationFunctionsConfiguration.Clone();

            Assert.NotSame(modificationFunctionsConfiguration, clone);
            Assert.NotSame(modificationFunctionConfiguration, clone.InsertModificationStoredProcedureConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.UpdateModificationStoredProcedureConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.DeleteModificationStoredProcedureConfiguration);
        }
        public void Can_merge_configurations()
        {
            var modificationFunctionsConfigurationA = new ModificationStoredProceduresConfiguration();
            var modificationFunctionConfiguration   = new ModificationStoredProcedureConfiguration();

            modificationFunctionsConfigurationA.Insert(modificationFunctionConfiguration);
            modificationFunctionsConfigurationA.Update(modificationFunctionConfiguration);
            modificationFunctionsConfigurationA.Delete(modificationFunctionConfiguration);

            var modificationFunctionsConfigurationB = new ModificationStoredProceduresConfiguration();

            modificationFunctionsConfigurationB.Merge(modificationFunctionsConfigurationA, true);

            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.InsertModificationStoredProcedureConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.UpdateModificationStoredProcedureConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.DeleteModificationStoredProcedureConfiguration);
        }
        public void Can_clone_configuration()
        {
            var modificationFunctionsConfiguration = new ModificationStoredProceduresConfiguration();

            var modificationFunctionConfiguration = new ModificationStoredProcedureConfiguration();

            modificationFunctionsConfiguration.Insert(modificationFunctionConfiguration);
            modificationFunctionsConfiguration.Update(modificationFunctionConfiguration);
            modificationFunctionsConfiguration.Delete(modificationFunctionConfiguration);

            var clone = modificationFunctionsConfiguration.Clone();

            Assert.NotSame(modificationFunctionsConfiguration, clone);
            Assert.NotSame(modificationFunctionConfiguration, clone.InsertModificationStoredProcedureConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.UpdateModificationStoredProcedureConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.DeleteModificationStoredProcedureConfiguration);
        }
        public void Can_merge_configurations()
        {
            var modificationFunctionsConfigurationA = new ModificationStoredProceduresConfiguration();
            var modificationFunctionConfiguration = new ModificationStoredProcedureConfiguration();

            modificationFunctionsConfigurationA.Insert(modificationFunctionConfiguration);
            modificationFunctionsConfigurationA.Update(modificationFunctionConfiguration);
            modificationFunctionsConfigurationA.Delete(modificationFunctionConfiguration);

            var modificationFunctionsConfigurationB = new ModificationStoredProceduresConfiguration();

            modificationFunctionsConfigurationB.Merge(modificationFunctionsConfigurationA, true);

            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.InsertModificationStoredProcedureConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.UpdateModificationStoredProcedureConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.DeleteModificationStoredProcedureConfiguration);
        }
        public void Configure_should_call_configure_function_configurations()
        {
            var modificationFunctionsConfiguration = new ModificationStoredProceduresConfiguration();

            var mockModificationFunctionConfiguration = new Mock <ModificationStoredProcedureConfiguration>();

            modificationFunctionsConfiguration.Insert(mockModificationFunctionConfiguration.Object);
            modificationFunctionsConfiguration.Update(mockModificationFunctionConfiguration.Object);
            modificationFunctionsConfiguration.Delete(mockModificationFunctionConfiguration.Object);

            var entitySet = new EntitySet();

            entitySet.ChangeEntityContainerWithoutCollectionFixup(new EntityContainer("C", DataSpace.CSpace));

            var storageModificationFunctionMapping
                = new ModificationFunctionMapping(
                      entitySet,
                      new EntityType("E", "N", DataSpace.CSpace),
                      new EdmFunction("F", "N", DataSpace.SSpace),
                      new ModificationFunctionParameterBinding[0],
                      null,
                      null);

            modificationFunctionsConfiguration.Configure(
                new EntityTypeModificationFunctionMapping(
                    new EntityType("E", "N", DataSpace.CSpace),
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping),
                ProviderRegistry.Sql2008_ProviderManifest);

            mockModificationFunctionConfiguration
            .Verify(
                m => m.Configure(storageModificationFunctionMapping, It.IsAny <DbProviderManifest>()),
                Times.Exactly(3));
        }