Exemplo n.º 1
0
        public void DbList2()
        {
            var value = DbValue.FromJson(JsonObject.Parse(@"{ ""L"": [ { ""N"": ""1.1"" }, { ""N"":""7.543"" } ] }"));

            Assert.Equal(DbValueType.L, value.Kind);

            Assert.Equal(new[] { 1.1f, 7.543f }, value.ToArray <float>());
        }
Exemplo n.º 2
0
        public void BinaryTests()
        {
            var value = DbValue.FromJson(JsonObject.Parse(@"{""B"":""dmFsdWU=""}"));

            Assert.Equal(DbValueType.B, value.Kind);
            Assert.Equal("dmFsdWU=", Convert.ToBase64String(value.ToBinary()));

            Assert.Equal(@"{""B"":""dmFsdWU=""}", value.ToJson().ToString(pretty: false));
        }
Exemplo n.º 3
0
        public void DbList()
        {
            var value = DbValue.FromJson(JsonObject.Parse(@"{ ""L"": [ { ""N"": ""1"" }, { ""N"":""2"" } ] }"));

            Assert.Equal(DbValueType.L, value.Kind);

            Assert.Equal(new[] { "1", "2" }, value.ToArray <string>());

            Assert.Equal(new[] { 1, 2 }, value.ToArray <int>());
            Assert.Equal(new[] { 1L, 2L }, value.ToArray <long>());
        }