Beispiel #1
0
        public void register_should_add_activator_for_command_handler()
        {
            // arrange
            var registry = new CommandRegistrar();
            var test     = new Test();

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

            // assert
            registry.ResolveFor(test).Should().BeAssignableTo <Handler>();
        }
Beispiel #2
0
        public void resolve_for_command_should_return_defined_handlers()
        {
            // arrange
            var services = new Dictionary <Type, object>()
            {
                [typeof(IEnumerable <IHandleCommand <Test> >)] = new[] { new Handler() }
            };
            var registry = new CommandRegistrar(new ServiceProvider(services));
            var doWork   = new Test();

            // act
            var handlers = registry.ResolveFor(doWork);

            // assert
            handlers.Should().BeAssignableTo <Handler>();
        }