Exemple #1
0
        public void RedisStorage_AddToList_Multiple()
        {
            var storage = new RedisStorage(_multiplexer.Object);

            storage.AddToList(new StorageKey("storage", "key"), new { Value = "one" });
            storage.AddToList(new StorageKey("storage", "key"), new { Value = "two" });

            _db.Verify(exp => exp.ListRightPushAsync(It.IsAny <RedisKey>(), new RedisValue("{Value: 'one'}"), When.Always, CommandFlags.None), Times.Once);
            _db.Verify(exp => exp.ListRightPushAsync(It.IsAny <RedisKey>(), new RedisValue("{Value: 'two'}"), When.Always, CommandFlags.None), Times.Once);
        }
        public void Options_Serializer_Override_Serialize()
        {
            var serializer = new Mock <ISerializer>();

            serializer.Setup(exp => exp.Serialize(It.IsAny <object>())).Returns(() => "Testvalue");

            var options = new RedisStorageOptions
            {
                Serializer = serializer.Object
            };

            var storage = new RedisStorage(_multiplexer.Object, options);

            storage.AddToList(new StorageKey("storage", "key"), new StorageModel {
                Value = "value"
            });

            _db.Verify(exp => exp.ListRightPushAsync(It.IsAny <RedisKey>(), new RedisValue("Testvalue"), When.Always, CommandFlags.None), Times.Once);
        }