Beispiel #1
0
        Task Unregistering_plugin_should_complete_with_plugin_set()
        {
            this.EventHubClient = EventHubClient.CreateFromConnectionString(TestUtility.EventHubsConnectionString);
            var firstPlugin = new SamplePlugin();

            this.EventHubClient.RegisterPlugin(firstPlugin);
            this.EventHubClient.UnregisterPlugin(firstPlugin.Name);
            return(this.EventHubClient.CloseAsync());
        }
Beispiel #2
0
        Task Registering_plugin_multiple_times_should_throw()
        {
            this.EventHubClient = EventHubClient.CreateFromConnectionString(TestUtility.EventHubsConnectionString);
            var firstPlugin  = new SamplePlugin();
            var secondPlugin = new SamplePlugin();

            this.EventHubClient.RegisterPlugin(firstPlugin);
            Assert.Throws <ArgumentException>(() => EventHubClient.RegisterPlugin(secondPlugin));
            return(EventHubClient.CloseAsync());
        }
Beispiel #3
0
        public async Task Unregistering_plugin_should_complete_with_plugin_set()
        {
            await using (var scope = await EventHubScope.CreateAsync(1))
            {
                var connectionString = TestUtility.BuildEventHubsConnectionString(scope.EventHubName);
                this.EventHubClient = EventHubClient.CreateFromConnectionString(connectionString);
                var firstPlugin = new SamplePlugin();

                this.EventHubClient.RegisterPlugin(firstPlugin);
                this.EventHubClient.UnregisterPlugin(firstPlugin.Name);
                await this.EventHubClient.CloseAsync();
            }
        }
Beispiel #4
0
        public async Task Registering_plugin_multiple_times_should_throw()
        {
            await using (var scope = await EventHubScope.CreateAsync(1))
            {
                var connectionString = TestUtility.BuildEventHubsConnectionString(scope.EventHubName);
                this.EventHubClient = EventHubClient.CreateFromConnectionString(connectionString);
                var firstPlugin  = new SamplePlugin();
                var secondPlugin = new SamplePlugin();

                this.EventHubClient.RegisterPlugin(firstPlugin);
                Assert.Throws <ArgumentException>(() => EventHubClient.RegisterPlugin(secondPlugin));
                await EventHubClient.CloseAsync();
            }
        }