Skip to content

Commit

Permalink
Fixed unit test for empty string enummember value
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardCooke committed Sep 26, 2024
1 parent 1391f0d commit 6fa502a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion YamlDotNet.Test/Analyzers/StaticGenerator/ObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public void EnumSerializationUsesEnumMemberAttribute()
public void EnumSerializationUsesEnumMemberAttributeWithEmptyValue()
{
var serializer = new StaticSerializerBuilder(new StaticContext()).Build();
var actual = serializer.Serialize(new { Test = EnumMemberedEnum.EmptyValue });
var actual = serializer.Serialize(new EnumMemberedEnumHarness { Test = EnumMemberedEnum.EmptyValue });
Assert.Equal("Test: ''", actual.TrimNewLines());
}

Expand All @@ -243,6 +243,12 @@ public void EnumSerializationUsesEnumMemberAttributeWithNullValue()
Assert.Equal("NullValue", actual.TrimNewLines());
}

[YamlSerializable]
public class EnumMemberedEnumHarness
{
public EnumMemberedEnum Test { get; set; }
}

[YamlSerializable]
public enum EnumMemberedEnum
{
Expand Down

0 comments on commit 6fa502a

Please sign in to comment.