public async Task TableEntity_IfBoundUsingRouteParameters_Binds() { // Arrange StorageAccount account = CreateFakeStorageAccount(); CloudQueue triggerQueue = await account.CreateQueueAsync(TriggerQueueName); const string tableName = TableName + "B"; const string partitionKey = PartitionKey + "B"; const string rowKey = RowKey + "B"; TableEntityMessage message = new TableEntityMessage { TableName = tableName, PartitionKey = partitionKey, RowKey = rowKey }; await triggerQueue.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(message))); CloudTable table = await account.CreateTableAsync(tableName); Dictionary <string, EntityProperty> originalProperties = new Dictionary <string, EntityProperty> { { "Value", new EntityProperty(123) } }; table.Insert(new DynamicTableEntity(partitionKey, rowKey, etag: null, properties: originalProperties)); // Act RunTrigger(account, typeof(BindUsingRouteParametersProgram)); // Assert DynamicTableEntity entity = table.Retrieve <DynamicTableEntity>(partitionKey, rowKey); Assert.NotNull(entity); IDictionary <string, EntityProperty> properties = entity.Properties; Assert.NotNull(properties); Assert.True(properties.ContainsKey("Value")); EntityProperty property = properties["Value"]; Assert.NotNull(property); Assert.Equal(EdmType.Int32, property.PropertyType); Assert.True(property.Int32Value.HasValue); Assert.Equal(456, property.Int32Value.Value); }
public static void Run([QueueTrigger(TriggerQueueName)] TableEntityMessage message, [Table("{TableName}", "{PartitionKey}", "{RowKey}")] SdkTableEntity entity) { entity.Value = 456; }