Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with min
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

45 lines
1.3 KiB

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Xunit;
using Xunit.Abstractions;
using YamlDotNet.RepresentationModel;
namespace Test.Infrastructure
{
public static class YamlAssert
{
public static void Equals(string expected, string actual, ITestOutputHelper output = null!)
{
var yamlStream = new YamlStream();
using var reader = new StringReader(expected);
yamlStream.Load(reader);
var otherYamlStream = new YamlStream();
using var otherReader = new StringReader(expected);
otherYamlStream.Load(new StringReader(actual));
var yamlEqualityVisitor = new EqualityYamlNodeVisitor();
try
{
Assert.Equal(yamlStream.Documents.Count, otherYamlStream.Documents.Count);
for (var i = 0; i < yamlStream.Documents.Count; i++)
{
yamlEqualityVisitor.Visit(yamlStream.Documents[i].RootNode, otherYamlStream.Documents[i].RootNode);
}
}
catch (Exception)
{
output?.WriteLine("Expected:");
output?.WriteLine(expected);
output?.WriteLine("Actual:");
output?.WriteLine(actual);
throw;
}
}
}
}