Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
udaken committed Jun 15, 2022
1 parent 3105d16 commit 12b49fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/SharpYaml.Tests/EmitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ namespace SharpYaml.Tests
{
public class EmitterTests : YamlTest
{
public EmitterTests()
{
#if NETCOREAPP
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
#endif
}
[Test]
public void EmitExample1()
{
Expand Down Expand Up @@ -140,7 +146,6 @@ public void EmitExample14()
ParseAndEmit("test14.yaml");
}

#if NET45
[Test]
public void EmitUnicode()
{
Expand All @@ -158,7 +163,6 @@ public void EmitUnicode()
var result = encoding.GetString(stream.ToArray()).Trim();
Assert.AreEqual("'" + input + "'", result);
}
#endif

[Test]
public void EmitUnicodeEscapes()
Expand Down
9 changes: 3 additions & 6 deletions src/SharpYaml.Tests/Serialization/SerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,26 +313,23 @@ public void DeserializeArray()
Assert.AreEqual("three", array[2]);
}

#if NET45

[Test]
public void Enums()
{
var settings = new SerializerSettings();
settings.RegisterAssembly(typeof(StringFormatFlags).Assembly);
settings.RegisterAssembly(typeof(BindingFlags).Assembly);
var serializer = new Serializer(settings);

var flags = StringFormatFlags.NoClip | StringFormatFlags.NoFontFallback;
var flags = BindingFlags.Public | BindingFlags.InvokeMethod;

var buffer = new StringWriter();
serializer.Serialize(buffer, flags);

var bufferAsText = buffer.ToString();
var deserialized = (StringFormatFlags) serializer.Deserialize(bufferAsText, typeof(StringFormatFlags));
var deserialized = (BindingFlags) serializer.Deserialize(bufferAsText, typeof(BindingFlags));

Assert.AreEqual(flags, deserialized);
}
#endif

[Test]
public void CustomTags()
Expand Down

0 comments on commit 12b49fd

Please sign in to comment.