public void NoError() { string value = "ee"; var model = TextConvert.Deserialize <SimpleModel2>(value); Assert.Equal(value, model.Prop1); }
private void TsmItemTextCleaner_Click(object sender, EventArgs e) { var frm = new TextConvert(); if (!CheckOpened("TextConvert")) { frm.Show(); } }
public void ConvertWithoutBasemodel() { string value = "orange|blue|red|true|012|239"; var @object = TextConvert.Deserialize <ModelTestWithOutBasemodel>(value); Assert.Equal("orange", @object.Prop1); Assert.Equal("red", @object.Prop2); Assert.True(@object.Prop3); Assert.Equal(12, @object.Prop4); Assert.Equal(239, @object.Prop5); }
public MyEvent Deserialize(byte[] value) { string data = TextConvert.ToUTF8String(value); if (!int.TryParse(data, out int status)) { status = -1; } return(new MyEvent { Status = status }); }
public StatusChanged Deserialize(byte[] body) { var actin = TextConvert.ToUTF8String(body); if (!int.TryParse(actin, out int value)) { value = -1; } return(new StatusChanged { Value = value }); }
public StateChanged Deserialize(byte[] body) { string data = TextConvert.ToUTF8String(body); if (!int.TryParse(data, out int value)) { value = -1; } return(new StateChanged { Value = value }); }
public ChangeNodeState Deserialize(byte[] body) { var data = TextConvert.ToUTF8String(body); var strNodeId = data.Substring(0, data.Length - 1); if (!int.TryParse(strNodeId, out int nodeId)) { return(null); } var strActionType = data.Substring(data.Length - 1); if (!int.TryParse(strActionType, out int actionType)) { return(null); } return(new ChangeNodeState { NodeId = nodeId, ActionType = actionType }); }
private void btnConvert_Click(object sender, EventArgs e) { txtDesti.Text = TextConvert.PostManTestJsonConvert(txtOri.Text, txtNewObjectName.Text); }
public byte[] Serialize(ChangeNodeState @event) => TextConvert.ToUTF8ByteArray($"{@event.NodeId}{@event.ActionType}");
public virtual byte[] Serialize(string value) => TextConvert.ToUTF8ByteArray(value);
public virtual string Deserialize(byte[] value) => TextConvert.ToUTF8String(value);
public byte[] Serialize(StateChanged @event) { string data = @event.Value.ToString(); return(TextConvert.ToUTF8ByteArray(data)); }
public byte[] Serialize(MyEvent value) { string data = string.Format($"{value.Status}{value.Status}"); return(TextConvert.ToUTF8ByteArray(data)); }
public byte[] Serialize(T value) { var data = JsonConvert.SerializeObject(value); return(TextConvert.ToUTF8ByteArray(data)); }
public byte[] Serialize(StatusChanged @event) => TextConvert.ToUTF8ByteArray(Convert.ToString(@event.Value));
public T Deserialize(byte[] value) { string data = TextConvert.ToUTF8String(value); return(JsonConvert.DeserializeObject <T>(data)); }
public void Error() { string value = "ee"; _ = Assert.Throws <ArgumentOutOfRangeException>(() => TextConvert.Deserialize <SimpleModel>(value)); }