public void RegisterBehaviorsPipelineForCommand() { Services.AddPipelineBehaviorsForRequest <ICommandRequest>(); IPipelineBehavior <TestCommand, Unit> behavior = Provider.GetRequiredService <IPipelineBehavior <TestCommand, Unit> >(); behavior.Should().BeAssignableTo <CommandPipelineBehavior <TestCommand> >(); }
public void RegisterPipelineBehaviorsForRequestType() { Services.AddPipelineBehaviorsForRequest <IFooRequest>(); IPipelineBehavior <FooRequest, FooRequest.FooResponse> behavior = Provider.GetRequiredService <IPipelineBehavior <FooRequest, FooRequest.FooResponse> >(); behavior.Should().BeAssignableTo <FooPipelineBehavior <FooRequest, FooRequest.FooResponse> >(); }
public void RegisterPipelineBehaviorsForRequestTypeFromConfiguredAssemblies() { Assembly myAssembly = GetType().Assembly; Services.AddPipelineBehaviorsForRequest <IFooRequest>(cfg => cfg.AddPipelineBehaviorAssembly(myAssembly) .AddRequestAssembly(myAssembly) .AddRequestAssembly(typeof(string).Assembly)); IPipelineBehavior <FooRequest, FooRequest.FooResponse> behavior = Provider.GetRequiredService <IPipelineBehavior <FooRequest, FooRequest.FooResponse> >(); behavior.Should().BeAssignableTo <FooPipelineBehavior <FooRequest, FooRequest.FooResponse> >(); }
public void RegisterPipelineBehaviorsForRequestTypeWhenMoreRequestsImplementInterface() { Services.AddPipelineBehaviorsForRequest <IBarRequest>(); IPipelineBehavior <BarRequest, BarRequest.BarResponse> behavior = Provider.GetRequiredService <IPipelineBehavior <BarRequest, BarRequest.BarResponse> >(); behavior.Should().BeAssignableTo <BarPipelineBehavior <BarRequest, BarRequest.BarResponse> >(); IPipelineBehavior <Bar1Request, Bar1Request.BarResponse> behaviorBar1 = Provider.GetRequiredService <IPipelineBehavior <Bar1Request, Bar1Request.BarResponse> >(); behaviorBar1.Should().BeAssignableTo <BarPipelineBehavior <Bar1Request, Bar1Request.BarResponse> >(); }
public DoubleAveExceptionTests() { var mediator = new Mock <IMediator>(); mediator.Setup(x => x.Send(It.IsAny <AddressSystemFromPlace.Command>(), It.IsAny <CancellationToken>())) .Returns((AddressSystemFromPlace.Command g, CancellationToken t) => { if (g?.CityKey == "slc") { return(Task.FromResult(new[] { new PlaceGridLink("slc", "salt lake city", 1) } as IReadOnlyCollection <GridLinkable>)); } return(Task.FromResult(Array.Empty <GridLinkable>() as IReadOnlyCollection <GridLinkable>)); }); mediator.Setup(x => x.Send(It.IsAny <AddressSystemFromZipCode.Command>(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(Array.Empty <GridLinkable>() as IReadOnlyCollection <GridLinkable>)); var regex = new RegexCache(new Abbreviations()); _handler = new DoubleAvenuesException.DoubleAvenueExceptionPipeline <ZoneParsing.Command, GeocodeAddress>(regex, new Mock <ILogger>().Object); _requestHandler = new ZoneParsing.Handler(regex, mediator.Object, new Mock <ILogger>().Object); }
public VisitController(IPipelineBehavior pipelineBehavior, IVisitProcessor visitProcessor) { _pipelineBehavior = pipelineBehavior ?? throw new ArgumentNullException(nameof(pipelineBehavior)); _visitProcessor = visitProcessor ?? throw new ArgumentNullException(nameof(visitProcessor)); }
public TodoItemsController(IPipelineBehavior loggingBehavior) => _loggingBehavior = loggingBehavior;
public ValidationPipelineBehaviorGenericResultTest() { _validator = new SampleRequestValidatorGeneric(); _sut = new ValidationPipelineBehavior <SampleRequestGeneric, Result <long> >(_validator); }
public void AddBehavior(IPipelineBehavior behavior) { Behaviors.Add(behavior); }
public ValidationPipelineBehaviorOperationResultTest() { _validator = new SampleRequestValidator(); _sut = new ValidationPipelineBehavior <SampleRequest, OperationResult>(_validator); }
public ClientController(IPipelineBehavior pipelineBehavior, IClientProcessor clientProcessor) { _pipelineBehavior = pipelineBehavior ?? throw new ArgumentNullException(nameof(pipelineBehavior)); _clientProcessor = clientProcessor ?? throw new ArgumentNullException(nameof(clientProcessor)); }