mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 14:55:11 +00:00
Add CMP tests for non-quote serialization
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using SabreTools.Serialization.Deserializers;
|
||||
@@ -96,6 +95,31 @@ namespace SabreTools.Serialization.Test.Deserializers
|
||||
Validate(newGame);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTripGameWithoutQuotesTest()
|
||||
{
|
||||
// Get the serializer and deserializer
|
||||
var deserializer = new Serialization.Deserializers.ClrMamePro();
|
||||
var serializer = new Serialization.Serializers.ClrMamePro();
|
||||
|
||||
// Build the data
|
||||
Models.ClrMamePro.MetadataFile mf = Build(game: true);
|
||||
|
||||
// Serialize to stream
|
||||
Stream? actual = serializer.Serialize(mf, quotes: false);
|
||||
Assert.NotNull(actual);
|
||||
|
||||
// Serialize back to original model
|
||||
Models.ClrMamePro.MetadataFile? newMf = deserializer.Deserialize(actual);
|
||||
|
||||
// Validate the data
|
||||
Assert.NotNull(newMf);
|
||||
Validate(newMf.ClrMamePro);
|
||||
Assert.NotNull(newMf.Game);
|
||||
var newGame = Assert.Single(newMf.Game);
|
||||
Validate(newGame);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTripMachineTest()
|
||||
{
|
||||
@@ -121,6 +145,31 @@ namespace SabreTools.Serialization.Test.Deserializers
|
||||
Validate(newGame);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTripMachineWithoutQuotesTest()
|
||||
{
|
||||
// Get the serializer and deserializer
|
||||
var deserializer = new Serialization.Deserializers.ClrMamePro();
|
||||
var serializer = new Serialization.Serializers.ClrMamePro();
|
||||
|
||||
// Build the data
|
||||
Models.ClrMamePro.MetadataFile mf = Build(game: false);
|
||||
|
||||
// Serialize to stream
|
||||
Stream? actual = serializer.Serialize(mf, quotes: false);
|
||||
Assert.NotNull(actual);
|
||||
|
||||
// Serialize back to original model
|
||||
Models.ClrMamePro.MetadataFile? newMf = deserializer.Deserialize(actual);
|
||||
|
||||
// Validate the data
|
||||
Assert.NotNull(newMf);
|
||||
Validate(newMf.ClrMamePro);
|
||||
Assert.NotNull(newMf.Game);
|
||||
var newGame = Assert.Single(newMf.Game);
|
||||
Validate(newGame);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build model for serialization and deserialization
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user