public IEnumerable<SqlCommand> Execute(Row row) { int addressId = Address.Load(row["locationIdentifier"].ToString()).AddressId; var builder = new PropertyTypeCommandBuilder(propertyTypeValueProvider, addressId, row); return builder.GetPropertyTypeCommandsFor<AddressPropertyType>( (id, propertyTypeId, propertyValue) => { Debug.WriteLine("creating command"); var command = new SqlCommand { CommandText = "INSERT INTO AddressProperties(AddressID, AddressPropertyTypeID, PropertyValue) VALUES(@addressId, @addressPropertyTypeId, @propertyValue)" }; command.Parameters.AddWithValue("addressId", id); command.Parameters.AddWithValue("addressPropertyTypeId", propertyTypeId); command.Parameters.AddWithValue("propertyValue", propertyValue); return command; }); }
public void SetUp() { _id = 100; _data = new Row { {"logoName", "value1"}, {"photoName", "value2"}, {"sampleName", "value3"}, }; SUT = new PropertyTypeCommandBuilder(new DefaultPropertyTypeValuesProvider(), _id, _data); }