From 5612a1bcd312f83c22b2a7fe0fb78e5e4885789e Mon Sep 17 00:00:00 2001 From: David Revoledo Date: Thu, 18 Oct 2018 15:44:47 -0300 Subject: [PATCH] Remove unit test and rename FirstPlugin --- .../Client/PluginTests.cs | 49 +++---------------- 1 file changed, 6 insertions(+), 43 deletions(-) diff --git a/test/Microsoft.Azure.EventHubs.Tests/Client/PluginTests.cs b/test/Microsoft.Azure.EventHubs.Tests/Client/PluginTests.cs index 2113bc8..a5d5222 100644 --- a/test/Microsoft.Azure.EventHubs.Tests/Client/PluginTests.cs +++ b/test/Microsoft.Azure.EventHubs.Tests/Client/PluginTests.cs @@ -18,8 +18,8 @@ public class PluginTests Task Registering_plugin_multiple_times_should_throw() { this.EventHubClient = EventHubClient.CreateFromConnectionString(TestUtility.EventHubsConnectionString); - var firstPlugin = new FirstSendPlugin(); - var secondPlugin = new FirstSendPlugin(); + var firstPlugin = new SamplePlugin(); + var secondPlugin = new SamplePlugin(); this.EventHubClient.RegisterPlugin(firstPlugin); Assert.Throws(() => EventHubClient.RegisterPlugin(secondPlugin)); @@ -31,7 +31,7 @@ Task Registering_plugin_multiple_times_should_throw() Task Unregistering_plugin_should_complete_with_plugin_set() { this.EventHubClient = EventHubClient.CreateFromConnectionString(TestUtility.EventHubsConnectionString); - var firstPlugin = new FirstSendPlugin(); + var firstPlugin = new SamplePlugin(); this.EventHubClient.RegisterPlugin(firstPlugin); this.EventHubClient.UnregisterPlugin(firstPlugin.Name); @@ -47,31 +47,6 @@ Task Unregistering_plugin_should_complete_without_plugin_set() return this.EventHubClient.CloseAsync(); } - [Fact] - [DisplayTestMethodName] - async Task Multiple_plugins_should_run_in_order() - { - this.EventHubClient = EventHubClient.CreateFromConnectionString(TestUtility.EventHubsConnectionString); - - try - { - var firstPlugin = new FirstSendPlugin(); - var secondPlugin = new SecondSendPlugin(); - - this.EventHubClient.RegisterPlugin(firstPlugin); - this.EventHubClient.RegisterPlugin(secondPlugin); - - var testEvent = new EventData(Encoding.UTF8.GetBytes("Test message")); - await this.EventHubClient.SendAsync(testEvent); - - // BeforeEventSend for Plugin2 should break is 1 was not called - } - finally - { - await this.EventHubClient.CloseAsync(); - } - } - [Fact] [DisplayTestMethodName] async Task Plugin_without_ShouldContinueOnException_should_throw() @@ -112,9 +87,9 @@ async Task Plugin_with_ShouldContinueOnException_should_continue() } } - internal class FirstSendPlugin : EventHubsPlugin + internal class SamplePlugin : EventHubsPlugin { - public override string Name => nameof(FirstSendPlugin); + public override string Name => nameof(SamplePlugin); public override Task BeforeEventSend(EventData eventData) { @@ -123,18 +98,6 @@ public override Task BeforeEventSend(EventData eventData) } } - internal class SecondSendPlugin : EventHubsPlugin - { - public override string Name => nameof(SecondSendPlugin); - - public override Task BeforeEventSend(EventData eventData) - { - Assert.True((bool)eventData.Properties["FirstSendPlugin"]); - eventData.Properties.Add("SecondSendPlugin", true); - return Task.FromResult(eventData); - } - } - internal class ExceptionPlugin : EventHubsPlugin { public override string Name => nameof(ExceptionPlugin); @@ -156,4 +119,4 @@ public override Task BeforeEventSend(EventData eventData) throw new NotImplementedException(); } } -} +} \ No newline at end of file