Added tests for Item wrapper
This commit is contained in:
parent
6c0d320656
commit
6491360dbe
|
@ -20,7 +20,6 @@ namespace PkmnLibSharp.Library
|
|||
public string Name => _name ??= CreatureSpecies.GetName(Ptr).PtrString();
|
||||
public string GrowthRate => _growthRate ??= CreatureSpecies.GetGrowthRate(Ptr).PtrString();
|
||||
|
||||
|
||||
public bool HasForme(string s)
|
||||
{
|
||||
return CreatureSpecies.HasVariant(Ptr, s.ToPtr()) == MarshalHelper.True;
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
using NUnit.Framework;
|
||||
using Pkmnlib;
|
||||
using PkmnLibSharp.Library;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
{
|
||||
public class ItemTests
|
||||
{
|
||||
[Test]
|
||||
public void ConstructDestruct()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
item.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetName()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
Assert.AreEqual("foobar", item.Name);
|
||||
item.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetCategory()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
Assert.AreEqual(ItemCategory.MiscItem, item.Category);
|
||||
item.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetBattleCategory()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
Assert.AreEqual(BattleItemCategory.Healing, item.BattleCategory);
|
||||
item.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetPrice()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
Assert.AreEqual(1000, item.Price);
|
||||
item.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void HasFlag()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
Assert.True(item.HasFlag("testFlag"));
|
||||
Assert.False(item.HasFlag("non-existing"));
|
||||
item.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetFlingPower()
|
||||
{
|
||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||
new[] {"testFlag"}, 50);
|
||||
Assert.AreEqual(50, item.FlingPower);
|
||||
item.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue