public ArticleLogic() { _articleRepository = new ArticleRepository(StorageTypeSetting.Setting); _userRepository = new UserRepository(StorageTypeSetting.Setting); _nutrientRepository = new NutrientRepository(StorageTypeSetting.Setting); _nutrientIntakeRepository = new NutrientIntakeRepository(StorageTypeSetting.Setting); }
public void shouldImportIronRDI() { var nutrientRecommendationRepository = new NutrientRecommendationRepository(); var nutrientRepository = new NutrientRepository(); new NutrientRecommendationImportEngine("Hibernate.cfg.xml", true).Import(); var nutrientRecommendation = nutrientRecommendationRepository.GetByNutrient(nutrientRepository.GetByName(NutrientEntity.IronInmG.ToString())); Assert.That(nutrientRecommendation.GetValue("Man",12), Is.EqualTo(11M)); }
protected override void LoadTestData() { var nutrientRepository = new NutrientRepository(); nutrient = nutrientRepository.SaveOrUpdate(new Nutrient {Name = "Iron"}); var nutrient2 = nutrientRepository.SaveOrUpdate(new Nutrient { Name = "Waste" }); var nutrientRecommendationRepository = new NutrientRecommendationRepository(); nutrientRecommendationRepository.SaveOrUpdate(CreateRecommendation(nutrient2, "Man", 1,2,3)); nutrientRecommendationRepository.SaveOrUpdate(CreateRecommendation(nutrient, "Kvinna", 1, 2, 4)); }
public static async Task Main(string[] args) { var repository = new NutrientRepository(); var commandHandler = new CreateNutrientHandler(repository); var command = new CreateNutrient("Vitamin D"); await commandHandler.HandleCommandAsync(command); var queryHandler = new ListNutrientsHandler(repository); var query = new ListNutrients(o => o.Title == "Vitamin D"); var result = await queryHandler.HandleQueryAsync(query); System.Console.ReadKey(); }
public void shouldHaveGidInGraph() { Browser.GoTo(Url + "/?graphlines=" + NutrientEntity.EnergyInKcal); var nutrient = new NutrientRepository().GetByName(NutrientEntity.EnergyInKcal.ToString()); Assert.That(Browser.Html, Contains.Substring("<GRAPH gid=\"" + nutrient.Id)); }
protected override void LoadTestData() { var nutrientRepository = new NutrientRepository(); var nutrient = nutrientRepository.SaveOrUpdate(new Nutrient {Name = "EnergyInKcal"}); var nutrient2 = nutrientRepository.SaveOrUpdate(new Nutrient {Name = "Iron"}); }
public void createIngredientIfNotExist(string name) { var ingredientRepository = new IngredientRepository(); //var ingredientNutrientRepository = new IngredientNutrientRepository(); var nutriantRepository = new NutrientRepository(); var energyInKcalNutrient = nutriantRepository.GetByName(NutrientEntity.EnergyInKcal.ToString()); var fatInG = nutriantRepository.GetByName(NutrientEntity.FatInG.ToString()); if (ingredientRepository.Get(name) == null) { var ingredient = new Ingredient {Name = name, WeightInG = 100}; ingredient.IngredientNutrients = new List<IngredientNutrient> {new IngredientNutrient {Nutrient = energyInKcalNutrient, Value = 100, Ingredient = ingredient}, new IngredientNutrient {Nutrient = fatInG, Value = 200, Ingredient = ingredient}}; ingredientRepository.SaveOrUpdate(ingredient); } }
public NutrientLogic() { _nutrientRepository = new NutrientRepository(StorageTypeSetting.Setting); _userRepository = new UserRepository(StorageTypeSetting.Setting); }