Skip to content

Commit b744345

Browse files
committed
Reverted to testing html report contents as embedded resource
1 parent 8e8ea3c commit b744345

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

TestStack.BDDfy.Tests/Reporters/Html/HtmlReportBuilderTests.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class HtmlReportBuilderTests
1717
[MethodImpl(MethodImplOptions.NoInlining)]
1818
public void ShouldProduceExpectedHtml()
1919
{
20+
string expected = GetReportHtml();
2021
var model = new HtmlReportViewModel(
2122
new DefaultHtmlReportConfiguration(),
2223
new ReportTestData().CreateTwoStoriesEachWithTwoScenariosWithThreeStepsOfFiveMilliseconds());
@@ -25,7 +26,26 @@ public void ShouldProduceExpectedHtml()
2526

2627
var result = sut.CreateReport(model);
2728

28-
Approvals.Verify(result);
29+
//Approvals.Verify(result);
30+
Assert.That(result, Is.EqualTo(expected));
2931
}
32+
33+
private string GetReportHtml()
34+
{
35+
var assembly = Assembly.GetExecutingAssembly();
36+
var resourceName = "TestStack.BDDfy.Tests.Reporters.Html.HtmlReportBuilderTests.ShouldProduceExpectedHtml.approved.txt";
37+
38+
string result;
39+
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
40+
{
41+
using (StreamReader reader = new StreamReader(stream))
42+
{
43+
result = reader.ReadToEnd();
44+
}
45+
}
46+
47+
return result;
48+
}
49+
3050
}
3151
}

TestStack.BDDfy.Tests/TestStack.BDDfy.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
<ItemGroup>
148148
<None Include="packages.config" />
149149
</ItemGroup>
150+
<ItemGroup>
151+
<EmbeddedResource Include="Reporters\Html\HtmlReportBuilderTests.ShouldProduceExpectedHtml.approved.txt" />
152+
</ItemGroup>
150153
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
151154
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
152155
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

0 commit comments

Comments
 (0)