Exemplo n.º 1
0
        public void DeleteDataFeedValidatesArguments()
        {
            MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient();

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

            Assert.That(() => adminClient.DeleteDataFeed(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => adminClient.DeleteDataFeed(""), Throws.InstanceOf <ArgumentException>());
            Assert.That(() => adminClient.DeleteDataFeed("dataFeedId"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException)));
        }
Exemplo n.º 2
0
        public void DeleteDataFeedRespectsTheCancellationToken()
        {
            MetricsAdvisorAdministrationClient adminClient = GetMetricsAdvisorAdministrationClient();

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

            Assert.That(() => adminClient.DeleteDataFeedAsync(FakeGuid, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>());
            Assert.That(() => adminClient.DeleteDataFeed(FakeGuid, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>());
        }