public FakeModificationCommand( string name, string schema, ParameterNameGenerator parameterNameGenerator, Func<IProperty, IRelationalPropertyAnnotations> getPropertyExtensions, IReadOnlyList<ColumnModification> columnModifications) : base(name, schema, parameterNameGenerator.GenerateNext, getPropertyExtensions) { ColumnModifications = columnModifications; }
public void CreateStoreCommand_creates_parameters_for_each_ModificationCommand() { var entry = CreateEntry(EntityState.Added, generateKeyValues: true); var property = entry.EntityType.FindProperty("Id"); entry.MarkAsTemporary(property); var batch = new ModificationCommandBatchFake(); var parameterNameGenerator = new ParameterNameGenerator(); batch.AddCommand( new FakeModificationCommand( "T", "S", new ParameterNameGenerator(), p => p.TestProvider(), new List<ColumnModification> { new ColumnModification( entry, property, property.TestProvider(), parameterNameGenerator.GenerateNext, false, true, false, false) })); batch.AddCommand( new FakeModificationCommand( "T", "S", new ParameterNameGenerator(), p => p.TestProvider(), new List<ColumnModification> { new ColumnModification( entry, property, property.TestProvider(), parameterNameGenerator.GenerateNext, false, true, false, false) })); var storeCommand = batch.CreateStoreCommandBase(); Assert.Equal(2, storeCommand.RelationalCommand.Parameters.Count); Assert.Equal("p0", storeCommand.RelationalCommand.Parameters[0].InvariantName); Assert.Equal("p1", storeCommand.RelationalCommand.Parameters[1].InvariantName); Assert.Equal(2, storeCommand.ParameterValues.Count); Assert.Equal(1, storeCommand.ParameterValues["p0"]); Assert.Equal(1, storeCommand.ParameterValues["p1"]); }