Fix indentation, add unit test

This commit is contained in:
Frederik Carlier
2018-05-22 21:47:00 +02:00
parent 835656b733
commit 5cc5100df9
4 changed files with 36 additions and 4 deletions

View File

@@ -159,7 +159,8 @@ namespace plistcil.test
}
/// <summary>
/// Makes sure that binary data is line-wrapped correctly when being serialized.
/// Makes sure that binary data is line-wrapped correctly when being serialized, in a scenario
/// where the binary data is not indented (no leading whitespace).
/// </summary>
[Fact]
public static void RoundtripDataTest()
@@ -168,7 +169,21 @@ namespace plistcil.test
var value = XmlPropertyListParser.Parse(new FileInfo(@"test-files/RoundtripBinary.plist"));
var actual = value.ToXmlPropertyList();
Assert.Equal(expected, actual, false, true);
Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
}
/// <summary>
/// Makes sure that binary data is line-wrapped correctly when being serialized, in a scenario
/// where the binary data is indented.
/// </summary>
[Fact]
public static void RoundtripDataTest2()
{
var expected = File.ReadAllText(@"test-files/RoundtripBinaryIndentation.plist");
var value = XmlPropertyListParser.Parse(new FileInfo(@"test-files/RoundtripBinaryIndentation.plist"));
var actual = value.ToXmlPropertyList();
Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
}
}
}

View File

@@ -112,4 +112,10 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<ItemGroup>
<None Update="test-files\RoundtripBinaryIndentation.plist">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>keyA</key>
<data>
MjAxMy0wMi0wMiAyMDoxNjo0MiBHTVQ6IGhhbmRsZV9tZXNzYWdlOiBBbmQgeW91IHdp
bGwga25vdyBteSBuYW1lIGlzIHRoZSBMb3JkIHdoZW4gSSBsYXkgbXkgdmVuZ2VhbmNl
IHVwb24gdGhlZS4=
</data>
</dict>
</plist>