Example #1
0
        public void FromJson_CorrectJsonClass()
        {
            //arrange
            var json      = "{\"IsFalse\":false,\"IsTrue\":true}";
            var jsonClass = new JsonBooleanClass();

            //act
            _convert.FromJson(jsonClass, json);

            //assert
            Assert.That(jsonClass.IsTrue, Is.True);
            Assert.That(jsonClass.IsFalse, Is.False);
        }
Example #2
0
        public void ToJson_CorrectString()
        {
            //arrange
            var jsonClass = new JsonBooleanClass()
            {
                IsTrue  = true,
                IsFalse = false
            };

            //act
            var json = _convert.ToJson(jsonClass);

            //assert
            Assert.That(json, Is.EqualTo("{\"IsFalse\":false,\"IsTrue\":true}"));
        }
Example #3
0
 protected abstract ReadOnlySpan <char> FromJson(JsonBooleanClass value, string json);
Example #4
0
 protected abstract string ToJson(JsonBooleanClass jsonClass);
Example #5
0
 protected override ReadOnlySpan <char> FromJson(JsonBooleanClass value, string json)
 {
     return(Encoding.UTF8.GetString(_convert.FromJson(value, Encoding.UTF8.GetBytes(json))));
 }
Example #6
0
        protected override string ToJson(JsonBooleanClass jsonClass)
        {
            var jsonUtf8 = _convert.ToJsonUtf8(jsonClass);

            return(Encoding.UTF8.GetString(jsonUtf8));
        }
Example #7
0
 protected override ReadOnlySpan <char> FromJson(JsonBooleanClass value, string json)
 {
     return(_convert.FromJson(value, json));
 }
Example #8
0
 protected override string ToJson(JsonBooleanClass jsonClass)
 {
     return(_convert.ToJson(jsonClass).ToString());
 }