public void Read(Boo[] array) { var jsonData = new JsonArray(array.Select(_elementConverter.Write)); var result = _converter.Read(jsonData); for (var i = 0; i < array.Length; i++) { result[i].Should().BeEquivalentTo(array[i]); } }
public void Read(int?value) { var number = value == null ? JsonValue.Null : JsonValue.Number(value.Value); _converter.Read(number).Should().Be(value); }
public TNullable?Read(JsonData jsonData) { var jsonValue = (JsonValue)jsonData; if (jsonValue.Type == JsonDataType.Null) { return(null); } return(_valueConverter.Read(jsonData)); }
public object?ReadValue(JsonObject source) { var value = (JsonValue)source[nameof(IEntity.Id)]; if (value.Type == JsonDataType.Number) { return(_intConverter.Read(value)); } var alias = _stringConverter.Read(value); return(_descriptions.GetOrAddAlias(alias)); }
public List <TElement> Read(JsonData jsonData) { var listData = (JsonArray)jsonData; var list = new List <TElement>(listData.Length); for (var i = 0; i < listData.Length; i++) { list.Add(_elementConverter.Read(listData[i])); } return(list); }
public TElement[] Read(JsonData jsonData) { if (jsonData.Type == JsonDataType.Null) { return(null); } var arrayData = (JsonArray)jsonData; var array = new TElement[arrayData.Length]; for (var i = 0; i < array.Length; i++) { array[i] = _elementConverter.Read(arrayData[i]); } return(array); }
public void Read(int value) { var number = JsonValue.Number(value); _converter.Read(number).Should().Be(value); }
public void Read(TimeSpan value) { var number = JsonValue.TimeSpan(value); _converter.Read(number).Should().Be(value); }
public void Read(DateTime value) { var number = JsonValue.DateTime(value); _converter.Read(number).Should().Be(value); }
public override object ReadJson(Newtonsoft.Json.JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer) { var response = _converter.Read(reader.Value); return(response); }
public void Read(Boo value) { var jsonObject = _converter.Write(value); _converter.Read(jsonObject).Should().BeEquivalentTo(value); }
public void Read(string value) { var str = JsonValue.String(value); _converter.Read(str).Should().Be(value); }
public void Read(DependencyLifetime value) { var number = JsonValue.Number((int)value); _converter.Read(number).Should().Be(value); }
public void Read(bool value) { var number = JsonValue.Boolean(value); _converter.Read(number).Should().Be(value); }