Exemple #1
0
        public void AsyncStorageModule_GetAllKeys_SpecialCharacters()
        {
            var pairs = new[]
            {
                new[] { "\\", "1" },
                new[] { "/", "2" },
                new[] { ":", "3" },
                new[] { "*", "4" },
                new[] { "?", "5" },
                new[] { "<", "6" },
                new[] { ">", "7" },
                new[] { "|", "8" },
                new[] { "\"", "9" },
                new[] { ".", "10" },
                new[] { "{", "11" },
                new[] { "}", "12" },
                new[] { "\\/:*?<>|\".{}", "13" },
                new[] { "abc\\abc/abc:abc*abc?abc<abc>abc|abc\"abc.abc{abc}abc", "13" },
                new[] { "foo:bar", "14" },
            };

            module.multiSet(pairs, callback);
            Assert.That(waitHandle.WaitOne(), Is.True);
            Assert.That(error, Is.Null);
            Assert.That(result, Is.Null);

            module.getAllKeys(callback);
            Assert.That(waitHandle.WaitOne(), Is.True);
            Assert.That(error, Is.Null);
            var expectedKeys = pairs.Select(pair => pair[0]).OrderBy(key => key);
            var actualKeys   = result.ToObject <string[]>().OrderBy(key => key);

            Assert.That(expectedKeys, Is.EqualTo(actualKeys));
        }
        public void AsyncStorageModule_testClear()
        {
            var mStorage   = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error    = default(JObject);
            var result   = default(JArray);
            var callback = new MockCallback(res =>
            {
                error  = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys   = new[] { "foo", "foo2" };
            var values = new[] { "bar", "bar2" };

            var keyValues = new[]
            {
                new[]
                {
                    keys[0],
                    values[0],
                },
                new[]
                {
                    keys[1],
                    values[1],
                },
            };

            mStorage.multiSet(keyValues, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);
        }
        public void AsyncStorageModule_GetAllKeys_SpecialCharacters()
        {
            var module     = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error    = default(JObject);
            var result   = default(JArray);
            var callback = new MockCallback(res =>
            {
                error  = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            module.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var pairs = new[]
            {
                new[] { "\\", "1" },
                new[] { "/", "2" },
                new[] { ":", "3" },
                new[] { "*", "4" },
                new[] { "?", "5" },
                new[] { "<", "6" },
                new[] { ">", "7" },
                new[] { "|", "8" },
                new[] { "\"", "9" },
                new[] { ".", "10" },
                new[] { "{", "11" },
                new[] { "}", "12" },
                new[] { "\\/:*?<>|\".{}", "13" },
                new[] { "abc\\abc/abc:abc*abc?abc<abc>abc|abc\"abc.abc{abc}abc", "13" },
                new[] { "foo:bar", "14" },
            };

            module.multiSet(pairs, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            var expectedKeys = pairs.Select(arr => arr[0]).OrderBy(s => s);
            var actualKeys   = result.ToObject <string[]>().OrderBy(s => s);

            Assert.IsTrue(expectedKeys.SequenceEqual(actualKeys));
        }
        public void AsyncStorageModule_testHugeMultiGetMultiGet()
        {
            var mStorage = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error = default(JObject);
            var result = default(JArray);
            var callback = new MockCallback(res =>
            {
                error = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            // Limitation on Android - not a limitation on Windows
            // Test with many keys, so that it's above the 999 limit per batch imposed by SQLite.
            int keyCount = 1001;
            // don't set keys that divide by this magical number, so that we can check that multiGet works,
            // and returns null for missing keys
            int magicalNumber = 343;

            var keyValues = new List<string[]>();
            for (int i = 0; i < keyCount; i++)
            {
                if (i % magicalNumber > 0)
                {
                    var key = "key" + i;
                    var value = "value" + i;
                    keyValues.Add(new[]
                    {
                        key,
                        value,
                    });
                }
            }
            mStorage.multiSet(keyValues.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys = new List<string>();
            for (int i = 0; i < keyCount; i++)
            {
                keys.Add("key" + i);
            }

            mStorage.multiGet(keys.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, keys.Count);

            var keyReceived = new bool[keyCount];

            for (int i = 0; i < keyCount; i++)
            {
                var keyValue = result[i];
                var key = keyValue.Value<JArray>().First.Value<string>().Substring(3);

                int idx = int.Parse(key);
                Assert.IsFalse(keyReceived[idx]);
                keyReceived[idx] = true;

                if (idx % magicalNumber > 0)
                {
                    var value = keyValue.Value<JArray>().Last.Value<string>().Substring(5);
                    Assert.AreEqual(key, value);
                }
                else
                {
                    Assert.IsTrue(keyValue.Value<JArray>().Last.Type == JTokenType.Null);
                }   
            }

            var keyRemoves = new List<string>();
            for (int i = 0; i < keyCount; i++)
            {
                if (i % 2 > 0)
                {
                    keyRemoves.Add("key" + i);
                }
            }

            mStorage.multiRemove(keyRemoves.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 499);
            for (int i = 0; i < result.Count; i++)
            {
                var key = result[i].Value<string>().Substring(3); ;
                int idx = int.Parse(key);
                Assert.AreEqual(idx % 2,0);
            }
        }
        public void AsyncStorageModule_testClear()
        {
            var mStorage = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error = default(JObject);
            var result = default(JArray);
            var callback = new MockCallback(res =>
            {
                error = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys = new[] { "foo", "foo2" };
            var values = new[] { "bar", "bar2" };

            var keyValues = new[]
            {
                new[]
                {
                    keys[0],
                    values[0],
                },
                new[]
                {
                    keys[1],
                    values[1],
                },
            };

            mStorage.multiSet(keyValues, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);
        }
        public void AsyncStorageModule_testGetAllKeys()
        {
            var mStorage = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error = default(JObject);
            var result = default(JArray);
            var callback = new MockCallback(res =>
            {
                error = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys = new[] { "foo", "foo2" };
            var values = new[] { "bar", "bar2" };

            var keyValues = new[]
            {
                new[]
                {
                    keys[0],
                    values[0],
                },
                new[]
                {
                    keys[1],
                    values[1],
                },
            };

            mStorage.multiSet(keyValues, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);

            var storedKeys = new JArray
            {
                keys[0],
                keys[1],
            };

            var set = new SortedSet<string>();
            IEnumerable<string> enumerator = storedKeys.Values<string>();

            foreach (var value in enumerator)
            {
                set.Add(value);
            }

            set.SymmetricExceptWith(result.Values<string>());
            Assert.AreEqual(set.Count, 0);

            mStorage.multiRemove(keys, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);
        }
        public void AsyncStorageModule_GetAllKeys_SpecialCharacters()
        {
            var module = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error = default(JObject);
            var result = default(JArray);
            var callback = new MockCallback(res =>
            {
                error = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            module.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var pairs = new[]
            {
                new[] { "\\", "1" },
                new[] { "/", "2" },
                new[] { ":", "3" },
                new[] { "*", "4" },
                new[] { "?", "5" },
                new[] { "<", "6" },
                new[] { ">", "7" },
                new[] { "|", "8" },
                new[] { "\"", "9" },
                new[] { ".", "10" },
                new[] { "{", "11" },
                new[] { "}", "12" },
                new[] { "\\/:*?<>|\".{}", "13" },
                new[] { "abc\\abc/abc:abc*abc?abc<abc>abc|abc\"abc.abc{abc}abc", "13" },
                new[] { "foo:bar", "14" },
            };

            module.multiSet(pairs, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            var expectedKeys = pairs.Select(arr => arr[0]).OrderBy(s => s);
            var actualKeys = result.ToObject<string[]>().OrderBy(s => s);
            Assert.IsTrue(expectedKeys.SequenceEqual(actualKeys));
        }
        public void AsyncStorageModule_testMultiRemove()
        {
            var mStorage = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error = default(JObject);
            var result = default(JArray);
            var callback = new MockCallback(res =>
            {
                error = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var key1 = "foo1";
            var key2 = "foo2";
            var value1 = "bar1";
            var value2 = "bar2";

            var keyValues = new List<string[]>();
            keyValues.Add(new[] { key1, value1 });
            keyValues.Add(new[] { key2, value2 });

            mStorage.multiSet(keyValues.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys = new List<string>();
            keys.Add(key1);
            keys.Add(key2);

            mStorage.multiRemove(keys.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);

            mStorage.multiSet(keyValues.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            keys.Add("fakeKey");
            mStorage.multiRemove(keys.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);
        }
        public void AsyncStorageModule_multiRemove_Method()
        {
            var module = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error = default(JObject);
            var result = default(JArray);
            var callback = new MockCallback(res =>
            {
                error = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            var array = new[]
            {
                new[] { "test1", "1" },
                new[] { "test2", "2" },
                new[] { "test3", "3" },
                new[] { "test4", "4" },
                new[] { "test5", "5" },
                new[] { "test6", "6" },
            };

            module.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.multiSet(array, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 6);

            var strArray = new string[result.Count];
            int idx = 0;
            foreach (var item in result)
            {
                strArray[idx++] = item.Value<string>();
            }

            module.multiGet(strArray, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            var expected = array.OrderBy(p => p[0]).Aggregate("", (acc, p) => $"{p[0]},{p[1]};");
            var actual = result.OrderBy(p => p[0]).Aggregate("", (acc, p) => $"{p[0]},{p[1]};");
            Assert.AreEqual(expected, actual);
          
            var keys = new string[] 
            {
                "test1",
                "test2",
            };

            module.multiRemove(keys, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 4);
        }
        public void AsyncStorageModule_testHugeMultiGetMultiGet()
        {
            var mStorage   = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error    = default(JObject);
            var result   = default(JArray);
            var callback = new MockCallback(res =>
            {
                error  = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            // Limitation on Android - not a limitation on Windows
            // Test with many keys, so that it's above the 999 limit per batch imposed by SQLite.
            int keyCount = 1001;
            // don't set keys that divide by this magical number, so that we can check that multiGet works,
            // and returns null for missing keys
            int magicalNumber = 343;

            var keyValues = new List <string[]>();

            for (int i = 0; i < keyCount; i++)
            {
                if (i % magicalNumber > 0)
                {
                    var key   = "key" + i;
                    var value = "value" + i;
                    keyValues.Add(new[]
                    {
                        key,
                        value,
                    });
                }
            }
            mStorage.multiSet(keyValues.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys = new List <string>();

            for (int i = 0; i < keyCount; i++)
            {
                keys.Add("key" + i);
            }

            mStorage.multiGet(keys.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, keys.Count);

            var keyReceived = new bool[keyCount];

            for (int i = 0; i < keyCount; i++)
            {
                var keyValue = result[i];
                var key      = keyValue.Value <JArray>().First.Value <string>().Substring(3);

                int idx = int.Parse(key);
                Assert.IsFalse(keyReceived[idx]);
                keyReceived[idx] = true;

                if (idx % magicalNumber > 0)
                {
                    var value = keyValue.Value <JArray>().Last.Value <string>().Substring(5);
                    Assert.AreEqual(key, value);
                }
                else
                {
                    Assert.IsTrue(keyValue.Value <JArray>().Last.Type == JTokenType.Null);
                }
            }

            var keyRemoves = new List <string>();

            for (int i = 0; i < keyCount; i++)
            {
                if (i % 2 > 0)
                {
                    keyRemoves.Add("key" + i);
                }
            }

            mStorage.multiRemove(keyRemoves.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 499);
            for (int i = 0; i < result.Count; i++)
            {
                var key = result[i].Value <string>().Substring(3);;
                int idx = int.Parse(key);
                Assert.AreEqual(idx % 2, 0);
            }
        }
        public void AsyncStorageModule_testGetAllKeys()
        {
            var mStorage   = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error    = default(JObject);
            var result   = default(JArray);
            var callback = new MockCallback(res =>
            {
                error  = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys   = new[] { "foo", "foo2" };
            var values = new[] { "bar", "bar2" };

            var keyValues = new[]
            {
                new[]
                {
                    keys[0],
                    values[0],
                },
                new[]
                {
                    keys[1],
                    values[1],
                },
            };

            mStorage.multiSet(keyValues, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);

            var storedKeys = new JArray
            {
                keys[0],
                keys[1],
            };

            var set = new SortedSet <string>();
            IEnumerable <string> enumerator = storedKeys.Values <string>();

            foreach (var value in enumerator)
            {
                set.Add(value);
            }

            set.SymmetricExceptWith(result.Values <string>());
            Assert.AreEqual(set.Count, 0);

            mStorage.multiRemove(keys, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);
        }
        public void AsyncStorageModule_testMultiRemove()
        {
            var mStorage   = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error    = default(JObject);
            var result   = default(JArray);
            var callback = new MockCallback(res =>
            {
                error  = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            mStorage.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var key1   = "foo1";
            var key2   = "foo2";
            var value1 = "bar1";
            var value2 = "bar2";

            var keyValues = new List <string[]>();

            keyValues.Add(new[] { key1, value1 });
            keyValues.Add(new[] { key2, value2 });

            mStorage.multiSet(keyValues.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            var keys = new List <string>();

            keys.Add(key1);
            keys.Add(key2);

            mStorage.multiRemove(keys.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);

            mStorage.multiSet(keyValues.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            keys.Add("fakeKey");
            mStorage.multiRemove(keys.ToArray(), callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            mStorage.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 0);
        }
        public void AsyncStorageModule_multiRemove_Method()
        {
            var module     = new AsyncStorageModule();
            var waitHandle = new AutoResetEvent(false);

            var error    = default(JObject);
            var result   = default(JArray);
            var callback = new MockCallback(res =>
            {
                error  = res.Length > 0 ? (JObject)res[0] : null;
                result = res.Length > 1 ? (JArray)res[1] : null;
                waitHandle.Set();
            });

            var array = new[]
            {
                new[] { "test1", "1" },
                new[] { "test2", "2" },
                new[] { "test3", "3" },
                new[] { "test4", "4" },
                new[] { "test5", "5" },
                new[] { "test6", "6" },
            };

            module.clear(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.multiSet(array, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 6);

            var strArray = new string[result.Count];
            int idx      = 0;

            foreach (var item in result)
            {
                strArray[idx++] = item.Value <string>();
            }

            module.multiGet(strArray, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            var expected = array.OrderBy(p => p[0]).Aggregate("", (acc, p) => $"{p[0]},{p[1]};");
            var actual   = result.OrderBy(p => p[0]).Aggregate("", (acc, p) => $"{p[0]},{p[1]};");

            Assert.AreEqual(expected, actual);

            var keys = new string[]
            {
                "test1",
                "test2",
            };

            module.multiRemove(keys, callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.IsNull(result);

            module.getAllKeys(callback);
            Assert.IsTrue(waitHandle.WaitOne());
            Assert.IsNull(error);
            Assert.AreEqual(result.Count, 4);
        }