public void GetDataFeedIngestionProgressValidatesArguments()
        {
            MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient();

            Assert.That(() => adminClient.GetDataFeedIngestionProgressAsync(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => adminClient.GetDataFeedIngestionProgressAsync(""), Throws.InstanceOf <ArgumentException>());
            Assert.That(() => adminClient.GetDataFeedIngestionProgressAsync("dataFeedId"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException)));

            Assert.That(() => adminClient.GetDataFeedIngestionProgress(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => adminClient.GetDataFeedIngestionProgress(""), Throws.InstanceOf <ArgumentException>());
            Assert.That(() => adminClient.GetDataFeedIngestionProgress("dataFeedId"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException)));
        }
        public void GetDataFeedIngestionProgressRespectsTheCancellationToken()
        {
            MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient();

            using var cancellationSource = new CancellationTokenSource();
            cancellationSource.Cancel();

            Assert.That(() => adminClient.GetDataFeedIngestionProgressAsync(FakeGuid, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>());
            Assert.That(() => adminClient.GetDataFeedIngestionProgress(FakeGuid, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>());
        }
        public async Task GetDataFeedIngestionProgress(bool useTokenCredential)
        {
            MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient(useTokenCredential);

            DataFeedIngestionProgress progress = await adminClient.GetDataFeedIngestionProgressAsync(DataFeedId);

            Assert.That(progress, Is.Not.Null);
            Assert.That(progress.LatestActiveTimestamp, Is.Not.Null);
            Assert.That(progress.LatestActiveTimestamp, Is.Not.EqualTo(default(DateTimeOffset)));
            Assert.That(progress.LatestSuccessTimestamp, Is.Not.Null);
            Assert.That(progress.LatestSuccessTimestamp, Is.Not.EqualTo(default(DateTimeOffset)));
        }
Пример #4
0
        public async Task GetDataFeedIngestionProgressAsync()
        {
            string endpoint        = MetricsAdvisorUri;
            string subscriptionKey = MetricsAdvisorSubscriptionKey;
            string apiKey          = MetricsAdvisorApiKey;
            var    credential      = new MetricsAdvisorKeyCredential(subscriptionKey, apiKey);

            var adminClient = new MetricsAdvisorAdministrationClient(new Uri(endpoint), credential);

            string dataFeedId = DataFeedId;

            Response <DataFeedIngestionProgress> response = await adminClient.GetDataFeedIngestionProgressAsync(dataFeedId);

            DataFeedIngestionProgress ingestionProgress = response.Value;

            Console.WriteLine($"Latest active timestamp: {ingestionProgress.LatestActiveTimestamp}");
            Console.WriteLine($"Latest success timestamp: {ingestionProgress.LatestSuccessTimestamp}");
        }