コード例 #1
0
    public void TestGetRecipePass()
    {
        // Serialize schema
        GameObjectsHandler goh = GameObjectsHandler.WithFilepath(getFilepath(itemSchemaV1));

        // Create valid list of available objects
        List <RecipeElement> availables = new List <RecipeElement>();

        availables.Add(new RecipeElement(4, 1));
        availables.Add(new RecipeElement(5, 1));

        // Obtain valid output
        GameObjectEntry goe = goh.GetRecipe(availables, 7);

        // Asserts
        Assert.That(goe.name, Is.EqualTo("steel"));
    }
コード例 #2
0
    public void TestGetRecipeFail()
    {
        // Serialize schema
        GameObjectsHandler goh = GameObjectsHandler.WithFilepath(getFilepath(itemSchemaV1));

        // Create valid list of available objects
        List <RecipeElement> availables = new List <RecipeElement>();

        availables.Add(new RecipeElement(5, 1));

        // Obtain valid output
        GameObjectEntry goe = goh.GetRecipe(availables, 7);

        // Asserts
        if (goe != null)
        {
            // Failure case, no objects are valid. Hence goe should be null
            Assert.Fail();
        }
    }