PkmnLibRSharp/PkmnLibRSharpTests/StaticData/Libraries/MoveLibraryTests.cs

53 lines
1.6 KiB
C#
Raw Normal View History

2022-10-01 13:39:33 +00:00
using System;
using NUnit.Framework;
using PkmnLibSharp.StaticData;
using PkmnLibSharp.StaticData.Libraries;
namespace PkmnLibRSharpTests.StaticData.Libraries
{
public class MoveLibraryTests
{
[Test]
public void Create()
{
var lib = MoveLibrary.Create(0);
2022-10-01 13:39:33 +00:00
Assert.AreEqual(0, lib.Count);
}
[Test]
public void CreateAndAdd()
{
var lib = MoveLibrary.Create(1);
2022-10-01 13:39:33 +00:00
Assert.AreEqual(0, lib.Count);
var move = MoveData.Create("testMove", new TypeIdentifier(0), MoveCategory.Physical, 100, 100, 1,
2022-10-01 13:39:33 +00:00
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()
{
var lib = MoveLibrary.Create(10);
2022-10-01 13:39:33 +00:00
Assert.AreEqual(0, lib.Count);
for (ushort i = 0; i < 10; i++)
{
var move = MoveData.Create(i.ToString(), new TypeIdentifier(0), MoveCategory.Physical, 100, 100, 1,
2022-10-01 13:39:33 +00:00
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);
}
}
}