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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        public void Add_model_should_add_success()
        {
            string key = "stringsetkey";

            provider.Delete(key);

            var person = MockData.GetPersonMock();

            bool actual = provider.Add(key, person);

            actual.Should().BeTrue();
        }