public void FromJson_CorrectJsonClass() { //arrange var json = ExpectedJson; var jsonClass = new JsonNullableGuidClass(); //act _convert.FromJson(jsonClass, json); //assert Assert.That(jsonClass.GuidProperty, Is.EqualTo(new Guid(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))); Assert.That(jsonClass.Null, Is.Null); }
public void ToJson_CorrectString() { //arrange var jsonClass = new JsonNullableGuidClass() { GuidProperty = new Guid(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), Null = null }; //act var json = _convert.ToJson(jsonClass); //assert Assert.That(json, Is.EqualTo(ExpectedJson)); }
protected abstract ReadOnlySpan <char> FromJson(JsonNullableGuidClass value, string json);
protected abstract string ToJson(JsonNullableGuidClass jsonClass);
protected override ReadOnlySpan <char> FromJson(JsonNullableGuidClass value, string json) { return(Encoding.UTF8.GetString(_convert.FromJson(value, Encoding.UTF8.GetBytes(json)))); }
protected override string ToJson(JsonNullableGuidClass jsonClass) { var jsonUtf8 = _convert.ToJsonUtf8(jsonClass); return(Encoding.UTF8.GetString(jsonUtf8)); }
protected override ReadOnlySpan <char> FromJson(JsonNullableGuidClass value, string json) { return(_convert.FromJson(value, json)); }
protected override string ToJson(JsonNullableGuidClass jsonClass) { return(_convert.ToJson(jsonClass).ToString()); }