PkmnLibSharp/PkmnLibSharpTests/Library/ItemTests.cs

73 lines
2.7 KiB
C#
Raw Normal View History

2022-03-12 09:32:31 +00:00
using System;
2020-05-05 18:46:17 +00:00
using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Items;
2020-05-05 18:46:17 +00:00
namespace PkmnLibSharpTests.Library
{
public class ItemTests
{
[Test]
public void ConstructDestruct()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
item.Dispose();
}
2022-03-12 09:32:31 +00:00
2020-05-05 18:46:17 +00:00
[Test]
public void GetName()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
Assert.AreEqual("foobar", item.Name);
item.Dispose();
}
2022-03-12 09:32:31 +00:00
2020-05-05 18:46:17 +00:00
[Test]
public void GetCategory()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
Assert.AreEqual(ItemCategory.MiscItem, item.Category);
item.Dispose();
}
2022-03-12 09:32:31 +00:00
2020-05-05 18:46:17 +00:00
[Test]
public void GetBattleCategory()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
Assert.AreEqual(BattleItemCategory.Healing, item.BattleCategory);
item.Dispose();
}
2022-03-12 09:32:31 +00:00
2020-05-05 18:46:17 +00:00
[Test]
public void GetPrice()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
Assert.AreEqual(1000, item.Price);
item.Dispose();
}
2022-03-12 09:32:31 +00:00
2020-05-05 18:46:17 +00:00
[Test]
public void HasFlag()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
Assert.True(item.HasFlag("testFlag"));
Assert.False(item.HasFlag("non-existing"));
item.Dispose();
}
2022-03-12 09:32:31 +00:00
2020-05-05 18:46:17 +00:00
[Test]
public void GetFlingPower()
{
2022-03-12 09:32:31 +00:00
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
2020-05-05 18:46:17 +00:00
Assert.AreEqual(50, item.FlingPower);
item.Dispose();
}
}
}