public void SetsIntegerProperty() { var obj = _fke.SampleClass1(); var dict = D8NodeMapper.Cast(obj, ""); dict.MustHave("field_first_number", "value", obj.FirstNumber); }
public void SetsTextProperty() { var obj = _fke.SampleClass1(); var dict = D8NodeMapper.Cast(obj, ""); dict.MustHave("field_first_text", "value", obj.FirstText); }
public void SetsContentType() { var obj = _fke.SampleClass1(); var dict = D8NodeMapper.Cast(obj, ""); dict.MustHave("type", "target_id", obj.D8TypeName); }
public void SetsContentTitle() { var obj = _fke.SampleClass1(); var dict = D8NodeMapper.Cast(obj, ""); dict.MustHave("title", "value", obj.TheTitle); }
public async Task <NodeReply> PatchNode <T>(T node, CancellationToken cancelTkn, string revisionLog) where T : ID8Node { var url = string.Format(D8.NODE_X_FORMAT_HAL, node.nid); //var url = string.Format(D8.NODE_X_REV_Y_FMT_HAL, node.nid, node.vid); var mapd = D8NodeMapper.Cast(node, BaseURL); if (!revisionLog.IsBlank()) { var now = DateTime.Now.ToString("d MMM yyyy, h:mmtt"); var log = $"[{Creds.Username}, {now}] {revisionLog}"; mapd.Add("revision_log", D8HALJson.ValueField(log)); } Dictionary <string, object> dict; try { dict = await BasicAuthPATCH <Dictionary <string, object> >(url, mapd, cancelTkn); return(new NodeReply(dict)); } catch (Exception ex) { return(NodeReply.Fail(ex)); } }
public void MapsNullableDateProperty_null() { var node = new TestClass { Date2 = null }; var mapd = D8NodeMapper.Cast(node, ""); mapd.MustHave("field_date2", "value", null); }
public void MapsNullableDateProperty() { var node = new TestClass { Date2 = 23.February(2016) }; var mapd = D8NodeMapper.Cast(node, ""); mapd.MustHave("field_date2", "value", node.Date2?.ToString("yyyy-MM-dd")); }
public void MapsStringProperty() { var node = new TestClass { Text1 = "abc" }; var mapd = D8NodeMapper.Cast(node, ""); mapd.MustHave("field_text1", "value", node.Text1); }
protected Task <Dictionary <string, object> > PostNode <T>(T objectToPost, Func <Task <T> > postedNodeGetter) where T : D8NodeBase { var node = D8NodeMapper.Cast(objectToPost, Credentials.ApiBaseURL); //node.Remove("field_package"); //todo: pass D8 SavedIDsCopier to PostTilOK return(PostTilOK <T>(node, "entity/node?_format=hal_json", postedNodeGetter, null)); }
public async Task <NodeReply> PostNode <T>(T node, CancellationToken cancelTkn) where T : ID8Node { var url = D8.NODE_FORMAT_HAL; var mapd = D8NodeMapper.Cast(node, BaseURL); var dict = await BasicAuthPOST <Dictionary <string, object> >(url, mapd, cancelTkn); return(new NodeReply(dict)); }