示例#1
0
        public async Task StringSetBitMultipleByteResponse()
        {
            const string key = "TestKey";

            var db = new MockRedisDatabase(SystemClock.Instance);
            await db.StringSetBitAsync(key, 8, true);

            await ReturnsExpected(db, key, new byte[] { 0, 0x80 });
        }
示例#2
0
        public async Task MultipleStringSetBit()
        {
            const string key = "TestKey";

            var db = new MockRedisDatabase(SystemClock.Instance);

            db.StringSetBitAsync(key, 0, true).GetAwaiter().GetResult();
            await ReturnsExpected(db, key, new byte[] { 0x80 });

            db.StringSetBitAsync(key, 1, true).GetAwaiter().GetResult();
            await ReturnsExpected(db, key, new byte[] { 0xC0 });

            db.StringSetBitAsync(key, 0, false).GetAwaiter().GetResult();
            await ReturnsExpected(db, key, new byte[] { 0x40 });
        }
示例#3
0
        private async Task ReturnsExpected(MockRedisDatabase db, string key, byte[] expected)
        {
            byte[] locations = await db.StringGetAsync(key);

            locations.Should().Equal(expected);
        }