Exemplo n.º 1
0
        public async Task Should_throw_argument_exception_for_publish_when_notification_is_null()
        {
            var container = new Container(cfg =>
            {
                cfg.Scan(scanner =>
                {
                    scanner.AssemblyContainingType(typeof(NullPinged));
                    scanner.IncludeNamespaceContainingType <Ping>();
                    scanner.WithDefaultConventions();
                });
            });

            var mediator = new Mediator(container.GetInstance);

            NullPinged notification = null;

            await Should.ThrowAsync <ArgumentNullException>(async() => await mediator.Publish(notification));
        }
Exemplo n.º 2
0
        public async Task Should_throw_argument_exception_for_publish_when_request_is_null()
        {
            var container = new Container(cfg =>
            {
                cfg.Scan(scanner =>
                {
                    scanner.AssemblyContainingType(typeof(NullPinged));
                    scanner.IncludeNamespaceContainingType <Ping>();
                    scanner.WithDefaultConventions();
                    scanner.AddAllTypesOf(typeof(IRequestHandler <,>));
                });
                cfg.For <ServiceFactory>().Use <ServiceFactory>(ctx => t => ctx.GetInstance(t));
                cfg.For <IMediator>().Use <Mediator>();
            });
            var mediator = container.GetInstance <IMediator>();

            NullPinged notification = null;

            await Should.ThrowAsync <ArgumentNullException>(async() => await mediator.Publish(notification));
        }
Exemplo n.º 3
0
            public async Task Should_throw_argument_exception_for_publish_when_request_is_null()
            {
                NullPinged notification = null;

                await Should.ThrowAsync <ArgumentNullException>(async() => await Mediator.Publish(notification));
            }