Example #1
0
        public void Should_create_value_from_instant_object()
        {
            var instant = Instant.FromUnixTimeSeconds(4123125455);

            Assert.Equal(instant.ToString(), JsonValue.Create((object)instant).ToString());
        }
Example #2
0
 public void Should_throw_exception_if_creation_value_from_invalid_type()
 {
     Assert.Throws <ArgumentException>(() => JsonValue.Create(default(TimeSpan)));
 }
Example #3
0
 public void Should_cache_zero()
 {
     Assert.Same(JsonValue.Zero, JsonValue.Create(0));
 }
Example #4
0
 public void Should_create_boolean_from_object()
 {
     Assert.Equal(JsonValue.True, JsonValue.Create((object)true));
 }
Example #5
0
 public void Should_cache_empty()
 {
     Assert.Same(JsonValue.Empty, JsonValue.Create(string.Empty));
 }
Example #6
0
 public void Should_cache_false()
 {
     Assert.Same(JsonValue.False, JsonValue.Create(false));
 }
Example #7
0
 public void Should_cache_true()
 {
     Assert.Same(JsonValue.True, JsonValue.Create(true));
 }
Example #8
0
 public JsonObject Add(string key, object?value)
 {
     return(Add(key, JsonValue.Create(value)));
 }
Example #9
0
 public void Should_throw_exception_when_creation_value_from_invalid_type()
 {
     Assert.Throws <ArgumentException>(() => JsonValue.Create(Guid.Empty));
 }