11using System ;
2+ using System . Linq ;
23using SystemsRx . Events ;
34using SystemsRx . Executor . Handlers . Conventional ;
45using SystemsRx . MicroRx . Subjects ;
@@ -13,6 +14,8 @@ namespace SystemsRx.Tests.SystemsRx.Handlers
1314{
1415 public class ReactToEventSystemHandlerTests
1516 {
17+ public interface MultipleOfSameInterface : IReactToEventSystem < int > , IReactToEventSystem < float > { }
18+
1619 [ Fact ]
1720 public void should_correctly_handle_systems ( )
1821 {
@@ -44,15 +47,30 @@ public void should_destroy_and_dispose_system()
4447 }
4548
4649 [ Fact ]
47- public void should_get_event_type_from_system ( )
50+ public void should_get_event_types_from_system ( )
4851 {
4952 var mockEventSystem = Substitute . For < IEventSystem > ( ) ;
5053 var mockSystem = Substitute . For < IReactToEventSystem < int > > ( ) ;
5154
5255 var systemHandler = new ReactToEventSystemHandler ( mockEventSystem ) ;
53- var actualType = systemHandler . GetEventTypeFromSystem ( mockSystem ) ;
56+ var actualTypes = systemHandler . GetEventTypesFromSystem ( mockSystem ) . ToArray ( ) ;
57+
58+ Assert . Equal ( 1 , actualTypes . Length ) ;
59+ Assert . Equal ( typeof ( int ) , actualTypes [ 0 ] ) ;
60+ }
61+
62+ [ Fact ]
63+ public void should_get_multiple_event_types_from_system ( )
64+ {
65+ var mockEventSystem = Substitute . For < IEventSystem > ( ) ;
66+ var mockSystem = Substitute . For < MultipleOfSameInterface > ( ) ;
67+
68+ var systemHandler = new ReactToEventSystemHandler ( mockEventSystem ) ;
69+ var actualTypes = systemHandler . GetEventTypesFromSystem ( mockSystem ) . ToArray ( ) ;
5470
55- Assert . Equal ( typeof ( int ) , actualType ) ;
71+ Assert . Equal ( 2 , actualTypes . Length ) ;
72+ Assert . Contains ( typeof ( int ) , actualTypes ) ;
73+ Assert . Contains ( typeof ( float ) , actualTypes ) ;
5674 }
5775
5876 [ Fact ]
0 commit comments