public void GetDimensionValuesValidatesArguments() { MetricsAdvisorClient client = GetMetricsAdvisorClient(); Assert.That(() => client.GetDimensionValuesAsync(null, "dimensionName"), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValuesAsync("", "dimensionName"), Throws.InstanceOf <ArgumentException>()); Assert.That(() => client.GetDimensionValuesAsync("metricId", null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValuesAsync("metricId", ""), Throws.InstanceOf <ArgumentException>()); Assert.That(() => client.GetDimensionValues(null, "dimensionName"), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValues("", "dimensionName"), Throws.InstanceOf <ArgumentException>()); Assert.That(() => client.GetDimensionValues("metricId", null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValues("metricId", ""), Throws.InstanceOf <ArgumentException>()); }
public void GetDimensionValuesValidatesArguments() { MetricsAdvisorClient client = GetMetricsAdvisorClient(); Assert.That(() => client.GetDimensionValuesAsync(null, "dimensionName"), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValuesAsync("", "dimensionName"), Throws.InstanceOf <ArgumentException>()); Assert.That(() => client.GetDimensionValuesAsync("metricId", "dimensionName"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException))); Assert.That(() => client.GetDimensionValuesAsync(FakeGuid, null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValuesAsync(FakeGuid, ""), Throws.InstanceOf <ArgumentException>()); Assert.That(() => client.GetDimensionValues(null, "dimensionName"), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValues("", "dimensionName"), Throws.InstanceOf <ArgumentException>()); Assert.That(() => client.GetDimensionValues("metricId", "dimensionName"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException))); Assert.That(() => client.GetDimensionValues(FakeGuid, null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => client.GetDimensionValues(FakeGuid, ""), Throws.InstanceOf <ArgumentException>()); }
public void GetDimensionValuesRespectsTheCancellationToken() { MetricsAdvisorClient client = GetMetricsAdvisorClient(); using var cancellationSource = new CancellationTokenSource(); cancellationSource.Cancel(); IAsyncEnumerator <string> asyncEnumerator = client.GetDimensionValuesAsync(FakeGuid, "dimensionName", cancellationToken: cancellationSource.Token).GetAsyncEnumerator(); Assert.That(async() => await asyncEnumerator.MoveNextAsync(), Throws.InstanceOf <OperationCanceledException>()); IEnumerator <string> enumerator = client.GetDimensionValues(FakeGuid, "dimensionName", cancellationToken: cancellationSource.Token).GetEnumerator(); Assert.That(() => enumerator.MoveNext(), Throws.InstanceOf <OperationCanceledException>()); }