using NUnit.Framework; using PkmnLibSharp.Library; using PkmnLibSharp.Utilities; namespace PkmnLibSharpTests.Library { public class SpeciesTests { [Test] public void ConstructDestruct() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80); species.Dispose(); } [Test] public void GetId() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.AreEqual(10, species.Id); species.Dispose(); } [Test] public void GetGenderRate() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.AreEqual(0.5f, species.GenderRate); species.Dispose(); } [Test] public void GetCaptureRate() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.AreEqual(100, species.CaptureRate); species.Dispose(); } [Test] public void GetName() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.AreEqual("testSpecies", species.Name); species.Dispose(); } [Test] public void GetGrowthRate() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.AreEqual("exponential", species.GrowthRate); species.Dispose(); } [Test] public void HasForme() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.True(species.HasForme("default")); species.Dispose(); } [Test] public void SetForme() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.True(species.HasForme("default")); forme = new Forme("bar", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); species.SetForme("bar", forme); Assert.True(species.HasForme("bar")); species.Dispose(); } [Test] public void GetForme() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); var f = species.GetForme("default"); Assert.AreEqual(forme, f); Assert.Throws(() => { species.GetForme("non-existing"); }); species.Dispose(); } [Test] public void TrGetForme() { var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"}, new[] {"bar"}, new LearnableMoves(100)); var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80); Assert.True(species.TryGetForme("default", out var f)); Assert.AreEqual(forme, f); Assert.False(species.TryGetForme("non-existing", out f)); species.Dispose(); } } }