public void Deserialize_ModifiedRecipe_FullDetails(string itemName, string ingredient, string linkedItems) { string serialized = "ModifiedRecipe:" + "\r\n" + "(" + "\r\n" + $" ItemID:{itemName};" + "\r\n" + " AmountCrafted:4;" + "\r\n" + " Ingredients:" + "\r\n" + " (" + "\r\n" + $" ItemID:{ingredient};" + "\r\n" + " Required:2;" + "\r\n" + " )," + "\r\n" + " (" + "\r\n" + " ItemID:Copper;" + "\r\n" + " Required:3;" + "\r\n" + " );" + "\r\n" + $" LinkedItemIDs:{linkedItems};" + "\r\n" + ");" + "\r\n"; var recipe = new ModifiedRecipe(); recipe.FromString(serialized); Assert.AreEqual(TechType.Aerogel, recipe.ItemID); Assert.AreEqual(4, recipe.AmountCrafted); Assert.AreEqual(2, recipe.IngredientsCount); Assert.AreEqual(TechType.Titanium, recipe.GetIngredient(0).ItemID); Assert.AreEqual(2, recipe.GetIngredient(0).Required); Assert.AreEqual(TechType.Copper, recipe.GetIngredient(1).ItemID); Assert.AreEqual(3, recipe.GetIngredient(1).Required); Assert.AreEqual(2, recipe.LinkedItemsCount); Assert.AreEqual(TechType.Silver, recipe.GetLinkedItem(0)); Assert.AreEqual(TechType.Gold, recipe.GetLinkedItem(1)); }
public void Deserialize_ModifiedRecipesList_Unlocks() { const string serialized = "ModifiedRecipes:" + "\r\n" + "(" + "\r\n" + " ItemID:Aerogel;" + "\r\n" + " AmountCrafted:1;" + "\r\n" + " Ingredients:" + "\r\n" + " (" + "\r\n" + " ItemID:Titanium;" + "\r\n" + " Required:2;" + "\r\n" + " )," + "\r\n" + " (" + "\r\n" + " ItemID:Copper;" + "\r\n" + " Required:3;" + "\r\n" + " );" + "\r\n" + " LinkedItemIDs:Silver,Gold;" + "\r\n" + " ForceUnlockAtStart:NO;" + "\r\n" + " Unlocks:ComputerChip,Cyclops;" + "\r\n" + ");" + "\r\n"; var recipeList = new ModifiedRecipeList(); recipeList.FromString(serialized); ModifiedRecipe recipe = recipeList[0]; Assert.AreEqual(TechType.Aerogel, recipe.ItemID); Assert.AreEqual(1, recipe.AmountCrafted); Assert.AreEqual(2, recipe.IngredientsCount); Assert.AreEqual(TechType.Titanium, recipe.GetIngredient(0).ItemID); Assert.AreEqual(2, recipe.GetIngredient(0).Required); Assert.AreEqual(TechType.Copper, recipe.GetIngredient(1).ItemID); Assert.AreEqual(3, recipe.GetIngredient(1).Required); Assert.AreEqual(2, recipe.LinkedItemsCount); Assert.AreEqual(TechType.Silver, recipe.GetLinkedItem(0)); Assert.AreEqual(TechType.Gold, recipe.GetLinkedItem(1)); Assert.AreEqual(false, recipe.ForceUnlockAtStart); Assert.AreEqual(2, recipe.UnlocksCount); Assert.AreEqual(TechType.ComputerChip, recipe.GetUnlock(0)); Assert.AreEqual(TechType.Cyclops, recipe.GetUnlock(1)); }