public BundleHandlerTests() { _router = Substitute.For <IRouter>(); var fhirRequestContext = new DefaultFhirRequestContext { BaseUri = new Uri("https://localhost/"), CorrelationId = Guid.NewGuid().ToString(), }; _fhirRequestContextAccessor = Substitute.For <IFhirRequestContextAccessor>(); _fhirRequestContextAccessor.FhirRequestContext.Returns(fhirRequestContext); _httpContextAccessor = Substitute.For <IHttpContextAccessor>(); _fhirJsonSerializer = new FhirJsonSerializer(); _fhirJsonParser = new FhirJsonParser(); _searchService = Substitute.For <ISearchService>(); var fhirDataStore = Substitute.For <IFhirDataStore>(); var conformanceProvider = Substitute.For <Lazy <IConformanceProvider> >(); var resourceWrapperFactory = Substitute.For <IResourceWrapperFactory>(); var resourceIdProvider = Substitute.For <ResourceIdProvider>(); var transactionBundleValidator = new TransactionBundleValidator(fhirDataStore, conformanceProvider, resourceWrapperFactory, _searchService, resourceIdProvider); _bundleHttpContextAccessor = new BundleHttpContextAccessor(); IFeatureCollection featureCollection = CreateFeatureCollection(); var httpContext = new DefaultHttpContext(featureCollection) { Request = { Scheme = "https", Host = new HostString("localhost"), PathBase = new PathString("/"), }, }; _httpContextAccessor.HttpContext.Returns(httpContext); var transactionHandler = Substitute.For <ITransactionHandler>(); _resourceIdProvider = new ResourceIdProvider(); _auditEventTypeMapping = Substitute.For <IAuditEventTypeMapping>(); _bundleHandler = new BundleHandler( _httpContextAccessor, _fhirRequestContextAccessor, _fhirJsonSerializer, _fhirJsonParser, transactionHandler, _bundleHttpContextAccessor, _resourceIdProvider, transactionBundleValidator, _auditEventTypeMapping, NullLogger <BundleHandler> .Instance); }
public BundleHandlerTests() { _router = Substitute.For <IRouter>(); var fhirRequestContext = Substitute.For <IFhirRequestContext>(); fhirRequestContext.BaseUri.Returns(new Uri("https://localhost/")); fhirRequestContext.CorrelationId.Returns(Guid.NewGuid().ToString()); _fhirRequestContextAccessor = Substitute.For <IFhirRequestContextAccessor>(); _fhirRequestContextAccessor.FhirRequestContext.Returns(fhirRequestContext); _httpContextAccessor = Substitute.For <IHttpContextAccessor>(); _fhirJsonSerializer = new FhirJsonSerializer(); _fhirJsonParser = new FhirJsonParser(); _bundleHttpContextAccessor = new BundleHttpContextAccessor(); IFeatureCollection featureCollection = CreateFeatureCollection(); var httpContext = new DefaultHttpContext(featureCollection) { Request = { Scheme = "https", Host = new HostString("localhost"), PathBase = new PathString("/"), }, }; _httpContextAccessor.HttpContext.Returns(httpContext); var transactionHandler = Substitute.For <ITransactionHandler>(); _resourceIdProvider = new ResourceIdProvider(); _bundleHandler = new BundleHandler(_httpContextAccessor, _fhirRequestContextAccessor, _fhirJsonSerializer, _fhirJsonParser, transactionHandler, _bundleHttpContextAccessor, _resourceIdProvider, NullLogger <BundleHandler> .Instance); }
public BundleHandlerTests() { _router = Substitute.For <IRouter>(); _fhirRequestContext = new DefaultFhirRequestContext { BaseUri = new Uri("https://localhost/"), CorrelationId = Guid.NewGuid().ToString(), ResponseHeaders = new HeaderDictionary(), }; var fhirRequestContextAccessor = Substitute.For <RequestContextAccessor <IFhirRequestContext> >(); fhirRequestContextAccessor.RequestContext.Returns(_fhirRequestContext); IHttpContextAccessor httpContextAccessor = Substitute.For <IHttpContextAccessor>(); var fhirJsonSerializer = new FhirJsonSerializer(); var fhirJsonParser = new FhirJsonParser(); ISearchService searchService = Substitute.For <ISearchService>(); var resourceReferenceResolver = new ResourceReferenceResolver(searchService, new QueryStringParser()); var transactionBundleValidator = new TransactionBundleValidator(resourceReferenceResolver); var bundleHttpContextAccessor = new BundleHttpContextAccessor(); IFeatureCollection featureCollection = CreateFeatureCollection(); var httpContext = new DefaultHttpContext(featureCollection) { Request = { Scheme = "https", Host = new HostString("localhost"), PathBase = new PathString("/"), }, }; httpContextAccessor.HttpContext.Returns(httpContext); var transactionHandler = Substitute.For <ITransactionHandler>(); var resourceIdProvider = new ResourceIdProvider(); IAuditEventTypeMapping auditEventTypeMapping = Substitute.For <IAuditEventTypeMapping>(); _bundleConfiguration = new BundleConfiguration(); var bundleOptions = Substitute.For <IOptions <BundleConfiguration> >(); bundleOptions.Value.Returns(_bundleConfiguration); _mediator = Substitute.For <IMediator>(); _bundleHandler = new BundleHandler( httpContextAccessor, fhirRequestContextAccessor, fhirJsonSerializer, fhirJsonParser, transactionHandler, bundleHttpContextAccessor, resourceIdProvider, transactionBundleValidator, resourceReferenceResolver, auditEventTypeMapping, bundleOptions, DisabledFhirAuthorizationService.Instance, _mediator, NullLogger <BundleHandler> .Instance); }