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

            var mediator = new Mediator(container.GetInstance);

            VoidNullPing request = null;

            await Should.ThrowAsync <ArgumentNullException>(async() => await mediator.Send(request));
        }
Exemplo n.º 2
0
        public async Task Should_throw_argument_exception_for_void_send_when_request_is_null()
        {
            var container = new Container(cfg =>
            {
                cfg.Scan(scanner =>
                {
                    scanner.AssemblyContainingType(typeof(VoidNullPing));
                    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>();

            VoidNullPing request = null;

            await Should.ThrowAsync <ArgumentNullException>(async() => await mediator.Send(request));
        }
Exemplo n.º 3
0
            public async Task Should_throw_argument_exception_for_void_send_when_request_is_null()
            {
                VoidNullPing request = null;

                await Should.ThrowAsync <ArgumentNullException>(async() => await Mediator.Send(request));
            }