diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueMetricsProviderTests.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueMetricsProviderTests.cs index 8b99608e3c848..1dfbf0aa1c17a 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueMetricsProviderTests.cs +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueMetricsProviderTests.cs @@ -33,6 +33,7 @@ public void SetUp() _loggerProvider = new TestLoggerProvider(); _loggerFactory.AddProvider(_loggerProvider); _mockQueue = new Mock(new Uri("https://test.queue.core.windows.net/testqueue"), new QueueClientOptions()); + _mockQueue.Setup(x => x.Name).Returns("testqueue"); _metricsProvider = new QueueMetricsProvider(_mockQueue.Object, _loggerFactory); } @@ -53,7 +54,8 @@ public void OneTimeTearDown() [Test] public async Task GetMetrics_ReturnsExpectedResult() { - var metrics = await _metricsProvider.GetMetricsAsync(); + QueueMetricsProvider _provider = new QueueMetricsProvider(Fixture.Queue, _loggerFactory); + var metrics = await _provider.GetMetricsAsync(); Assert.AreEqual(0, metrics.QueueLength); Assert.AreEqual(TimeSpan.Zero, metrics.QueueTime); @@ -67,14 +69,14 @@ public async Task GetMetrics_ReturnsExpectedResult() await Task.Delay(TimeSpan.FromSeconds(5)); - metrics = await _metricsProvider.GetMetricsAsync(); + metrics = await _provider.GetMetricsAsync(); Assert.AreEqual(5, metrics.QueueLength); Assert.True(metrics.QueueTime.Ticks > 0); Assert.AreNotEqual(default(DateTime), metrics.Timestamp); // verify non-generic interface works as expected - metrics = (QueueTriggerMetrics)(await _metricsProvider.GetMetricsAsync()); + metrics = (QueueTriggerMetrics)(await _provider.GetMetricsAsync()); Assert.AreEqual(5, metrics.QueueLength); } @@ -101,7 +103,7 @@ public async Task GetMetrics_HandlesStorageExceptions() public class TestFixture : IDisposable { - private const string TestQueuePrefix = "queuelistenertests"; + private const string TestQueuePrefix = "metrictests"; public TestFixture() {