71 lines
2.3 KiB
C#
71 lines
2.3 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);
|
||
|
|
||
|
Assert.That(library.TryGetNature("foo", out var n));
|
||
|
Assert.AreEqual(Statistic.Attack, n.IncreasedStat);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void LoadAndGetNatureTwice()
|
||
|
{
|
||
|
using var library = new NatureLibrary(0);
|
||
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
||
|
library.LoadNature("foo", nature1);
|
||
|
|
||
|
Assert.That(library.TryGetNature("foo", out var n));
|
||
|
Assert.AreEqual(Statistic.Attack, n.IncreasedStat);
|
||
|
|
||
|
Assert.That(library.TryGetNature("foo", out n));
|
||
|
Assert.AreEqual(Statistic.Attack, n.IncreasedStat);
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void GetUnknownNature()
|
||
|
{
|
||
|
using var library = new NatureLibrary(0);
|
||
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
||
|
|
||
|
Assert.False(library.TryGetNature("foo", out _));
|
||
|
}
|
||
|
|
||
|
[Test]
|
||
|
public void GetNatureName()
|
||
|
{
|
||
|
using var library = new NatureLibrary(0);
|
||
|
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
||
|
library.LoadNature("foo", nature1);
|
||
|
|
||
|
Assert.That(library.TryGetNature("foo", out var n));
|
||
|
Assert.AreEqual("foo", library.GetNatureName(n));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|