PkmnLibRSharp/PkmnLibRSharpTests/StaticData/Libraries/NatureLibraryTests.cs

66 lines
2.1 KiB
C#
Raw Normal View History

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()
{
var _ = NatureLibrary.Create(0);
2022-10-01 13:39:33 +00:00
}
[Test]
public void LoadNatures()
{
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()
{
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);
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()
{
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);
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()
{
var library = NatureLibrary.Create(0);
Assert.IsFalse(library.TryGetNature("foo", out _));
2022-10-01 13:39:33 +00:00
}
[Test]
public void GetNatureName()
{
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);
Assert.That(library.TryGetNature("foo", out var n));
Assert.AreEqual("foo", library.GetNatureName(n!));
2022-10-01 13:39:33 +00:00
}
}
}