コード例 #1
0
        public void MYSQLDbAccessTests()
        {
            List <int> recipesIds = MySQLDbAccess.GetRecipesIdsThatContainsIngredients(new List <Ingredient>()
            {
                new Ingredient()
                {
                    Id = 283, Name = "Açucar"
                }
            }, new RecipeType()
            {
                Id = 3, Name = "Vegetariano"
            });

            List <Unit>          units      = MySQLDbAccess.GetAllUnits();
            List <ApplianceType> appliances = MySQLDbAccess.GetAllApplianceTypes();
            Recipe recipe = MySQLDbAccess.GetRecipeById(2);

            //List<int> recipesIds = MySQLDbAccess.GetRecipesIdsThatContainsIngredients(new List<Ingredient>() { new Ingredient() { Id = 24, Name = "Banana" } });
            List <Ingredient> ingredients    = MySQLDbAccess.GetAllIngredients();
            Ingredient        ingredient     = MySQLDbAccess.GetIngredientById(111);
            Ingredient        ingredient2    = MySQLDbAccess.GetIngredientByName("Limão");
            User                  user       = MySQLDbAccess.GetUserById(1);
            RecipeType            recipeType = MySQLDbAccess.GetRecipeTypeById(1);
            Unit                  unit       = MySQLDbAccess.GetUnitTypeById(1);
            List <IngredientInfo> infos      = MySQLDbAccess.GetIngredientInfosFromRecipe(1);
        }
コード例 #2
0
        public App()
        {
            InitializeComponent();
#if DEBUG
            HotReloader.Current.Run(this);
#endif
            Utils.AllIngridients = MySQLDbAccess.GetAllIngredients();
            Utils.AllUnits       = MySQLDbAccess.GetAllUnits();
            Utils.AllRecipeTypes = MySQLDbAccess.GetAllRecipeTypes();
            Utils.AllAppliances  = MySQLDbAccess.GetAllApplianceTypes();

            MainPage = new NavigationPage(new MainPage());
        }
コード例 #3
0
ファイル: DatabaseTests.cs プロジェクト: 1989Dias/rangoja
 public void MYSQLDbAccessTests()
 {
     List <int> recipesIds = MySQLDbAccess.GetRecipesIdsThatContainsIngredients(new List <Ingredient>()
     {
         new Ingredient()
         {
             Id = 111, Name = "Limão"
         }
     });
     List <Ingredient> ingredients    = MySQLDbAccess.GetAllIngredients();
     Ingredient        ingredient     = MySQLDbAccess.GetIngredientById(111);
     Ingredient        ingredient2    = MySQLDbAccess.GetIngredientByName("Limão");
     User                  user       = MySQLDbAccess.GetUserById(1);
     RecipeType            recipeType = MySQLDbAccess.GetRecipeTypeById(1);
     Unit                  unit       = MySQLDbAccess.GetUnitTypeById(1);
     List <IngredientInfo> infos      = MySQLDbAccess.GetIngredientInfosFromRecipe(1);
     Recipe                recipe     = MySQLDbAccess.GetRecipeById(1);
 }
コード例 #4
0
        public void InsertRecipeTest()
        {
            Recipe recipe = new Recipe();

            recipe.Name            = "Mousse de maracujá";
            recipe.PreparationMode = "Em um liquidificador, bata o creme de leite, o " +
                                     "leite condensado e o suco concentrado de maracujá." +
                                     "Em uma tigela, despeje a mistura e leve à geladeira por, no mínimo, 4 horas.";
            recipe.PreparationTime = "5 minutos";
            recipe.RecipeType      = new RecipeType(1, "Regular");
            recipe.Portion         = "6 porções";
            recipe.Appliance       = new ApplianceType(12, "Liquidificador");
            recipe.Ingredients     = new List <IngredientInfo>()
            {
                new IngredientInfo(new Ingredient(313, "Suco de maracujá"), new Unit(3, "ml"), "350"),
                new IngredientInfo(new Ingredient(311, "Leite condensado"), new Unit(10, "xícara"), "1"),
                new IngredientInfo(new Ingredient(312, "Creme de leite"), new Unit(10, "xícara"), "1"),
            };
            MySQLDbAccess.InsertRecipe(recipe);
        }