Exemple #1
0
        internal RecipeBuilder Recipe(string?name = null)
        {
            var node = new RecipeBuilder(name);

            nodes.Add(node);
            return(node);
        }
Exemple #2
0
        public Dictionary <RecipeType, RecipeDetail> BuildRecipes()
        {
            var builder = new RecipeBuilder();

            LongswordRecipes(builder);

            return(builder.Build());
        }
Exemple #3
0
 private static void LongswordRecipes(RecipeBuilder builder)
 {
     builder.Create(RecipeType.BasicLongsword, SkillType.Blacksmithing)
     .Category(RecipeCategoryType.Longsword)
     .Name("Basic Longsword")
     .Resref("nw_wswls001")
     .RequirementPerk(PerkType.BlacksmithingRecipes, 1)
     .Component("quest_item", 2);
 }
        public void ExtractRecipeTest()
        {
            Recipe             rec          = PrepRecipe();
            RecipeInstructions instructions = PrepRecipeInstructions();
            NutritionList      nlist        = new NutritionList
            {
                Calories = 240,
                Fat      = 9
            };

            RecipeBuilder builder = new RecipeBuilder();
            MyRecipe      recipe  = builder.Build(rec);

            Assert.Equal("Sahil Makhija", recipe.Author);
            Assert.Equal("Dessert", recipe.Category);
            Assert.Equal(string.Empty, recipe.CookingMethod);
            Assert.Equal(TimeSpan.FromMinutes(20), recipe.CookTime);
            Assert.Equal("General", recipe.Cuisine);
            Assert.Equal("A delicious layered low carb dessert with the flavours of chocolate and coffee", recipe.Desciption);
            Assert.Equal(new List <string> {
                "LowFatDiet"
            }, recipe.Diets);
            Assert.Equal(new List <string>
            {
                "45 grams Almond Flour ( I use this one )",
                "30 grams Salted Butter",
                "1 Tbsp Unsweetened Coco Powder ( I recommend this one )",
                "150 grams Mascarpone cheese",
                "1 Tsp Vanilla Extract",
                "2 Tbsp Water",
                "1 Tsp Instant espresso powder",
                "100 ml Heavy Cream",
                "30 grams Dark Chocolate (85% or Higher) (I use Lindt 85%)",
                "Stevia to taste"
            }
                         , recipe.Ingredients);

            recipe.Instructions.Should().BeEquivalentTo(instructions);
            Assert.Equal("Keto Coffee & Chocolate Tart", recipe.Name);
            recipe.Nutrition.Should().BeEquivalentTo(nlist);
            Assert.Equal(TimeSpan.FromMinutes(10), recipe.PrepTime);
            Assert.Equal(3, recipe.Servings);
            Assert.Equal("http://www.janedoe.com/", recipe.Source);
        }
Exemple #5
0
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                AddRecipeDialog dialog = new AddRecipeDialog();
                if (dialog.ShowDialog() == true)
                {
                    int    newRecipeID = RecipeIDBuilder.GetRecipeID(context.Recipes);
                    Recipe r           = RecipeBuilder.BuildRecipe(dialog.titleTextBox.Text, dialog.directionTextBox.Text,
                                                                   dialog.recipeTypeListBox.SelectedValue.ToString(), newRecipeID, dialog.yeildTextBox.Text,
                                                                   dialog.servingSizeTextBox.Text, dialog.commentTextBox.Text);

                    if (string.IsNullOrWhiteSpace(r.Comment))
                    {
                        r.Comment = null;
                    }
                    if (string.IsNullOrWhiteSpace(r.ServingSize))
                    {
                        r.ServingSize = null;
                    }
                    if (string.IsNullOrWhiteSpace(r.Yield))
                    {
                        r.Yield = null;
                    }

                    context.AddNewRecipe(r);
                    recipeListBox.SelectedItem = null;
                    ClearFields();
                    context.RefreshData();
                    Recipe[] recipes = getRecipes();
                    recipeListBox.DataContext = recipes;
                }
            }
            catch (Exception ex)
            {
                var baseexception = ex.GetBaseException();
                errorLabel.Content = baseexception.Message;
            }
        }
Exemple #6
0
        public MainWindow()
        {
            InitializeComponent();
            Recipe recipe1 = RecipeBuilder.Builder()
                             .withName("Test1")
                             .withCategories(Category.BREAKFAST, Category.DRINK)
                             .withIngredients(IngredientBuilder.Builder()
                                              .WithName("JAJCA")
                                              .WithQuantity(2)
                                              .WithUnit(Unit.PIECE)
                                              .Build(), IngredientBuilder.Builder()
                                              .WithName("Mleko")
                                              .WithQuantity(2)
                                              .WithUnit(Unit.GLASS)
                                              .Build())
                             .withPortions(2)
                             .build();

            Recipe recipe2 = RecipeBuilder.Builder()
                             .withName("Test2")
                             .withCategories(Category.LUNCH, Category.VEGETARIAN)
                             .withIngredients(IngredientBuilder.Builder()
                                              .WithName("JAJCA")
                                              .WithQuantity(2)
                                              .WithUnit(Unit.PIECE)
                                              .Build(), IngredientBuilder.Builder()
                                              .WithName("Mleko")
                                              .WithQuantity(2)
                                              .WithUnit(Unit.GLASS)
                                              .Build())
                             .withPortions(2)
                             .build();


            RecipeManager = new RecipeManager(this);
            RecipeManager.Recipes.Add(recipe1);
            RecipeManager.Recipes.Add(recipe2);
            this.Categories.ItemsSource = Enum.GetValues(typeof(Category)).Cast <Category>();
        }
Exemple #7
0
        public void JsonRepository_Create_With_Ingredients_Succeeds()
        {
            var ingredient = new IngredientBuilder()
                             .With(1)
                             .With("Test Ingredient")
                             .Build();

            var recipe = new RecipeBuilder()
                         .With("Test with ingredients", "Has Ingredients", 1.5)
                         .Has(ingredient, 1, "ml")
                         .Build();

            var repo = new JsonRepository();

            repo
            .Create(recipe)
            .SaveChanges();

            repo = new JsonRepository();
            var added = repo.Recipes.Single(r => r.Id == recipe.Id);

            Assert.AreEqual(1, added.Ingredients.Count);
            Assert.AreEqual(1, added.Ingredients.Single().Quantity);
        }
Exemple #8
0
    // Public
    public static void CreateNewCharacter(NewCharacterController.CreateCharacterParams createParams)
    {
        CharacterParam.SetDefault();
        // Set Start Scene
        CharacterParam.param.sceneName = "SandBox";
        // Set Character Sex
        CharacterParam.privateParams.sex = createParams.sex;
        switch (createParams.sex)
        {
        /// Male Setup
        case PrivateParam.CharacterSex.MALE:
            CharacterParam.param.moveSpeed = 3.3f;
            // Set Crit Param
            CharacterParam.param.critChance = 0;
            CharacterParam.param.critPower  = 10;
            // HP
            CharacterParam.privateParams.maxHP = 130;
            CharacterParam.param.HP            = CharacterParam.privateParams.maxHP;
            // MP
            CharacterParam.privateParams.maxMP = 100;
            CharacterParam.param.MP            = CharacterParam.privateParams.maxMP;
            // Energy
            CharacterParam.privateParams.maxEnergy = 100;
            CharacterParam.param.energy            = CharacterParam.privateParams.maxEnergy;
            // Hunger
            CharacterParam.privateParams.maxHunger = 100;
            CharacterParam.param.hunger            = CharacterParam.privateParams.maxHunger;
            // Abylitys
            CharacterParam.abilitys.stamina  = 9;
            CharacterParam.abilitys.body     = 10;
            CharacterParam.abilitys.agility  = 9;
            CharacterParam.abilitys.strength = 10;



            break;

        /// Female Setup
        case PrivateParam.CharacterSex.FEMALE:
            CharacterParam.param.moveSpeed = 3.7f;
            // Set Crit Param
            CharacterParam.param.critChance = 10;
            CharacterParam.param.critPower  = 0;
            // HP
            CharacterParam.privateParams.maxHP = 100;
            CharacterParam.param.HP            = CharacterParam.privateParams.maxHP;
            // MP
            CharacterParam.privateParams.maxMP = 130;
            CharacterParam.param.MP            = CharacterParam.privateParams.maxMP;
            // Energy
            CharacterParam.privateParams.maxEnergy = 100;
            CharacterParam.param.energy            = CharacterParam.privateParams.maxEnergy;
            // Hunger
            CharacterParam.privateParams.maxHunger = 100;
            CharacterParam.param.hunger            = CharacterParam.privateParams.maxHunger;
            // Abylitys
            CharacterParam.abilitys.stamina  = 10;
            CharacterParam.abilitys.body     = 9;
            CharacterParam.abilitys.agility  = 10;
            CharacterParam.abilitys.strength = 9;



            break;
        }
        // Abylitys
        CharacterParam.abilitys.intellect = 10;



        // Add Start Items
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("CottunCap"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("CottonShirt"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("CottunBoots"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("CottunCloak"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("GoldAmulet"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("GoldRing"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("LeatherBelt"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("LeatherGloves"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("LeatherPants"));

        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronAxe"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronHammer"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronKnife"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronNeedle"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronPickaxe"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronPliers"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronSaw"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronScissors"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronShovel"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("IronSickle"));

        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("BandageBelt"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("BandageBelt"));
        CharacterParam.itemInventory.AddItem(ItemBuilder.GetItemByName("BandageBelt"));

        // Add Base Skills
        CharacterParam.skillInventory.AddSkill(SkillBuilder.GetSkillByName("BaseAttack"));
        // Add Base Recipes
        CharacterParam.recipeInventory.AddRecipe(RecipeBuilder.GetRecipeByName("Bandage"));
    }