From aa24c8db94c9fb091bb8ab47db537e473a51d79e Mon Sep 17 00:00:00 2001 From: damon Date: Wed, 29 Nov 2023 20:55:21 +0800 Subject: [PATCH] Prevent run rabbitmq tests on github workflow. --- Tests/Euonia.Bus.InMemory.Tests/Defines.cs | 7 +++++++ Tests/Euonia.Bus.RabbitMq.Tests/Defines.cs | 13 +++++++++++++ Tests/Euonia.Bus.Tests.Shared/Defines.cs | 6 ++++++ .../Euonia.Bus.Tests.Shared.projitems | 1 + Tests/Euonia.Bus.Tests.Shared/ServiceBusTests.cs | 16 ++++++++++++++++ 5 files changed, 43 insertions(+) create mode 100644 Tests/Euonia.Bus.InMemory.Tests/Defines.cs create mode 100644 Tests/Euonia.Bus.RabbitMq.Tests/Defines.cs create mode 100644 Tests/Euonia.Bus.Tests.Shared/Defines.cs diff --git a/Tests/Euonia.Bus.InMemory.Tests/Defines.cs b/Tests/Euonia.Bus.InMemory.Tests/Defines.cs new file mode 100644 index 0000000..20c8292 --- /dev/null +++ b/Tests/Euonia.Bus.InMemory.Tests/Defines.cs @@ -0,0 +1,7 @@ +namespace Nerosoft.Euonia.Bus.Tests; + +internal partial class Defines +{ + public const bool DontRunTests = false; + +} diff --git a/Tests/Euonia.Bus.RabbitMq.Tests/Defines.cs b/Tests/Euonia.Bus.RabbitMq.Tests/Defines.cs new file mode 100644 index 0000000..f69f38c --- /dev/null +++ b/Tests/Euonia.Bus.RabbitMq.Tests/Defines.cs @@ -0,0 +1,13 @@ +namespace Nerosoft.Euonia.Bus.Tests; + +internal partial class Defines +{ + public const bool DontRunTests = +#if DEBUG + false +#else + true +#endif + ; + +} diff --git a/Tests/Euonia.Bus.Tests.Shared/Defines.cs b/Tests/Euonia.Bus.Tests.Shared/Defines.cs new file mode 100644 index 0000000..f4f49a6 --- /dev/null +++ b/Tests/Euonia.Bus.Tests.Shared/Defines.cs @@ -0,0 +1,6 @@ +namespace Nerosoft.Euonia.Bus.Tests; + +internal partial class Defines +{ + +} \ No newline at end of file diff --git a/Tests/Euonia.Bus.Tests.Shared/Euonia.Bus.Tests.Shared.projitems b/Tests/Euonia.Bus.Tests.Shared/Euonia.Bus.Tests.Shared.projitems index 485842f..413a03d 100644 --- a/Tests/Euonia.Bus.Tests.Shared/Euonia.Bus.Tests.Shared.projitems +++ b/Tests/Euonia.Bus.Tests.Shared/Euonia.Bus.Tests.Shared.projitems @@ -12,6 +12,7 @@ + diff --git a/Tests/Euonia.Bus.Tests.Shared/ServiceBusTests.cs b/Tests/Euonia.Bus.Tests.Shared/ServiceBusTests.cs index 6ff5436..0e141b7 100644 --- a/Tests/Euonia.Bus.Tests.Shared/ServiceBusTests.cs +++ b/Tests/Euonia.Bus.Tests.Shared/ServiceBusTests.cs @@ -14,6 +14,10 @@ public ServiceBusTests(IBus bus) [Fact] public async Task TestSendCommand_HasReponse() { + if (Defines.DontRunTests) + { + return; + } var result = await _bus.SendAsync(new UserCreateCommand()); Assert.Equal(1, result); } @@ -21,6 +25,10 @@ public async Task TestSendCommand_HasReponse() [Fact] public async Task TestSendCommand_NoReponse() { + if (Defines.DontRunTests) + { + return; + } await _bus.SendAsync(new UserCreateCommand()); Assert.True(true); } @@ -28,6 +36,10 @@ public async Task TestSendCommand_NoReponse() [Fact] public async Task TestSendCommand_HasReponse_UseSubscribeAttribute() { + if (Defines.DontRunTests) + { + return; + } var result = await _bus.SendAsync(new FooCreateCommand(), new SendOptions { Channel = "foo.create" }); Assert.Equal(1, result); } @@ -35,6 +47,10 @@ public async Task TestSendCommand_HasReponse_UseSubscribeAttribute() [Fact] public async Task TestSendCommand_HasReponse_MessageHasResultInherites() { + if (Defines.DontRunTests) + { + return; + } var result = await _bus.SendAsync(new FooCreateCommand(), new SendOptions { Channel = "foo.create" }); Assert.Equal(1, result); }