Skip to content

Commit

Permalink
Added tests (#526)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Petrochuk (from Dev Box) <[email protected]>
  • Loading branch information
petrochuk and anpetroc authored Jan 26, 2024
1 parent 28fcab4 commit 713a4ae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,22 @@ namespace Microsoft.PowerPlatform.PowerApps.Persistence.Tests.Yaml;
public class YamlDeserializerTests
{
[TestMethod]
public void Deserialize_ShouldParseSimpleStructure()
[DataRow("I am a screen with spaces", "42")]
[DataRow("NoSpaces", "-50")]
[DataRow("Yaml : | > ", "")]
[DataRow("Text`~!@#$%^&*()_-+=", ":")]
[DataRow("Text[]{};':\",.<>?/\\|", "@")]
[DataRow("こんにちは", "#")]
[DataRow("Cos'è questo?", "---")]
public void Deserialize_ShouldParseSimpleStructure(string textValue, string xValue)
{
var graph = new Screen()
{
Name = "Screen1",
Properties = new Dictionary<string, ControlPropertyValue>()
{
{ "Text", new() { Value = "I am a screen" } },
{ "X", new() { Value = "42" } },
{ "Text", new() { Value = textValue } },
{ "X", new() { Value = xValue } },
{ "Y", new() { Value = "71" } },
},
};
Expand All @@ -36,8 +43,8 @@ public void Deserialize_ShouldParseSimpleStructure()
sut.Properties.Should().NotBeNull()
.And.HaveCount(3)
.And.ContainKeys("Text", "X", "Y");
sut.Properties["Text"].Value.Should().Be("I am a screen");
sut.Properties["X"].Value.Should().Be("42");
sut.Properties["Text"].Value.Should().Be(textValue);
sut.Properties["X"].Value.Should().Be(xValue);
sut.Properties["Y"].Value.Should().Be("71");
}

Expand Down
4 changes: 4 additions & 0 deletions src/PAModel/Microsoft.PowerPlatform.Formulas.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.PowerPlatform.PowerApps.Persistence\Microsoft.PowerPlatform.PowerApps.Persistence.csproj" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions src/PAModel/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"microsoft.powerplatform.powerapps.persistence": {
"type": "Project",
"dependencies": {
"YamlDotNet": "[15.1.0, )"
}
}
}
}
Expand Down

0 comments on commit 713a4ae

Please sign in to comment.