Rework cache handling.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -29,8 +29,10 @@ namespace PkmnLibRSharpTests.StaticData.Libraries
|
||||
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
library.LoadNature("foo", nature1);
|
||||
|
||||
Assert.That(library.TryGetNature("foo", out var n));
|
||||
Assert.AreEqual(Statistic.Attack, n.IncreasedStat);
|
||||
using (var n = library.TryGetNature("foo"))
|
||||
{
|
||||
Assert.AreEqual(Statistic.Attack, n.Value!.IncreasedStat);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -39,12 +41,17 @@ namespace PkmnLibRSharpTests.StaticData.Libraries
|
||||
using var library = new NatureLibrary(0);
|
||||
using var nature1 = new Nature(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 n));
|
||||
Assert.AreEqual(Statistic.Attack, n.IncreasedStat);
|
||||
|
||||
using (var n = library.TryGetNature("foo"))
|
||||
{
|
||||
Assert.That(n.HasValue);
|
||||
Assert.AreEqual(Statistic.Attack, n.Value!.IncreasedStat);
|
||||
}
|
||||
using (var n = library.TryGetNature("foo"))
|
||||
{
|
||||
Assert.That(n.HasValue);
|
||||
Assert.AreEqual(Statistic.Attack, n.Value!.IncreasedStat);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -52,8 +59,9 @@ namespace PkmnLibRSharpTests.StaticData.Libraries
|
||||
{
|
||||
using var library = new NatureLibrary(0);
|
||||
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
|
||||
Assert.False(library.TryGetNature("foo", out _));
|
||||
|
||||
using var n = library.TryGetNature("foo");
|
||||
Assert.False(n.HasValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -63,8 +71,10 @@ namespace PkmnLibRSharpTests.StaticData.Libraries
|
||||
using var nature1 = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
library.LoadNature("foo", nature1);
|
||||
|
||||
Assert.That(library.TryGetNature("foo", out var n));
|
||||
Assert.AreEqual("foo", library.GetNatureName(n));
|
||||
using (var n = library.TryGetNature("foo"))
|
||||
{
|
||||
Assert.AreEqual("foo", library.GetNatureName(n));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user