1
0
mirror of synced 2024-07-01 08:17:39 +00:00
Tapeti/Tapeti.Tests/Default/TypeNameRoutingKeyStrategyTests.cs
Mark van Renswoude f8fca5879c [ci skip] Major refactoring for 2.0
- Compiles, but that's about it. Plenty of ToDo's left before it will run. Beware, ye who enter here.
- Cleanup of the internals, with the aim to keep the interface to application code compatible
- Added the ability to declare durable queues on startup and update the bindings
- Possibly fixed an issue with publish timeouts being logged after a reconnect
2019-08-13 20:30:04 +02:00

73 lines
1.7 KiB
C#

using System;
using Tapeti.Default;
using Xunit;
namespace Tapeti.Tests.Default
{
// ReSharper disable InconsistentNaming
public class TypeNameRoutingKeyStrategyTests
{
private class Example { }
[Fact]
public void Singleword()
{
AssertRoutingKey("example", typeof(Example));
}
private class ExampleMessage { }
[Fact]
public void SinglewordMessagePostfix()
{
AssertRoutingKey("example", typeof(ExampleMessage));
}
private class ExampleMultiWord { }
[Fact]
public void Multiword()
{
AssertRoutingKey("example.multi.word", typeof(ExampleMultiWord));
}
private class ExampleMultiWordMessage { }
[Fact]
public void MultiwordMessagePostfix()
{
AssertRoutingKey("example.multi.word", typeof(ExampleMultiWordMessage));
}
private class ACRTestMessage { }
[Fact]
public void Acronym()
{
AssertRoutingKey("acr.test", typeof(ACRTestMessage));
}
private class ACRTestMIXEDCaseMESSAGE { }
[Fact]
public void MixedCasing()
{
AssertRoutingKey("acr.test.mixed.case", typeof(ACRTestMIXEDCaseMESSAGE));
}
private void AssertRoutingKey(string expected, Type messageType)
{
if (expected == null) throw new ArgumentNullException(nameof(expected));
if (messageType == null) throw new ArgumentNullException(nameof(messageType));
Assert.Equal(expected, new TypeNameRoutingKeyStrategy().GetRoutingKey(messageType));
}
}
// ReSharper restore InconsistentNaming
}