Ejemplo n.º 1
0
        public void TestSerializeDeserializeJsonValue()
        {
            var jsonValue        = new HazelcastJsonValue("{ \"key\": \"value\" }");
            var jsonData         = _serializationService.ToData(jsonValue);
            var jsonDeserialized = _serializationService.ToObject <HazelcastJsonValue>(jsonData);

            Assert.AreEqual(jsonValue, jsonDeserialized);
        }
 private void FillMap()
 {
     for (var pos = 1; pos < 30; pos++)
     {
         var value = new HazelcastJsonValue("{ \"age\": " + pos + " }");
         _map.Put("key-" + pos, value);
     }
 }
        public async Task GetJsonValue_Succeeded()
        {
            var value = new HazelcastJsonValue("{ \"age\": 20 }");
            await _map.SetAsync("key-1", value);

            var result = await _map.GetAsync("key-1");

            Assert.AreEqual(value, result);
        }
        public virtual void GetJsonValue_Succeeded()
        {
            var value = new HazelcastJsonValue("{ \"age\": 20 }");

            _map.Put("key-1", value);
            var result = _map.Get("key-1");

            Assert.AreEqual(value, result);
        }
        public async Task QueryOnNestedProperty_Succeeded()
        {
            var value = new HazelcastJsonValue("{ \"outer\": {\"inner\": 24} }");
            await _map.SetAsync("key-a", value);

            await FillAsync();

            var result = await _map.GetValuesAsync(Predicates.EqualTo("outer.inner", 24));

            Assert.AreEqual(1, result.Count);
        }
        public async Task QueryOnTextAndNumberProperty_WhenSomeEntriesDoNotHaveTheField_ShouldNotFail()
        {
            var value = new HazelcastJsonValue("{ \"email\": \"[email protected]\" }");
            await _map.SetAsync("key-a", value);

            await FillAsync();

            var result = await _map.GetValuesAsync(Predicates.EqualTo("email", "*****@*****.**"));

            Assert.AreEqual(1, result.Count);
        }
        public void QueryOnNestedProperty_Succeeded()
        {
            var value = new HazelcastJsonValue("{ \"outer\": {\"inner\": 24} }");

            _map.Put("key-001", value);

            FillMap();
            var result = _map.Values(Predicates.IsEqual("outer.inner", 24));

            Assert.AreEqual(1, result.Count);
        }
        public void QueryOnTextAndNumberProperty_WhenSomeEntriesDoNotHaveTheField_ShouldNotFail()
        {
            var value = new HazelcastJsonValue("{ \"email\": \"[email protected]\" }");

            _map.Put("key-001", value);

            FillMap();
            var result = _map.Values(Predicates.IsEqual("email", "*****@*****.**"));

            Assert.AreEqual(1, result.Count);
        }
Ejemplo n.º 9
0
        public void Test()
        {
            Assert.Throws <ArgumentNullException>(() => _ = new HazelcastJsonValue(null));

            var jsonValue = new HazelcastJsonValue("{ \"key\": \"value\" }");

            Assert.That(jsonValue.ToString(), Is.EqualTo("{ \"key\": \"value\" }"));

            var otherValue = new HazelcastJsonValue("{ \"key\": \"value\" }");

            Assert.That(jsonValue.Equals(otherValue), Is.True);
            Assert.That(jsonValue == otherValue, Is.False);
            Assert.That(jsonValue.GetHashCode() == otherValue.GetHashCode(), Is.True);

            Assert.That(jsonValue.Equals(jsonValue), Is.True);
            Assert.That(jsonValue.Equals(null), Is.False);
            Assert.That(jsonValue.Equals("foo"), Is.False);
        }
 public async Task PutJsonValue_Succeeded()
 {
     var value = new HazelcastJsonValue("{ \"age\": 20 }");
     await _map.SetAsync("key-1", value);
 }
        public virtual void PutJsonValue_Succeeded()
        {
            var value = new HazelcastJsonValue("{ \"age\": 20 }");

            _map.Put("key-1", value);
        }