public async Task Filter_WhenCalled_ShouldReturnFilteredItems()
        {
            var item = new Game()
            {
                Name      = "example",
                CreatedBy = "user",
                IsDeleted = false,
                Ready     = true
            };
            var item2 = new Game()
            {
                Name      = "example",
                CreatedBy = "user",
                IsDeleted = false,
                Ready     = true
            };
            var item3 = new Game()
            {
                Name      = "example",
                CreatedBy = "user",
                IsDeleted = false,
                Ready     = false
            };
            var entityRepository = new GamesRepository(_dbContext);
            var added            = await entityRepository.Add(item);

            await entityRepository.Add(item2);

            await entityRepository.Add(item3);

            var found = entityRepository.Filter(x => x.Ready);

            found.Count().ShouldBe(2);
        }
示例#2
0
        public IActionResult Filter(int?id)
        {
            string jsonData = new StreamReader(Request.Body).ReadToEnd();

            return(new JsonResult(repository.Filter(jsonData)));
        }