Пример #1
0
        public async void Count_of_collection_should_tell_10_when_10_entities()
        {
            var users = User.GetManyRandomUsers(10);
            await _repo.AddRangeAsync(users, new Query <User> {
                Verb = Domain.Helpers.HttpVerbs.Post
            });

            await _storage.SaveChangesAsync();

            var result = await _collection.GetAsync(new Query <User>());

            Assert.Equal(10, result.Count);
        }
Пример #2
0
        public async void Default_Paging_should_be_0_to_10()
        {
            IEnumerable <User> users = User.GetManyRandomUsers(20);
            await _repo.AddRangeAsync(users, new Query <User> {
                Verb = Domain.Helpers.HttpVerbs.Post
            });

            await _storage.SaveChangesAsync();

            var query = new Query <User>
            {
                Page = new Page(0, 10, int.MaxValue)
            };
            ISelection <User> result = await _collection.GetAsync(query);

            Assert.Equal(0, query.Page.Offset);
            Assert.Equal(10, query.Page.Limit);
            Assert.Equal(10, result.Items.Count());
            Assert.Equal(20, result.Count);
        }