1
0
mirror of synced 2024-06-29 07:17:39 +00:00
Tapeti/Tapeti.Tests/TypeNameRoutingKeyStrategyTests.cs
Mark van Renswoude 74985e45de Fixed all ReSharper issues
Some are silly, like the "member not used" for public interfaces. The comments everywhere are ugly, sorry, but it keeps the possibly important issues visible without a dependency on some ReSharper annotations package.
2018-12-19 20:50:56 +01:00

73 lines
1.7 KiB
C#

using System;
using Tapeti.Default;
using Xunit;
namespace Tapeti.Tests
{
// 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
}