public LinkMapperTests() { context = new LinkFactoryContext(); httpLink = new HttpLink(TestHref, TestHttpMethod); sut = new LinkMapper <HttpLink>(context, httpLink); }
public IsTemplatedEnricherTests() { request = LinkRequestBuilder.CreateWithRouteName(TestRouteName); context = new LinkFactoryContext(); writer = new LinkDataWriter(context); sut = new IsTemplatedEnricher(); }
private void EnrichLinkFactoryContext(LinkRequest request, LinkFactoryContext linkFactoryContext) { var linkDataWriter = new LinkDataWriter(linkFactoryContext); foreach (var enricher in linkDataEnrichers) { enricher.Enrich(request, linkDataWriter); } }
private Link DoGetLink(LinkRequest request) { var baseUrl = GetBaseUrlOrThrow(); var urlPath = GetUrlPathOrThrow(request); var linkFactoryContext = new LinkFactoryContext() .SetBaseUrl(baseUrl) .SetUrlPath(urlPath); EnrichLinkFactoryContext(request, linkFactoryContext); return(linkFactory.Create(linkFactoryContext)); }
protected override Link DoCreate(LinkFactoryContext context) { return(context .MapTo((h, c) => new HttpLink(h?.ToString(), c.Get(HttpMethodEnricher.HttpMethodKey)?.ToString())) .MapIfExisting <bool>(IsTemplatedEnricher.TemplatedKey, (l, v) => { if (v) { l.Templated = v; } }) .Link); }
public HttpMethodEnricherTests() { request = LinkRequestBuilder.CreateWithRouteName(TestRouteName); context = new LinkFactoryContext(); writer = new LinkDataWriter(context); endpointMetadata = new List <object> { new HttpMethodMetadata(new string[] { TestHttpMethod }) }; attributeRouteInfo = new AttributeRouteInfo { Name = TestRouteName }; mockProvider = new Mock <IActionDescriptorCollectionProvider>(); SetupProvider(); sut = new HttpMethodEnricher(mockProvider.Object); }
public LinkFactoryContextTests() { sut = new LinkFactoryContext(); }
public LinkDataWriter(LinkFactoryContext context) { this.context = context ?? throw new ArgumentNullException(nameof(context)); }
public LinkFactoryContextExtensionTests() { sut = new LinkFactoryContext(); }
public LinkDataWriterTests() { context = new LinkFactoryContext(); sut = new LinkDataWriter(context); }