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

        // Create list of available objects, with too few values
        List <RecipeElement> availables = new List <RecipeElement>();

        availables.Add(new RecipeElement(2, 6));

        GameObjectEntry goe = goh.GetBlueprint(availables, 7);

        if (goe != null)
        {
            // Failure case
            // GetBlueprint returns non-null object where null expected
            Assert.Fail();
        }
    }
コード例 #2
0
    public void TestGetSingleElementBlueprintPass()
    {
        // Serialize schema
        GameObjectsHandler goh = GameObjectsHandler.WithFilepath(getFilepath(itemSchemaV1));

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

        availables.Add(new RecipeElement(2, 8));

        try {
            GameObjectEntry goe = goh.GetBlueprint(availables, 7);

            //Assert values are correct
            Assert.That(goe.name, Is.EqualTo("furnace"));
        } catch (InvalidDataException e) {
            // Exception thrown, failure case
            Assert.Fail();
        }
    }