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

            var mockModificationFunctionConfiguration = new Mock <ModificationFunctionConfiguration>();

            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 StorageModificationFunctionMapping(
                      entitySet,
                      new EntityType("E", "N", DataSpace.CSpace),
                      new EdmFunction("F", "N", DataSpace.SSpace),
                      new StorageModificationFunctionParameterBinding[0],
                      null,
                      null);

            modificationFunctionsConfiguration.Configure(
                new StorageEntityTypeModificationFunctionMapping(
                    new EntityType("E", "N", DataSpace.CSpace),
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping,
                    storageModificationFunctionMapping));

            mockModificationFunctionConfiguration
            .Verify(m => m.Configure(storageModificationFunctionMapping), Times.Exactly(3));
        }
示例#2
0
        public void Configure_should_call_configure_function_configurations()
        {
            var modificationFunctionsConfiguration = new ModificationFunctionsConfiguration();

            var mockModificationFunctionConfiguration = new Mock<ModificationFunctionConfiguration>();

            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 StorageModificationFunctionMapping(
                    entitySet,
                    new EntityType("E", "N", DataSpace.CSpace),
                    new EdmFunction("F", "N", DataSpace.SSpace),
                    new StorageModificationFunctionParameterBinding[0],
                    null,
                    null);

            modificationFunctionsConfiguration.Configure(
                new StorageEntityTypeModificationFunctionMapping(
                    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 ModificationFunctionsConfiguration<Order>();

            ModificationFunctionConfiguration<Order> configuration = null;

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

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

            ModificationFunctionConfiguration <Order> configuration = null;

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

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

            var modificationFunctionConfiguration = new ModificationFunctionConfiguration();

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

            var clone = modificationFunctionsConfiguration.Clone();

            Assert.NotSame(modificationFunctionsConfiguration, clone);
            Assert.NotSame(modificationFunctionConfiguration, clone.InsertModificationFunctionConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.UpdateModificationFunctionConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.DeleteModificationFunctionConfiguration);
        }
        public void Can_merge_configurations()
        {
            var modificationFunctionsConfigurationA = new ModificationFunctionsConfiguration();
            var modificationFunctionConfiguration   = new ModificationFunctionConfiguration();

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

            var modificationFunctionsConfigurationB = new ModificationFunctionsConfiguration();

            modificationFunctionsConfigurationB.Merge(modificationFunctionsConfigurationA, true);

            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.InsertModificationFunctionConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.UpdateModificationFunctionConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.DeleteModificationFunctionConfiguration);
        }
示例#7
0
        public void Can_clone_configuration()
        {
            var modificationFunctionsConfiguration = new ModificationFunctionsConfiguration();

            var modificationFunctionConfiguration = new ModificationFunctionConfiguration();

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

            var clone = modificationFunctionsConfiguration.Clone();

            Assert.NotSame(modificationFunctionsConfiguration, clone);
            Assert.NotSame(modificationFunctionConfiguration, clone.InsertModificationFunctionConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.UpdateModificationFunctionConfiguration);
            Assert.NotSame(modificationFunctionConfiguration, clone.DeleteModificationFunctionConfiguration);
        }
示例#8
0
        public void Can_merge_configurations()
        {
            var modificationFunctionsConfigurationA = new ModificationFunctionsConfiguration();
            var modificationFunctionConfiguration = new ModificationFunctionConfiguration();

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

            var modificationFunctionsConfigurationB = new ModificationFunctionsConfiguration();

            modificationFunctionsConfigurationB.Merge(modificationFunctionsConfigurationA, true);

            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.InsertModificationFunctionConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.UpdateModificationFunctionConfiguration);
            Assert.Same(modificationFunctionConfiguration, modificationFunctionsConfigurationB.DeleteModificationFunctionConfiguration);
        }