예제 #1
0
        public async Task Append_WhenMultipleItems_AddsAllGivenValueToEndOfList()
        {
            // Arrange
            var redcache = new RedcacheService(_fixture.Multiplexer, _serializer);
            var key      = _fixture.GetRandomKey();

            // Act
            await redcache.AppendList(key, new[] { "value1", "value2" });

            var cachedList1 = await redcache.GetList <string>(key);

            await redcache.AppendList(key, new[] { "value3", "value4" });

            var cachedList2 = await redcache.GetList <string>(key);

            // Assert
            cachedList1.Should().Equal("value1", "value2");
            cachedList2.Should().Equal("value1", "value2", "value3", "value4");
        }
예제 #2
0
        public async Task GetList_WhenPagerIsSpecified_ReturnsListPage(int from, int to, int[] expectedList)
        {
            // Arrange
            var redcache = new RedcacheService(_fixture.Multiplexer, _serializer);
            var key      = _fixture.GetRandomKey();

            // Act
            await redcache.AppendList(key, Enumerable.Range(1, 100).ToArray());

            var cachedList = await redcache.GetList <int>(key, from..to);

            // Assert
            cachedList.Should().Equal(expectedList);
        }