public void PopulateParameters_does_not_create_parameter_for_read_ModificationCommand()
        {
            var stateEntry    = CreateStateEntry(EntityState.Added, ValueGenerationOnSave.WhenInserting);
            var property      = stateEntry.EntityType.GetProperty("Id");
            var batch         = new ModificationCommandBatchFake();
            var dbCommandMock = CreateDbCommandMock();

            batch.PopulateParametersBase(dbCommandMock.Object,
                                         new ColumnModification(
                                             stateEntry,
                                             property,
                                             new ParameterNameGenerator(), true, false, false, false),
                                         new RelationalTypeMapper());

            Assert.Equal(0, dbCommandMock.Object.Parameters.Count);
        }
        public void PopulateParameters_creates_parameter_for_write_and_condition_ModificationCommand()
        {
            var stateEntry = CreateStateEntry(EntityState.Added, generateKeyValues: true);
            var property   = stateEntry.EntityType.GetProperty("Id");

            stateEntry.MarkAsTemporary(property);
            var batch         = new ModificationCommandBatchFake();
            var dbCommandMock = CreateDbCommandMock();

            batch.PopulateParametersBase(dbCommandMock.Object,
                                         new ColumnModification(
                                             stateEntry,
                                             property,
                                             property.Relational(),
                                             new ParameterNameGenerator(), false, true, false, true),
                                         new RelationalTypeMapper());

            Assert.Equal(2, dbCommandMock.Object.Parameters.Count);
        }
Beispiel #3
0
        public void PopulateParameters_does_not_create_parameter_for_read_ModificationCommand()
        {
            var entry    = CreateEntry(EntityState.Added, generateKeyValues: true);
            var property = entry.EntityType.GetProperty("Id");

            entry.MarkAsTemporary(property);
            var batch          = new ModificationCommandBatchFake();
            var commandBuilder = new CommandBuilderFake();

            batch.PopulateParametersBase(
                commandBuilder,
                new ColumnModification(
                    entry,
                    property,
                    property.TestProvider(),
                    new ParameterNameGenerator(),
                    true, false, false, false));

            Assert.Equal(0, commandBuilder.AddParameterCalls);
        }
Beispiel #4
0
        public void PopulateParameters_does_not_create_parameter_for_read_ModificationCommand()
        {
            var entry    = CreateEntry(EntityState.Added, generateKeyValues: true);
            var property = entry.EntityType.GetProperty("Id");

            entry.MarkAsTemporary(property);
            var batch         = new ModificationCommandBatchFake();
            var dbCommandMock = CreateDbCommandMock();

            batch.PopulateParametersBase(dbCommandMock.Object,
                                         new ColumnModification(
                                             entry,
                                             property,
                                             property.Relational(),
                                             new ParameterNameGenerator(),
                                             true, false, false, false),
                                         new ConcreteTypeMapper());

            Assert.Equal(0, dbCommandMock.Object.Parameters.Count);
        }
        public void PopulateParameters_creates_parameter_for_write_ModificationCommand_with_non_null_parameter_name()
        {
            var stateEntry    = CreateStateEntry(EntityState.Added, ValueGenerationOnSave.WhenInserting);
            var property      = stateEntry.EntityType.GetProperty("Id");
            var batch         = new ModificationCommandBatchFake();
            var dbCommandMock = CreateDbCommandMock();

            batch.PopulateParametersBase(dbCommandMock.Object,
                                         new ColumnModification(
                                             stateEntry,
                                             property,
                                             new ParameterNameGenerator(),
                                             isRead: false,
                                             isWrite: true,
                                             isKey: false,
                                             isCondition: false),
                                         new RelationalTypeMapper());

            Assert.Equal(1, dbCommandMock.Object.Parameters.Count);
        }
        public void PopulateParameters_does_not_create_parameter_for_read_ModificationCommand()
        {
            var entry = CreateEntry(EntityState.Added, generateKeyValues: true);
            var property = entry.EntityType.GetProperty("Id");
            entry.MarkAsTemporary(property);
            var batch = new ModificationCommandBatchFake();
            var dbCommandMock = CreateDbCommandMock();

            batch.PopulateParametersBase(dbCommandMock.Object,
                new ColumnModification(
                    entry,
                    property,
                    property.TestProvider(),
                    new ParameterNameGenerator(),
                    true, false, false, false),
                new ConcreteTypeMapper());

            Assert.Equal(0, dbCommandMock.Object.Parameters.Count);
        }
        public void PopulateParameters_does_not_create_parameter_for_read_ModificationCommand()
        {
            var entry = CreateEntry(EntityState.Added, generateKeyValues: true);
            var property = entry.EntityType.GetProperty("Id");
            entry.MarkAsTemporary(property);
            var batch = new ModificationCommandBatchFake();
            var commandBuilder = new CommandBuilderFake();

            batch.PopulateParametersBase(
                commandBuilder,
                new ColumnModification(
                    entry,
                    property,
                    property.TestProvider(),
                    new ParameterNameGenerator(),
                    true, false, false, false));

            Assert.Equal(0, commandBuilder.AddParameterCalls);
        }