mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
d47bb1d297
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using FluentAssertions;
|
|
using System.IO;
|
|
using Xunit;
|
|
|
|
namespace PKHeX.Core.Tests.Saves;
|
|
|
|
public static class SMTests
|
|
{
|
|
private static SAV7SM GetSave()
|
|
{
|
|
var folder = TestUtil.GetRepoPath();
|
|
var path = Path.Combine(folder, "TestData", "SM Project 802.main");
|
|
return new SAV7SM(File.ReadAllBytes(path));
|
|
}
|
|
|
|
[Fact]
|
|
public static void ChecksumsValid()
|
|
{
|
|
GetSave().ChecksumsValid.Should().BeTrue();
|
|
}
|
|
|
|
[Fact]
|
|
public static void ChecksumsUpdate()
|
|
{
|
|
var save = GetSave();
|
|
var originalChecksumInfo = save.ChecksumInfo;
|
|
var newSave = new SAV7SM(save.Write());
|
|
|
|
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");
|
|
}
|
|
}
|