public void Add_model_and_score_should_success() { string key = "SortedSetItemKey"; provider.Delete(key); var person1 = MockData.GetPersonMock(); bool actual = provider.AddSortedSet(key, person1, 700); actual.Should().BeTrue(); var person2 = MockData.GetPersonMock(); actual = provider.AddSortedSet(key, person2, 500); actual.Should().BeTrue(); var redisPersons = provider.GetSortedSets <Person>(key); redisPersons.FirstOrDefault().Id.Should().Be(person2.Id); redisPersons.LastOrDefault().Id.Should().Be(person1.Id); actual = provider.Delete(key); actual.Should().BeTrue(); actual = provider.Exists(key); actual.Should().BeFalse(); }
public void Add_must_success() { string key = "SMemberKey"; provider.Delete(key); var persons = MockData.GetPersonsMock(15); long addedCount = provider.AddSet <Person>(key, persons); addedCount.Should().Be(15); var redisPersons = provider.GetSet <Person>(key); foreach (var redisPerson in redisPersons) { persons.Any(x => x.Id == redisPerson.Id).Should().BeTrue(); } bool actual = provider.Delete(key); actual.Should().BeTrue(); actual = provider.Exists(key); actual.Should().BeFalse(); }
public void Add_model_with_expireTime_TimeSpan_success() { string key = "stringsetkey"; provider.Delete(key); var person = MockData.GetPersonMock(); var timeOut = new TimeSpan(0, 0, 5); bool actual = provider.Add(key, person, timeOut); actual.Should().BeTrue(); actual = provider.Exists(key); actual.Should().BeTrue(); Thread.Sleep(timeOut); actual = provider.Exists(key); actual.Should().BeFalse(); }