public void CreateDataFeedValidatesArguments() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); var name = "dataFeedName"; var dataSource = new AzureTableDataFeedSource("connectionString", "table", "query"); var granularity = new DataFeedGranularity(DataFeedGranularityType.Daily); var schema = new DataFeedSchema() { MetricColumns = { new("metricName") } }; var ingestionSettings = new DataFeedIngestionSettings(DateTimeOffset.UtcNow); var dataFeed = new DataFeed() { Name = null, DataSource = dataSource, Granularity = granularity, Schema = schema, IngestionSettings = ingestionSettings }; Assert.That(() => adminClient.CreateDataFeedAsync(null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeed(null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeedAsync(dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeed(dataFeed), Throws.InstanceOf <ArgumentNullException>()); dataFeed.Name = ""; Assert.That(() => adminClient.CreateDataFeedAsync(dataFeed), Throws.InstanceOf <ArgumentException>()); Assert.That(() => adminClient.CreateDataFeed(dataFeed), Throws.InstanceOf <ArgumentException>()); dataFeed.Name = name; dataFeed.DataSource = null; Assert.That(() => adminClient.CreateDataFeedAsync(dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeed(dataFeed), Throws.InstanceOf <ArgumentNullException>()); dataFeed.DataSource = dataSource; dataFeed.Granularity = null; Assert.That(() => adminClient.CreateDataFeedAsync(dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeed(dataFeed), Throws.InstanceOf <ArgumentNullException>()); dataFeed.Granularity = granularity; dataFeed.Schema = null; Assert.That(() => adminClient.CreateDataFeedAsync(dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeed(dataFeed), Throws.InstanceOf <ArgumentNullException>()); dataFeed.Schema = schema; dataFeed.IngestionSettings = null; Assert.That(() => adminClient.CreateDataFeedAsync(dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.CreateDataFeed(dataFeed), Throws.InstanceOf <ArgumentNullException>()); }
public void CreateDataFeedRespectsTheCancellationToken() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); var dataFeed = new DataFeed() { Name = "dataFeedName", DataSource = new AzureTableDataFeedSource("connectionString", "table", "query"), Granularity = new DataFeedGranularity(DataFeedGranularityType.Daily), Schema = new DataFeedSchema() { MetricColumns = { new("metricName") } },
public void UpdateDataFeedRespectsTheCancellationToken() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); var dataSource = new AzureTableDataFeedSource("connectionString", "table", "query"); var granularity = new DataFeedGranularity(DataFeedGranularityType.Daily); var schema = new DataFeedSchema(new List <DataFeedMetric>() { new DataFeedMetric("metricName") }); var ingestionSettings = new DataFeedIngestionSettings(DateTimeOffset.UtcNow); var dataFeed = new DataFeed("dataFeedName", dataSource, granularity, schema, ingestionSettings); using var cancellationSource = new CancellationTokenSource(); cancellationSource.Cancel(); Assert.That(() => adminClient.UpdateDataFeedAsync(FakeGuid, dataFeed, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>()); Assert.That(() => adminClient.UpdateDataFeed(FakeGuid, dataFeed, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>()); }
public void UpdateDataFeedValidatesArguments() { MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(); var dataSource = new AzureTableDataFeedSource("connectionString", "table", "query"); var granularity = new DataFeedGranularity(DataFeedGranularityType.Daily); var schema = new DataFeedSchema(new List <DataFeedMetric>() { new DataFeedMetric("metricName") }); var ingestionSettings = new DataFeedIngestionSettings(DateTimeOffset.UtcNow); var dataFeed = new DataFeed("dataFeedName", dataSource, granularity, schema, ingestionSettings); Assert.That(() => adminClient.UpdateDataFeedAsync(null, dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.UpdateDataFeedAsync("", dataFeed), Throws.InstanceOf <ArgumentException>()); Assert.That(() => adminClient.UpdateDataFeedAsync("dataFeedId", dataFeed), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException))); Assert.That(() => adminClient.UpdateDataFeedAsync(FakeGuid, null), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.UpdateDataFeed(null, dataFeed), Throws.InstanceOf <ArgumentNullException>()); Assert.That(() => adminClient.UpdateDataFeed("", dataFeed), Throws.InstanceOf <ArgumentException>()); Assert.That(() => adminClient.UpdateDataFeed("dataFeedId", dataFeed), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException))); Assert.That(() => adminClient.UpdateDataFeed(FakeGuid, null), Throws.InstanceOf <ArgumentNullException>()); }