public async Task BasicValidation() { var mockClient = new MockEventHubClient(new EventHubsConnectionStringBuilder(connectionString)); var partitionReceiver = mockClient.CreateReceiver("consumerGroup", targetPartitionId, EventPosition.FromStart(), new ReceiverOptions { EnableReceiverRuntimeMetric = true }); var partitionSender = mockClient.CreateEventSender(targetPartitionId); await partitionSender.SendAsync(new EventData[] { new EventData(Encoding.UTF8.GetBytes("foo")) }, targetPartitionId); // Get the partition runtime info so we can compare with runtime metrics. var pInfo = await mockClient.GetPartitionRuntimeInformationAsync(targetPartitionId); await ValidateEnabledBehavior(partitionReceiver, pInfo); }
public async Task ClientSettingInherited() { var mockClient = new MockEventHubClient(new EventHubsConnectionStringBuilder(connectionString)); // Enable runtime metrics on the client. mockClient.EnableReceiverRuntimeMetric = true; var partitionReceiver1 = mockClient.CreateReceiver("consumerGroup", targetPartitionId, EventPosition.FromStart()); var partitionReceiver2 = mockClient.CreateReceiver("consumerGroup", targetPartitionId, EventPosition.FromStart()); var partitionSender = mockClient.CreateEventSender(targetPartitionId); await partitionSender.SendAsync( Enumerable.Range(1, 10) .Select(number => new EventData(Encoding.UTF8.GetBytes(number.ToString())) ), targetPartitionId); // Get the partition runtime info so we can compare with runtime metrics. var pInfo = await mockClient.GetPartitionRuntimeInformationAsync(targetPartitionId); await ValidateEnabledBehavior(partitionReceiver1, pInfo); await ValidateEnabledBehavior(partitionReceiver2, pInfo); }