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); } [Test] public void LoadNatures() { var library = NatureLibrary.Create(0); var nature1 = Nature.NeutralNature(); var nature2 = Nature.Create(Statistic.Attack, Statistic.Defense); 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); library.LoadNature("foo", nature1); Assert.That(library.TryGetNature("foo", out var n)); Assert.AreEqual(Statistic.Attack, n!.IncreasedStat); } [Test] public void LoadAndGetNatureTwice() { var library = NatureLibrary.Create(0); var nature1 = Nature.Create(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 var n2)); Assert.AreEqual(Statistic.Attack, n2!.IncreasedStat); } [Test] public void GetUnknownNature() { var library = NatureLibrary.Create(0); Assert.IsFalse(library.TryGetNature("foo", out _)); } [Test] public void GetNatureName() { var library = NatureLibrary.Create(0); var nature1 = Nature.Create(Statistic.Attack, Statistic.Defense); library.LoadNature("foo", nature1); Assert.That(library.TryGetNature("foo", out var n)); Assert.AreEqual("foo", library.GetNatureName(n!)); } } }