2020-05-04 15:27:30 +00:00
|
|
|
using NUnit.Framework;
|
|
|
|
using PkmnLibSharp.Library;
|
2020-05-06 12:40:29 +00:00
|
|
|
using PkmnLibSharp.Library.Moves;
|
2020-05-04 15:54:34 +00:00
|
|
|
using PkmnLibSharp.Utilities;
|
2020-05-04 15:27:30 +00:00
|
|
|
|
|
|
|
namespace PkmnLibSharpTests.Library
|
|
|
|
{
|
|
|
|
public class MoveLibraryTests
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void ConstructDestruct()
|
|
|
|
{
|
|
|
|
var item = MoveLibrary.Create(100);
|
|
|
|
item.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Insert()
|
|
|
|
{
|
2020-05-06 12:40:29 +00:00
|
|
|
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
2020-05-04 15:27:30 +00:00
|
|
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
|
|
|
var library = MoveLibrary.Create(100);
|
|
|
|
library.Insert("foobar", move);
|
|
|
|
Assert.AreEqual(1, library.Count);
|
|
|
|
library.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Delete()
|
|
|
|
{
|
2020-05-06 12:40:29 +00:00
|
|
|
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
2020-05-04 15:27:30 +00:00
|
|
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
|
|
|
var library = MoveLibrary.Create(100);
|
|
|
|
library.Insert("foobar", move);
|
|
|
|
Assert.AreEqual(1, library.Count);
|
|
|
|
library.Delete("foobar");
|
|
|
|
Assert.AreEqual(0, library.Count);
|
|
|
|
library.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Get()
|
|
|
|
{
|
2020-05-06 12:40:29 +00:00
|
|
|
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
2020-05-04 15:27:30 +00:00
|
|
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
|
|
|
var library = MoveLibrary.Create(100);
|
|
|
|
library.Insert("foobar", move);
|
|
|
|
Assert.AreEqual(1, library.Count);
|
|
|
|
var m = library.Get("foobar");
|
|
|
|
Assert.AreEqual(m.Name, "foobar");
|
|
|
|
Assert.Throws<NativeException>(() =>
|
|
|
|
{
|
|
|
|
library.Get("barfoo");
|
|
|
|
});
|
|
|
|
library.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TryGet()
|
|
|
|
{
|
2020-05-06 12:40:29 +00:00
|
|
|
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
2020-05-04 15:27:30 +00:00
|
|
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
|
|
|
var library = MoveLibrary.Create(100);
|
|
|
|
library.Insert("foobar", move);
|
|
|
|
Assert.AreEqual(1, library.Count);
|
|
|
|
Assert.True(library.TryGet("foobar", out move));
|
|
|
|
Assert.AreEqual(move.Name, "foobar");
|
|
|
|
Assert.False(library.TryGet("barfoo", out move));
|
|
|
|
library.Dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|