Beispiel #1
0
        public void GetFeedbackValidatesArguments()
        {
            MetricsAdvisorClient client = GetMetricsAdvisorClient();

            Assert.That(() => client.GetFeedbackAsync(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => client.GetFeedbackAsync(""), Throws.InstanceOf <ArgumentException>());

            Assert.That(() => client.GetFeedback(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => client.GetFeedback(""), Throws.InstanceOf <ArgumentException>());
        }
        public void GetFeedbackValidatesArguments()
        {
            MetricsAdvisorClient client = GetMetricsAdvisorClient();

            Assert.That(() => client.GetFeedbackAsync(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => client.GetFeedbackAsync(""), Throws.InstanceOf <ArgumentException>());
            Assert.That(() => client.GetFeedbackAsync("feedbackId"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException)));

            Assert.That(() => client.GetFeedback(null), Throws.InstanceOf <ArgumentNullException>());
            Assert.That(() => client.GetFeedback(""), Throws.InstanceOf <ArgumentException>());
            Assert.That(() => client.GetFeedback("feedbackId"), Throws.InstanceOf <ArgumentException>().With.InnerException.TypeOf(typeof(FormatException)));
        }
        public void GetFeedbackRespectsTheCancellationToken()
        {
            MetricsAdvisorClient client = GetMetricsAdvisorClient();

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

            Assert.That(() => client.GetFeedbackAsync(FakeGuid, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>());
            Assert.That(() => client.GetFeedback(FakeGuid, cancellationSource.Token), Throws.InstanceOf <OperationCanceledException>());
        }