Ejemplo n.º 1
0
        public void TestThatFoodGroupGetAllGetsFoodGroups()
        {
            var foodGroupAtRoot = _systemDataRepository.Insert(new FoodGroup {
                Parent = null, IsActive = true
            });

            try
            {
                var foodGroupWithParent = _systemDataRepository.Insert(new FoodGroup {
                    Parent = foodGroupAtRoot, IsActive = true
                });
                try
                {
                    var result = _systemDataRepository.FoodGroupGetAll().ToList();
                    Assert.That(result, Is.Not.Null);
                    Assert.That(result, Is.Not.Empty);
                    Assert.That(result.Any(m => m.Identifier.HasValue && m.Identifier.Equals(foodGroupAtRoot.Identifier)), Is.True);
                    Assert.That(result.Any(m => m.Identifier.HasValue && m.Identifier.Equals(foodGroupWithParent.Identifier)), Is.True);
                }
                finally
                {
                    _systemDataRepository.Delete(foodGroupWithParent);
                }
            }
            finally
            {
                _systemDataRepository.Delete(foodGroupAtRoot);
            }
        }