public void CanUseRegisterExtensionMethod() { var curie = new CuriesLink("aap", "http://www.helpt.com/{?rel}"); var builder = Hypermedia.CreateBuilder(); var selfLink = new Link<ProductRepresentation>("product", "http://www.product.com?id=1"); var link2 = new Link("related", "http://www.related.com"); var link3 = curie.CreateLink<CategoryRepresentation>("category", "http://www.category.com"); builder.Register(selfLink, link2, link3); var config = builder.Build(); // arrange var mediaFormatter = new JsonHalOutputFormatter(config) { }; var type = representation.GetType(); var httpContext = new Mock<HttpContext>(); var httpRequest = new DefaultHttpContext().Request; httpContext.SetupGet(o => o.Request).Returns(httpRequest); // act using (var stream = new MemoryStream()) { mediaFormatter.WriteResponseBodyAsync(new OutputFormatterWriteContext(httpContext.Object, (s,e)=> new HttpResponseStreamWriter(s, e), type, representation)); //WriteToStreamAsync(type, representation, stream, content, null); stream.Seek(0, SeekOrigin.Begin); var serialisedResult = new StreamReader(stream).ReadToEnd(); // assert Approvals.Verify(serialisedResult); } }