Exemplo n.º 1
0
        public void register_should_add_activator_for_event_receiver()
        {
            // arrange
            var registry = new EventRegistrar();
            var tested   = new Tested();

            // act
            registry.Register(() => new Receiver());

            // assert
            registry.ResolveFor(tested).Should().ContainItemsAssignableTo <Receiver>();
        }
Exemplo n.º 2
0
        public void resolve_for_event_should_return_defined_receivers()
        {
            // arrange
            var services = new Dictionary <Type, object>()
            {
                [typeof(IEnumerable <IReceiveEvent <Tested> >)] = new[] { new Receiver() }
            };
            var registry = new EventRegistrar(new ServiceProvider(services));
            var tested   = new Tested();

            // act
            var receivers = registry.ResolveFor(tested);

            // assert
            receivers.Should().ContainItemsAssignableTo <Receiver>();
        }