コード例 #1
0
        public IActionResult StringType(SeedStringTypeViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                for (int i = 1; i <= viewModel.NumberOfKeys; i++)
                {
                    var key   = $"{i}:{i+1}:seed_string";
                    var value = DummyObjects.GetOneValue();
                    _redisRepositoryString.Insert(key, value);
                }

                new SetTempDataMessage()
                .Display(TempData, "OK", "Seed has complete.");
            }

            return(View(viewModel));
        }
コード例 #2
0
        public void Delete_insert_a_new_record_then_delete_it_then_confirm_its_gone()
        {
            // Arrange
            string expected = null;
            var    key      = $"123:delete:{Guid.NewGuid()}";
            var    value    = DummyObjects.GetListWithNValues(10);

            redisRepositoryString.Insert(key, value);

            // Act
            var insertedValue = redisRepositoryString.Select(key);

            redisRepository.Delete(key);
            var actual = redisRepositoryString.Select(key);

            // Assert
            Assert.AreEqual(insertedValue, value);
            Assert.AreEqual(actual, expected);
        }