Beispiel #1
0
        public async Task SetRange_ShouldAddDataToHashDictionary()
        {
            var data = HashTestData.GenerateKeyValuePairs();

            await this.hashDictionary.SetRange(data);

            Assert.True((await this.hashDictionary.ContainsKey("2")));
            Assert.True((await this.hashDictionary.Count()) == 10);
        }
Beispiel #2
0
        public async Task GetRange_ShouldReturnSameCollection()
        {
            var data = HashTestData.GenerateKeyValuePairs();

            await this.hashDictionary.SetRange(data);

            var actual = await this.hashDictionary.GetRange(new[] { "2", "4" });

            Assert.Equal(new[] { 2, 4 }, (ICollection)actual);
        }
Beispiel #3
0
        public async Task RemoveRange_ShouldDeleteCollectionFromDictionary()
        {
            var data = HashTestData.GenerateKeyValuePairs();

            await this.hashDictionary.SetRange(data);

            var originalCount = await this.hashDictionary.Count();

            var deleted = await this.hashDictionary.RemoveRange(new[] { "2", "4" });

            var actual = await this.hashDictionary.Count();

            var expected = originalCount - deleted;

            Assert.Equal(expected, actual);
        }
Beispiel #4
0
        public async Task KeysAndValues_ShouldReturnSameCount()
        {
            var data = HashTestData.GenerateKeyValuePairs();

            await this.hashDictionary.SetRange(data);

            var keys = await this.hashDictionary.Keys();

            var values = await this.hashDictionary.Values();

            var expectedCount = 10;

            Assert.Equal(expectedCount, keys.Count);
            Assert.Equal(expectedCount, values.Count);
            Assert.True(keys.Count == values.Count);
        }