public void CreateAHintByName() { var hf = new HintFactory(); var hint = hf.CreateHint("formats"); Assert.IsType <FormatsHint>(hint); }
public void CreateAHintByName() { var hf = new HintFactory(); var hint = hf.CreateHint("formats"); Assert.IsType<FormatsHint>(hint); }
/// <summary> /// /// </summary> public LinkFactory(bool includeIANALinks = true) { if (includeIANALinks) { RegisterIANALinks(); } HintFactory = new HintFactory(); // Default hintfactory }
public void CreateFormatHint() { var registry = new HintFactory(); var hint = registry.CreateHint <FormatsHint>(); hint.AddMediaType("application/json"); var obj = (JObject)hint.Content; Assert.NotNull(obj.Property("application/json")); }
public void CreatePreferHint() { var registry = new HintFactory(); var hint = registry.CreateHint <AcceptPreferHint>(); hint.AddPreference("handling"); var arr = (JArray)hint.Content; Assert.Equal("handling", arr[0]); }
public void CreateDeprecatedFormatHint() { var registry = new HintFactory(); var hint = registry.CreateHint <FormatsHint>(); hint.AddMediaType("application/json", true); var obj = (JObject)hint.Content; Assert.NotNull(obj.Property("application/json")); var thing = obj.Property("application/json").Value as JObject; Assert.Equal(true, (bool)thing.Property("deprecated").Value); }
public void SpecifyHandlerForAllowhint() { var foo = false; var registry = new HintFactory(); registry.SetHandler<AllowHint>((h, r) => { foo = true; return r; }); var hint = registry.CreateHint<AllowHint>(); var link = new Link(); link.AddHint(hint); // Act var request = link.CreateRequest(); Assert.Equal(foo,true); }
public void SpecifyHandlerForAllowhint() { var foo = false; var registry = new HintFactory(); registry.SetHandler <AllowHint>((h, r) => { foo = true; return(r); }); var hint = registry.CreateHint <AllowHint>(); var link = new Link(); link.AddHint(hint); // Act var request = link.CreateRequest(); Assert.Equal(foo, true); }
public void CreateFormatHint() { var registry = new HintFactory(); var hint = registry.CreateHint<FormatsHint>(); hint.AddMediaType("application/json"); var obj = (JObject) hint.Content; Assert.NotNull(obj.Property("application/json")); }
public void CreatePreferHint() { var registry = new HintFactory(); var hint = registry.CreateHint<AcceptPreferHint>(); hint.AddPreference("handling"); var arr = (JArray)hint.Content; Assert.Equal("handling", arr[0]); }
public void CreateDeprecatedFormatHint() { var registry = new HintFactory(); var hint = registry.CreateHint<FormatsHint>(); hint.AddMediaType("application/json",true); var obj = (JObject)hint.Content; Assert.NotNull(obj.Property("application/json")); var thing = obj.Property("application/json").Value as JObject; Assert.Equal(true,(bool)thing.Property("deprecated").Value); }