示例#1
0
        public void GetValuesTest()
        {
            var cateorie1 = new Category()
            {
                Id   = 1,
                Name = "cateorie1",
            };
            var cateorie2 = new Category()
            {
                Id       = 2,
                Name     = "cateorie2",
                ParentId = 1
            };
            var cateorie3 = new Category()
            {
                Id       = 3,
                Name     = "cateorie3",
                ParentId = 2
            };

            _context.Categories.Add(cateorie1);
            _context.Categories.Add(cateorie2);
            _context.Categories.Add(cateorie3);
            _context.SaveChanges();


            _catagoriesHelper.Getvalues(1);

            _catagoriesHelper.Categories.Should().NotBeEmpty();
            _catagoriesHelper.Categories.Should().HaveCount(3);
        }
示例#2
0
 public IEnumerable <int> GetCategoryIds(int id)
 {
     _helper.Getvalues(id);
     return(_helper.Categories
            .Select(p => p.Id)
            .ToList());
 }