Skip to content

Commit

Permalink
#5 XUnit tests
Browse files Browse the repository at this point in the history
- Strip \r and \n before comparing generated tt-template
  • Loading branch information
araszka committed May 29, 2023
1 parent 102bf99 commit 1f7f30d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 87 deletions.
11 changes: 8 additions & 3 deletions tests/ManiaTemplates.Tests/Lib/MtTransformerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,16 @@ public void ShouldBuildManialink()
_maniaTemplateEngine.GetType().GetField("_components", BindingFlags.NonPublic | BindingFlags.Instance)
?.SetValue(_maniaTemplateEngine, components);

var expected = File.ReadAllText("Lib/expected.tt");
var expected = StripLineBreaks(File.ReadAllText("Lib/expected.tt"));

var result = _transformer.BuildManialink(_testComponent, "expected");

Assert.Equal(expected, TransformCodeToOrderNumber(result));
Assert.Equal(expected, StripLineBreaks(TransformCodeToOrderNumber(result)));
}

private string StripLineBreaks(string input)
{
return input.Replace("\r", "").Replace("\n", "");
}

private string TransformCodeToOrderNumber(string input)
Expand All @@ -106,4 +111,4 @@ private string TransformCodeToOrderNumber(string input)
return count.ToString();
});
}
}
}
84 changes: 0 additions & 84 deletions tests/ManiaTemplates.Tests/Lib/TransformerTest.cs

This file was deleted.

0 comments on commit 1f7f30d

Please sign in to comment.