Пример #1
0
        public async Task GetByIndexRemove()
        {
            var list = new RedisList <int>(GlobalSettings.Default, "listkey2");
            await list.Delete();

            await list.RightPush(new[] { 1, 2, 3, 4, 5 });

            (await list.GetByIndex(1)).Value.Is(2);

            (await list.GetByIndex(10)).HasValue.IsFalse();

            (await list.Length()).Is(5);

            await list.RightPush(new[] { 1, 2, 3, 4, 5, 3 });

            await list.Remove(3);

            (await list.Range()).Is(1, 2, 4, 5, 1, 2, 4, 5);

            await list.Remove(4, 1);

            (await list.Range()).Is(1, 2, 5, 1, 2, 4, 5);

            await list.Remove(5, -1);

            (await list.Range()).Is(1, 2, 5, 1, 2, 4);
        }
Пример #2
0
        public async Task GetByIndexRemove()
        {
            var list = new RedisList<int>(GlobalSettings.Default, "listkey2");
            await list.Delete();

            await list.RightPush(new[] { 1, 2, 3, 4, 5 });

            (await list.GetByIndex(1)).Value.Is(2);

            (await list.GetByIndex(10)).HasValue.IsFalse();

            (await list.Length()).Is(5);

            await list.RightPush(new[] { 1, 2, 3, 4, 5, 3 });

            await list.Remove(3);
            (await list.Range()).Is(1, 2, 4, 5, 1, 2, 4, 5);

            await list.Remove(4, 1);
            (await list.Range()).Is(1, 2, 5, 1, 2, 4, 5);

            await list.Remove(5, -1);
            (await list.Range()).Is(1, 2, 5, 1, 2, 4);
        }