コード例 #1
0
        public async Task Should_throw_argument_exception_for_send_when_request_is_null()
        {
            var container = new Container(cfg =>
            {
                cfg.Scan(scanner =>
                {
                    scanner.AssemblyContainingType(typeof(NullPing));
                    scanner.IncludeNamespaceContainingType <Ping>();
                    scanner.WithDefaultConventions();
                    scanner.AddAllTypesOf(typeof(IRequestHandler <,>));
                });
            });

            var mediator = new Mediator(container.GetInstance);

            NullPing request = null;

            await Should.ThrowAsync <ArgumentNullException>(async() => await mediator.Send(request));
        }
コード例 #2
0
ファイル: ExceptionTests.cs プロジェクト: bartosz6/MediatR
            public async Task Should_throw_argument_exception_for_send_when_request_is_null()
            {
                NullPing request = null;

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