Browse Source

Improvements to yaml validation

pull/412/head
Ryan Nowak 6 years ago
parent
commit
de35346258
  1. 9
      test/Test.Infrastructure/EqualityYamlNodeVisitor.cs
  2. 2
      test/Test.Infrastructure/YamlAssert.cs

9
test/Test.Infrastructure/EqualityYamlNodeVisitor.cs

@ -4,6 +4,7 @@
using System;
using System.CommandLine;
using System.Linq;
using Tye.Serialization;
using YamlDotNet.RepresentationModel;
@ -96,7 +97,13 @@ namespace Test.Infrastructure
if (node.Children.Count < otherNode.Children.Count)
{
throw new TyeYamlException($"Extra children in actual yaml mapping, Expected: ({node.Start.Line}, {node.Start.Column}). Actual: ({otherNode.Start.Line}, {otherNode.Start.Column}).");
throw new TyeYamlException(
$@"Extra children in actual yaml mapping:
Expected: ({node.Start.Line}, {node.Start.Column})
{string.Join(Environment.NewLine, node.Children.Select(kvp => $" " + kvp.Key.ToString() + ": ..."))}
Actual: ({otherNode.Start.Line}, {otherNode.Start.Column})
{string.Join(Environment.NewLine, otherNode.Children.Select(kvp => $" " + kvp.Key.ToString() + ": ..."))}");
}
}

2
test/Test.Infrastructure/YamlAssert.cs

@ -24,7 +24,7 @@ namespace Test.Infrastructure
try
{
Assert.Equal(yamlStream.Documents.Count, yamlStream.Documents.Count);
Assert.Equal(yamlStream.Documents.Count, otherYamlStream.Documents.Count);
for (var i = 0; i < yamlStream.Documents.Count; i++)
{

Loading…
Cancel
Save