81 lines
2.5 KiB
C#
81 lines
2.5 KiB
C#
using NUnit.Framework;
|
|
using PkmnLibSharp.StaticData;
|
|
using PkmnLibSharp.StaticData.Libraries;
|
|
|
|
namespace PkmnLibRSharpTests.StaticData.Libraries
|
|
{
|
|
public class NatureLibraryTests
|
|
{
|
|
[Test]
|
|
public void CreateNatureLibrary()
|
|
{
|
|
using var library = new NatureLibrary(0);
|
|
}
|
|
|
|
[Test]
|
|
public void LoadNatures()
|
|
{
|
|
using var library = new NatureLibrary(0);
|
|
using var nature1 = Nature.NeutralNature();
|
|
using var nature2 = new Nature(Statistic.Attack, Statistic.Defense);
|
|
library.LoadNature("foo", nature1);
|
|
library.LoadNature("bar", nature2);
|
|
}
|
|
|
|
[Test]
|
|
public void LoadAndGetNature()
|
|
{
|
|
using var library = new NatureLibrary(0);
|
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
|
library.LoadNature("foo", nature1);
|
|
|
|
using (var n = library.TryGetNature("foo"))
|
|
{
|
|
Assert.AreEqual(Statistic.Attack, n.Value!.IncreasedStat);
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void LoadAndGetNatureTwice()
|
|
{
|
|
using var library = new NatureLibrary(0);
|
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
|
library.LoadNature("foo", nature1);
|
|
|
|
using (var n = library.TryGetNature("foo"))
|
|
{
|
|
Assert.That(n.HasValue);
|
|
Assert.AreEqual(Statistic.Attack, n.Value!.IncreasedStat);
|
|
}
|
|
using (var n = library.TryGetNature("foo"))
|
|
{
|
|
Assert.That(n.HasValue);
|
|
Assert.AreEqual(Statistic.Attack, n.Value!.IncreasedStat);
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void GetUnknownNature()
|
|
{
|
|
using var library = new NatureLibrary(0);
|
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
|
|
|
using var n = library.TryGetNature("foo");
|
|
Assert.False(n.HasValue);
|
|
}
|
|
|
|
[Test]
|
|
public void GetNatureName()
|
|
{
|
|
using var library = new NatureLibrary(0);
|
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
|
library.LoadNature("foo", nature1);
|
|
|
|
using (var n = library.TryGetNature("foo"))
|
|
{
|
|
Assert.AreEqual("foo", library.GetNatureName(n));
|
|
}
|
|
}
|
|
|
|
}
|
|
} |