コード例 #1
0
        public void ConfigureOptions_Format_Returns_Expected()
        {
            EventHubOptions options = CreateOptionsFromConfig();

            string          format = options.Format();
            JObject         iObj   = JObject.Parse(format);
            EventHubOptions result = iObj.ToObject <EventHubOptions>();

            Assert.AreEqual(123, result.MaxBatchSize);
            Assert.AreEqual(5, result.BatchCheckpointFrequency);
            Assert.True(result.TrackLastEnqueuedEventProperties);
            Assert.True(result.InvokeFunctionAfterReceiveTimeout);
            Assert.AreEqual(123, result.PrefetchCount);
            Assert.AreEqual(TimeSpan.FromSeconds(33), result.MaximumWaitTime);
            Assert.AreEqual(TimeSpan.FromSeconds(31), result.PartitionOwnershipExpirationInterval);
            Assert.AreEqual(TimeSpan.FromSeconds(21), result.LoadBalancingUpdateInterval);
            Assert.AreEqual(LoadBalancingStrategy.Balanced, result.LoadBalancingStrategy);
            Assert.AreEqual("FromEnqueuedTime", result.InitialOffsetOptions.Type);
            Assert.AreEqual("2020-09-13T12:00Z", result.InitialOffsetOptions.EnqueuedTimeUTC);
            Assert.AreEqual(5, result.RetryOptions.MaximumRetries);
            Assert.AreEqual(TimeSpan.FromSeconds(1), result.RetryOptions.Delay);
            Assert.AreEqual(TimeSpan.FromMinutes(1), result.RetryOptions.MaximumDelay);
            Assert.AreEqual(TimeSpan.FromSeconds(90), result.RetryOptions.TryTimeout);
            Assert.AreEqual(EventHubsRetryMode.Fixed, result.RetryOptions.Mode);
            Assert.AreEqual(EventHubsTransportType.AmqpWebSockets, result.ConnectionOptions.TransportType);
        }
コード例 #2
0
        public void ConfigureOptions_Format_Returns_Expected()
        {
            EventHubOptions options = CreateOptions();

            string          format = options.Format();
            JObject         iObj   = JObject.Parse(format);
            EventHubOptions result = iObj.ToObject <EventHubOptions>();

            Assert.Equal(result.BatchCheckpointFrequency, 5);
            Assert.Equal(result.EventProcessorOptions.EnableReceiverRuntimeMetric, true);
            Assert.Equal(result.EventProcessorOptions.InvokeProcessorAfterReceiveTimeout, true);
            Assert.Equal(result.EventProcessorOptions.MaxBatchSize, 123);
            Assert.Equal(result.EventProcessorOptions.PrefetchCount, 123);
            Assert.Equal(result.EventProcessorOptions.ReceiveTimeout, TimeSpan.FromSeconds(33));
            Assert.Equal(result.PartitionManagerOptions.LeaseDuration, TimeSpan.FromSeconds(31));
            Assert.Equal(result.PartitionManagerOptions.RenewInterval, TimeSpan.FromSeconds(21));
        }
コード例 #3
0
        public void ConfigureOptions_Format_Returns_Expected()
        {
            EventHubOptions options = CreateOptions();

            string          format = options.Format();
            JObject         iObj   = JObject.Parse(format);
            EventHubOptions result = iObj.ToObject <EventHubOptions>();

            Assert.AreEqual(123, options.MaxBatchSize);
            Assert.AreEqual(result.BatchCheckpointFrequency, 5);
            Assert.AreEqual(result.EventProcessorOptions.TrackLastEnqueuedEventProperties, true);
            Assert.AreEqual(result.InvokeProcessorAfterReceiveTimeout, true);
            Assert.AreEqual(result.EventProcessorOptions.PrefetchCount, 123);
            Assert.AreEqual(result.EventProcessorOptions.MaximumWaitTime, TimeSpan.FromSeconds(33));
            Assert.AreEqual(result.EventProcessorOptions.PartitionOwnershipExpirationInterval, TimeSpan.FromSeconds(31));
            Assert.AreEqual(result.EventProcessorOptions.LoadBalancingUpdateInterval, TimeSpan.FromSeconds(21));
        }
コード例 #4
0
        public void ConfigureOptions_Format_Returns_Expected_BackCompat()
        {
            EventHubOptions options = CreateOptionsFromConfigBackCompat();

            string          format = options.Format();
            JObject         iObj   = JObject.Parse(format);
            EventHubOptions result = iObj.ToObject <EventHubOptions>();

            Assert.AreEqual(123, result.MaxBatchSize);
            Assert.AreEqual(5, result.BatchCheckpointFrequency);
            Assert.True(result.TrackLastEnqueuedEventProperties);
            Assert.True(result.InvokeFunctionAfterReceiveTimeout);
            Assert.AreEqual(123, result.PrefetchCount);
            Assert.AreEqual(TimeSpan.FromSeconds(33), result.MaximumWaitTime);
            Assert.AreEqual(TimeSpan.FromSeconds(31), result.PartitionOwnershipExpirationInterval);
            Assert.AreEqual(TimeSpan.FromSeconds(21), result.LoadBalancingUpdateInterval);
            Assert.AreEqual("FromEnqueuedTime", result.InitialOffsetOptions.Type);
            Assert.AreEqual("2020-09-13T12:00Z", result.InitialOffsetOptions.EnqueuedTimeUTC);
        }