PkmnLibRSharp/PkmnLibRSharpTests/StaticData/Libraries/MoveLibraryTests.cs

53 lines
1.6 KiB
C#

using System;
using NUnit.Framework;
using PkmnLibSharp.StaticData;
using PkmnLibSharp.StaticData.Libraries;
namespace PkmnLibRSharpTests.StaticData.Libraries
{
public class MoveLibraryTests
{
[Test]
public void Create()
{
using var lib = new MoveLibrary(0);
Assert.AreEqual(0, lib.Count);
}
[Test]
public void CreateAndAdd()
{
using var lib = new MoveLibrary(1);
Assert.AreEqual(0, lib.Count);
using var move = new MoveData("testMove", new TypeIdentifier(0), MoveCategory.Physical, 100, 100, 1,
MoveTarget.All, 0, null, Array.Empty<string>());
lib.Add("foobar", move);
Assert.AreEqual(1, lib.Count);
Assert.AreEqual("testMove", lib["foobar"].Name);
}
[Test]
public void CreateAddIterate()
{
using var lib = new MoveLibrary(10);
Assert.AreEqual(0, lib.Count);
for (ushort i = 0; i < 10; i++)
{
using var move = new MoveData(i.ToString(), new TypeIdentifier(0), MoveCategory.Physical, 100, 100, 1,
MoveTarget.All, 0, null, Array.Empty<string>());
lib.Add(i + "_key", move);
}
Assert.AreEqual(10, lib.Count);
var index = 0;
foreach (var kv in lib)
{
Assert.AreEqual(kv.Key, index + "_key");
Assert.AreEqual(kv.Value.Name, index.ToString());
index++;
}
Assert.AreEqual(10, index);
}
}
}