2022-10-01 13:39:33 +00:00
|
|
|
using NUnit.Framework;
|
|
|
|
using PkmnLibSharp.StaticData;
|
|
|
|
using PkmnLibSharp.StaticData.Libraries;
|
|
|
|
|
|
|
|
namespace PkmnLibRSharpTests.StaticData.Libraries
|
|
|
|
{
|
|
|
|
public class NatureLibraryTests
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void CreateNatureLibrary()
|
|
|
|
{
|
2023-06-25 14:30:12 +00:00
|
|
|
var _ = NatureLibrary.Create(0);
|
2022-10-01 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void LoadNatures()
|
|
|
|
{
|
2023-06-25 14:30:12 +00:00
|
|
|
var library = NatureLibrary.Create(0);
|
|
|
|
var nature1 = Nature.NeutralNature();
|
|
|
|
var nature2 = Nature.Create(Statistic.Attack, Statistic.Defense);
|
2022-10-01 13:39:33 +00:00
|
|
|
library.LoadNature("foo", nature1);
|
|
|
|
library.LoadNature("bar", nature2);
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void LoadAndGetNature()
|
|
|
|
{
|
2023-06-25 14:30:12 +00:00
|
|
|
var library = NatureLibrary.Create(0);
|
|
|
|
var nature1 = Nature.Create(Statistic.Attack, Statistic.Defense);
|
2022-10-01 13:39:33 +00:00
|
|
|
library.LoadNature("foo", nature1);
|
2023-06-25 14:30:12 +00:00
|
|
|
|
|
|
|
Assert.That(library.TryGetNature("foo", out var n));
|
|
|
|
Assert.AreEqual(Statistic.Attack, n!.IncreasedStat);
|
2022-10-01 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void LoadAndGetNatureTwice()
|
|
|
|
{
|
2023-06-25 14:30:12 +00:00
|
|
|
var library = NatureLibrary.Create(0);
|
|
|
|
var nature1 = Nature.Create(Statistic.Attack, Statistic.Defense);
|
2022-10-01 13:39:33 +00:00
|
|
|
library.LoadNature("foo", nature1);
|
2023-06-25 14:30:12 +00:00
|
|
|
Assert.That(library.TryGetNature("foo", out var n));
|
|
|
|
Assert.AreEqual(Statistic.Attack, n!.IncreasedStat);
|
|
|
|
Assert.That(library.TryGetNature("foo", out var n2));
|
|
|
|
Assert.AreEqual(Statistic.Attack, n2!.IncreasedStat);
|
2022-10-01 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void GetUnknownNature()
|
|
|
|
{
|
2023-06-25 14:30:12 +00:00
|
|
|
var library = NatureLibrary.Create(0);
|
|
|
|
Assert.IsFalse(library.TryGetNature("foo", out _));
|
2022-10-01 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void GetNatureName()
|
|
|
|
{
|
2023-06-25 14:30:12 +00:00
|
|
|
var library = NatureLibrary.Create(0);
|
|
|
|
var nature1 = Nature.Create(Statistic.Attack, Statistic.Defense);
|
2022-10-01 13:39:33 +00:00
|
|
|
library.LoadNature("foo", nature1);
|
2023-06-25 14:30:12 +00:00
|
|
|
Assert.That(library.TryGetNature("foo", out var n));
|
|
|
|
Assert.AreEqual("foo", library.GetNatureName(n!));
|
2022-10-01 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|