2018-11-06 23:25:35 +00:00
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using PKHeX.Core;
|
2018-11-14 00:03:18 +00:00
|
|
|
|
using System.IO;
|
2018-11-06 23:25:35 +00:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Tests.Saves
|
|
|
|
|
{
|
2019-03-19 02:33:56 +00:00
|
|
|
|
public static class SMTests
|
2018-11-06 23:25:35 +00:00
|
|
|
|
{
|
2019-03-19 02:33:56 +00:00
|
|
|
|
private static SAV7 GetSave()
|
2018-11-06 23:25:35 +00:00
|
|
|
|
{
|
2019-03-19 02:33:56 +00:00
|
|
|
|
var folder = TestUtil.GetRepoPath();
|
2018-11-20 00:14:49 +00:00
|
|
|
|
var path = Path.Combine(folder, "TestData", "SM Project 802.main");
|
2019-06-09 02:56:11 +00:00
|
|
|
|
return new SAV7SM(File.ReadAllBytes(path));
|
2018-11-20 00:14:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-06 23:25:35 +00:00
|
|
|
|
[Fact]
|
2019-03-19 02:33:56 +00:00
|
|
|
|
public static void ChecksumsValid()
|
2018-11-06 23:25:35 +00:00
|
|
|
|
{
|
|
|
|
|
GetSave().ChecksumsValid.Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
2019-03-19 02:33:56 +00:00
|
|
|
|
public static void ChecksumsUpdate()
|
2018-11-06 23:25:35 +00:00
|
|
|
|
{
|
|
|
|
|
var save = GetSave();
|
|
|
|
|
var originalChecksumInfo = save.ChecksumInfo;
|
2019-06-09 02:56:11 +00:00
|
|
|
|
var newSave = new SAV7SM(save.Write());
|
2018-11-06 23:25:35 +00:00
|
|
|
|
|
|
|
|
|
save.ChecksumInfo.Should().BeEquivalentTo(originalChecksumInfo, "because the checksum should have been modified");
|
|
|
|
|
save.ChecksumsValid.Should().BeTrue("because the checksum should be valid after write");
|
|
|
|
|
newSave.ChecksumsValid.Should().BeTrue("because the checksums should be valid after reopening the save");
|
|
|
|
|
newSave.ChecksumInfo.Should().BeEquivalentTo(save.ChecksumInfo, "because the checksums should be the same since write and open");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|