Skip to content

Commit

Permalink
Add missing tests in MessageHandlerInvokerSubscriberTests
Browse files Browse the repository at this point in the history
  • Loading branch information
ocoanet committed Nov 1, 2023
1 parent 7dbb1d2 commit be0e400
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ public class MessageHandlerInvokerSubscriberTests
{
[TestCase(typeof(DefaultHandler), typeof(Event), SubscriptionMode.Auto)]
[TestCase(typeof(DefaultHandler), typeof(RoutableEvent), SubscriptionMode.Manual)]
[TestCase(typeof(DefaultHandler), typeof(AutoSubscribeRoutableEvent), SubscriptionMode.Auto)]
[TestCase(typeof(ManualHandler), typeof(Event), SubscriptionMode.Manual)]
[TestCase(typeof(ManualHandler), typeof(RoutableEvent), SubscriptionMode.Manual)]
[TestCase(typeof(ManualHandler), typeof(AutoSubscribeRoutableEvent), SubscriptionMode.Manual)]
[TestCase(typeof(AutoHandler), typeof(Event), SubscriptionMode.Auto)]
[TestCase(typeof(AutoHandler), typeof(RoutableEvent), SubscriptionMode.Auto)]
[TestCase(typeof(AutoHandler), typeof(AutoSubscribeRoutableEvent), SubscriptionMode.Auto)]
public void should_get_default_subscription_mode(Type handlerType, Type messageType, SubscriptionMode expectedSubscriptionMode)
{
// Arrange
Expand All @@ -42,11 +45,18 @@ public class RoutableEvent : IEvent
public int Key { get; set; }
}

[Routable(AutoSubscribe = true)]
public class AutoSubscribeRoutableEvent : IEvent
{
[RoutingPosition(1)]
public int Key { get; set; }
}

public class Event : IEvent
{
}

public class DefaultHandler : IMessageHandler<RoutableEvent>, IMessageHandler<Event>
public class DefaultHandler : IMessageHandler<RoutableEvent>, IMessageHandler<Event>, IMessageHandler<AutoSubscribeRoutableEvent>
{
public void Handle(RoutableEvent message)
{
Expand All @@ -55,10 +65,14 @@ public void Handle(RoutableEvent message)
public void Handle(Event message)
{
}

public void Handle(AutoSubscribeRoutableEvent message)
{
}
}

[SubscriptionMode(SubscriptionMode.Manual)]
public class ManualHandler : IMessageHandler<RoutableEvent>, IMessageHandler<Event>
public class ManualHandler : IMessageHandler<RoutableEvent>, IMessageHandler<Event>, IMessageHandler<AutoSubscribeRoutableEvent>
{
public void Handle(RoutableEvent message)
{
Expand All @@ -67,10 +81,14 @@ public void Handle(RoutableEvent message)
public void Handle(Event message)
{
}

public void Handle(AutoSubscribeRoutableEvent message)
{
}
}

[SubscriptionMode(SubscriptionMode.Auto)]
public class AutoHandler : IMessageHandler<RoutableEvent>, IMessageHandler<Event>
public class AutoHandler : IMessageHandler<RoutableEvent>, IMessageHandler<Event>, IMessageHandler<AutoSubscribeRoutableEvent>
{
public void Handle(RoutableEvent message)
{
Expand All @@ -79,6 +97,10 @@ public void Handle(RoutableEvent message)
public void Handle(Event message)
{
}

public void Handle(AutoSubscribeRoutableEvent message)
{
}
}
}
}

0 comments on commit be0e400

Please sign in to comment.