51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using MfGames.Gallium;
|
|
using MfGames.Nitride.Tests;
|
|
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace MfGames.Nitride.Yaml.Tests;
|
|
|
|
public class TextContentYamlTests : NitrideTestBase
|
|
{
|
|
public TextContentYamlTests(ITestOutputHelper output)
|
|
: base(output)
|
|
{
|
|
}
|
|
|
|
[Fact]
|
|
public void NoTextContent()
|
|
{
|
|
Entity entity = new();
|
|
TestContent? output = entity.GetTextContentYaml<TestContent>();
|
|
|
|
Assert.Null(output);
|
|
}
|
|
|
|
[Fact]
|
|
public void SetAndGetContent()
|
|
{
|
|
Entity entity = new Entity()
|
|
.SetTextContentYaml(new TestContent { Value = "t1" });
|
|
TestContent? output = entity.GetTextContentYaml<TestContent>();
|
|
|
|
Assert.NotNull(output);
|
|
Assert.Equal("t1", output.Value);
|
|
}
|
|
|
|
[Fact]
|
|
public void SetNullRemovesContent()
|
|
{
|
|
Entity entity = new Entity()
|
|
.SetTextContentYaml(new TestContent { Value = "t1" })
|
|
.SetTextContentYaml<TestContent>(null);
|
|
TestContent? output = entity.GetTextContentYaml<TestContent>();
|
|
|
|
Assert.Null(output);
|
|
}
|
|
|
|
private class TestContent
|
|
{
|
|
public string? Value { get; set; }
|
|
}
|
|
}
|