Skip to content

Commit 3db106f

Browse files
committed
Merge branch 'release/0.14.0' into production
2 parents c55f61f + aaf801e commit 3db106f

199 files changed

Lines changed: 6265 additions & 3056 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ test:
1515
- '**\CSF.Screenplay.WebApis.Tests.dll'
1616
- '**\Ploeh.AutoFixture.NUnit3.dll'
1717
- '**\CSF.Screenplay.NUnit.dll'
18+
- '**\CSF.Screenplay.Reporting.Html.Tests\bin\Debug\CSF.Screenplay.Reporting.Tests.dll'
19+
- '**\CSF.Screenplay.Reporting.Json.Tests\bin\Debug\CSF.Screenplay.Reporting.Tests.dll'
1820
artifacts:
1921
- path: Tests\CSF.Screenplay.WebTestWebsite
2022
name: TestWebsite

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ testrunner/
77
*.csproj.user
88
.vs/
99
TestResult.xml
10+
UnitTests.xml
11+
IntegrationTests.xml
1012
TestResult.formatted.xml
1113
*.report.txt
1214
Tests/Temp/
@@ -17,3 +19,5 @@ Screenshots/
1719
Backup/
1820
UpgradeLog.htm
1921
nuget-packages/
22+
*.report.html
23+
*.report.json

CSF.Screenplay.NUnit/CSF.Screenplay.NUnit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RootNamespace>CSF.Screenplay.NUnit</RootNamespace>
99
<AssemblyName>CSF.Screenplay.NUnit</AssemblyName>
1010
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11-
<ReleaseVersion>0.13.0-beta</ReleaseVersion>
11+
<ReleaseVersion>0.14.0-beta</ReleaseVersion>
1212
<SignAssembly>true</SignAssembly>
1313
<AssemblyOriginatorKeyFile>..\CSF-Software-OSS.snk</AssemblyOriginatorKeyFile>
1414
</PropertyGroup>

CSF.Screenplay.NUnit/CSF.Screenplay.NUnit.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>CSF.Screenplay.NUnit</id>
5-
<version>0.13.0-beta</version>
5+
<version>0.14.0-beta</version>
66
<title>CSF.Screenplay.NUnit</title>
77
<authors>CSF Software Ltd</authors>
88
<licenseUrl>https://opensource.org/licenses/MIT</licenseUrl>
@@ -13,7 +13,7 @@
1313
<dependencies>
1414
<dependency id="CSF.FlexDi" version="[1.0.2,2.0.0)" />
1515
<dependency id="CSF.Reflection" version="[1.0.3,2.0.0)" />
16-
<dependency id="CSF.Screenplay" version="0.13.0-beta" />
16+
<dependency id="CSF.Screenplay" version="0.14.0-beta" />
1717
<dependency id="NUnit" version="[3.4.0,4.0.0)" />
1818
</dependencies>
1919
</metadata>

CSF.Screenplay.NUnit/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
1818
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
1919

20-
[assembly: AssemblyVersion("0.13.0.0")]
20+
[assembly: AssemblyVersion("0.14.0.0")]
2121

2222
// The following attributes are used to specify the signing key for the assembly,
2323
// if desired. See the Mono documentation for more information about signing.

CSF.Screenplay.Reporting.Html/CSF.Screenplay.Reporting.Html.csproj

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RootNamespace>CSF.Screenplay.Reporting</RootNamespace>
99
<AssemblyName>CSF.Screenplay.Reporting.Html</AssemblyName>
1010
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11-
<ReleaseVersion>0.13.0-beta</ReleaseVersion>
11+
<ReleaseVersion>0.14.0-beta</ReleaseVersion>
1212
<SignAssembly>true</SignAssembly>
1313
<AssemblyOriginatorKeyFile>..\CSF-Software-OSS.snk</AssemblyOriginatorKeyFile>
1414
</PropertyGroup>
@@ -54,44 +54,43 @@
5454
<HintPath>..\packages\CSF.Utils.6.1.1\lib\net45\CSF.Utils.dll</HintPath>
5555
</Reference>
5656
<Reference Include="CSF.Zpt.Abstractions">
57-
<HintPath>..\packages\CSF.Zpt.Abstractions.1.0.6\lib\net45\CSF.Zpt.Abstractions.dll</HintPath>
57+
<HintPath>..\packages\CSF.Zpt.Abstractions.1.1.0\lib\net45\CSF.Zpt.Abstractions.dll</HintPath>
5858
</Reference>
5959
<Reference Include="CSF.Zpt">
60-
<HintPath>..\packages\CSF.Zpt.1.0.6\lib\net45\CSF.Zpt.dll</HintPath>
60+
<HintPath>..\packages\CSF.Zpt.1.1.0\lib\net45\CSF.Zpt.dll</HintPath>
6161
</Reference>
6262
<Reference Include="CSF.Zpt.DocumentProviders.XmlLinq">
63-
<HintPath>..\packages\CSF.Zpt.DocumentProviders.XmlLinq.1.0.6\lib\net45\CSF.Zpt.DocumentProviders.XmlLinq.dll</HintPath>
63+
<HintPath>..\packages\CSF.Zpt.DocumentProviders.XmlLinq.1.1.0\lib\net45\CSF.Zpt.DocumentProviders.XmlLinq.dll</HintPath>
6464
</Reference>
6565
<Reference Include="CSF.Zpt.ExpressionEvaluators.CSharpExpressions">
66-
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.CSharpExpressions.1.0.6\lib\net45\CSF.Zpt.ExpressionEvaluators.CSharpExpressions.dll</HintPath>
66+
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.CSharpExpressions.1.1.0\lib\net45\CSF.Zpt.ExpressionEvaluators.CSharpExpressions.dll</HintPath>
6767
</Reference>
6868
<Reference Include="CSF.Zpt.ExpressionEvaluators.CSharpFramework">
69-
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.CSharpExpressions.1.0.6\lib\net45\CSF.Zpt.ExpressionEvaluators.CSharpFramework.dll</HintPath>
69+
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.CSharpExpressions.1.1.0\lib\net45\CSF.Zpt.ExpressionEvaluators.CSharpFramework.dll</HintPath>
7070
</Reference>
7171
<Reference Include="CSF.Zpt.ExpressionEvaluators.NotExpressions">
72-
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.NotExpressions.1.0.6\lib\net45\CSF.Zpt.ExpressionEvaluators.NotExpressions.dll</HintPath>
72+
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.NotExpressions.1.1.0\lib\net45\CSF.Zpt.ExpressionEvaluators.NotExpressions.dll</HintPath>
7373
</Reference>
7474
<Reference Include="CSF.Zpt.ExpressionEvaluators.PathExpressions">
75-
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.PathExpressions.1.0.6\lib\net45\CSF.Zpt.ExpressionEvaluators.PathExpressions.dll</HintPath>
75+
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.PathExpressions.1.1.0\lib\net45\CSF.Zpt.ExpressionEvaluators.PathExpressions.dll</HintPath>
7676
</Reference>
7777
<Reference Include="CSF.Zpt.ExpressionEvaluators.StringExpressions">
78-
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.StringExpressions.1.0.6\lib\net45\CSF.Zpt.ExpressionEvaluators.StringExpressions.dll</HintPath>
78+
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.StringExpressions.1.1.0\lib\net45\CSF.Zpt.ExpressionEvaluators.StringExpressions.dll</HintPath>
7979
</Reference>
8080
<Reference Include="CSF.Zpt.DocumentProviders.HtmlHAP">
81-
<HintPath>..\packages\CSF.Zpt.DocumentProviders.HtmlHAP.1.0.6\lib\net45\CSF.Zpt.DocumentProviders.HtmlHAP.dll</HintPath>
81+
<HintPath>..\packages\CSF.Zpt.DocumentProviders.HtmlHAP.1.1.0\lib\net45\CSF.Zpt.DocumentProviders.HtmlHAP.dll</HintPath>
8282
</Reference>
8383
<Reference Include="CSF.Zpt.ExpressionEvaluators.LoadExpressions">
84-
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.LoadExpressions.1.0.6\lib\net45\CSF.Zpt.ExpressionEvaluators.LoadExpressions.dll</HintPath>
84+
<HintPath>..\packages\CSF.Zpt.ExpressionEvaluators.LoadExpressions.1.1.0\lib\net45\CSF.Zpt.ExpressionEvaluators.LoadExpressions.dll</HintPath>
8585
</Reference>
8686
</ItemGroup>
8787
<ItemGroup>
8888
<Compile Include="Properties\AssemblyInfo.cs" />
89-
<Compile Include="HtmlReportWriter.cs" />
89+
<Compile Include="HtmlReportRenderer.cs" />
9090
<Compile Include="Views\ViewProvider.cs" />
9191
<Compile Include="Models\ReportDocument.cs" />
9292
<Compile Include="StreamSourceInfo.cs" />
9393
<Compile Include="Views\ResourceBundler.cs" />
94-
<Compile Include="HardCodedZptSharpConfigurationProvider.cs" />
9594
<Compile Include="Models\ReportModel.cs" />
9695
<Compile Include="Models\ScenarioModel.cs" />
9796
<Compile Include="Models\FeatureModel.cs" />
@@ -100,7 +99,7 @@
10099
</ItemGroup>
101100
<ItemGroup>
102101
<None Include="packages.config" />
103-
<None Include="CSF.Screenplay.Reporting.Html.nuspec" />
102+
<None Include="HardCodedZptSharpConfigurationProvider.cs" />
104103
</ItemGroup>
105104
<ItemGroup>
106105
<ProjectReference Include="..\CSF.Screenplay.Reporting\CSF.Screenplay.Reporting.csproj">

CSF.Screenplay.Reporting.Html/CSF.Screenplay.Reporting.Html.nuspec

Lines changed: 0 additions & 24 deletions
This file was deleted.

CSF.Screenplay.Reporting.Html/HardCodedZptSharpConfigurationProvider.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,23 @@
2929

3030
namespace CSF.Screenplay.Reporting
3131
{
32+
/// <summary>
33+
/// Due to a number of issues, this class is currently unused (and not compiled).
34+
/// </summary>
35+
/// <remarks>
36+
/// <para>
37+
/// The two issues blocking the meaningful use of the class are:
38+
/// https://github.com/csf-dev/CSF.Screenplay/issues/141 and https://github.com/csf-dev/ZPT-Sharp/issues/252.
39+
/// </para>
40+
/// <para>
41+
/// Once they are resolved then it will become possible to pass configuration into ZPT-Sharp via an implementation
42+
/// such as this one, and we may use this class to hard-code the way that ZPT-Sharp works. In turn, that relieves
43+
/// the need for client apps to keep the ZPT-Sharp configuration in their own application config files.
44+
/// </para>
45+
/// <para>
46+
/// This passing of hard-coded config would occur in the HtmlReportRenderer class.
47+
/// </para>
48+
/// </remarks>
3249
class HardCodedZptSharpConfigurationProvider : Zpt.IPluginConfiguration
3350
{
3451
static readonly Type[] pluginTypes = {
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
using System;
2+
using System.IO;
3+
using CSF.Screenplay.Reporting.Models;
4+
using CSF.Screenplay.ReportModel;
5+
using CSF.Zpt;
6+
using CSF.Zpt.Rendering;
7+
8+
namespace CSF.Screenplay.Reporting
9+
{
10+
/// <summary>
11+
/// Implementation of <see cref="IRendersReport"/> which writes Screenplay reports to a standalone HTML page.
12+
/// This includes a number of features for ease of reading, including limited filtering and collapsing of scenarios.
13+
/// </summary>
14+
/// <remarks>
15+
/// <para>
16+
/// This report writer essentially works like a miniature MVC application, using ZPT-Sharp to render the report.
17+
/// You will find, in the <c>Views</c> directory, a number of embedded resources which make up the MVC view for
18+
/// presenting the report.
19+
/// </para>
20+
/// <para>
21+
/// The report received within the <see cref="Render"/> method of this type is passed to an instance of
22+
/// <see cref="ReportDocument"/>. which serves as the MVC model type.
23+
/// </para>
24+
/// <para>
25+
/// This class is then essentially the controller, which creates an instance of that view (as a ZPT document)
26+
/// renders it using ZPT-Sharp.
27+
/// </para>
28+
/// </remarks>
29+
public class HtmlReportRenderer : IRendersReport, IDisposable
30+
{
31+
readonly TextWriter writer;
32+
readonly IZptDocumentFactory documentFactory;
33+
readonly bool disposeWriter;
34+
35+
/// <summary>
36+
/// Write the specified report to the destination.
37+
/// </summary>
38+
/// <param name="report">Report model.</param>
39+
public void Render(IReport report)
40+
{
41+
var doc = GetDocument();
42+
var emptyDoc = GetDocument();
43+
var model = GetDocumentModel(report, emptyDoc);
44+
45+
doc.Render(model, writer);
46+
47+
writer.Flush();
48+
}
49+
50+
IZptDocument GetDocument()
51+
{
52+
using(var stream = GetDocumentStream())
53+
{
54+
return documentFactory.CreateDocument(stream, RenderingMode.Html);
55+
}
56+
}
57+
58+
ReportDocument GetDocumentModel(IReport reportModel, IZptDocument document)
59+
=> new ReportDocument(reportModel, document);
60+
61+
Stream GetDocumentStream()
62+
=> Views.ViewProvider.GetDocumentTemplate();
63+
64+
#region IDisposable Support
65+
bool disposedValue = false;
66+
67+
/// <summary>
68+
/// Dispose of the current instance
69+
/// </summary>
70+
/// <param name="disposing">If set to <c>true</c> then this disposal is explicit.</param>
71+
protected virtual void Dispose(bool disposing)
72+
{
73+
if(!disposedValue)
74+
{
75+
if(disposing)
76+
{
77+
if(disposeWriter)
78+
writer.Dispose();
79+
}
80+
81+
disposedValue = true;
82+
}
83+
}
84+
85+
/// <summary>
86+
/// Releases all resource used by the <see cref="T:CSF.Screenplay.Reporting.TextReportWriter"/> object.
87+
/// </summary>
88+
/// <remarks>Call <see cref="Dispose()"/> when you are finished using the
89+
/// <see cref="T:CSF.Screenplay.Reporting.TextReportWriter"/>. The <see cref="Dispose()"/> method leaves the
90+
/// <see cref="T:CSF.Screenplay.Reporting.TextReportWriter"/> in an unusable state. After calling
91+
/// <see cref="Dispose()"/>, you must release all references to the
92+
/// <see cref="T:CSF.Screenplay.Reporting.TextReportWriter"/> so the garbage collector can reclaim the memory that
93+
/// the <see cref="T:CSF.Screenplay.Reporting.TextReportWriter"/> was occupying.</remarks>
94+
public void Dispose()
95+
{
96+
Dispose(true);
97+
}
98+
#endregion
99+
100+
/// <summary>
101+
/// Initializes a new instance of the <see cref="T:CSF.Screenplay.Reporting.HtmlReportWriter"/> class.
102+
/// </summary>
103+
/// <param name="writer">A text writer into which the report should be written.</param>
104+
/// <param name="disposeWriter">Indicates whether or not the <paramref name="writer"/> should be diposed with this instance.</param>
105+
public HtmlReportRenderer(TextWriter writer, bool disposeWriter = true)
106+
{
107+
if(writer == null)
108+
throw new ArgumentNullException(nameof(writer));
109+
110+
this.writer = writer;
111+
this.disposeWriter = disposeWriter;
112+
113+
// TODO: Once the blocking issues are resolved, pass a hard coded configuration to the ZptDocumentFactory
114+
//
115+
// This is blocked by https://github.com/csf-dev/CSF.Screenplay/issues/141.
116+
// In turn, that is blocked by the upstream ZPT-Sharp issue https://github.com/csf-dev/ZPT-Sharp/issues/252
117+
// Once all of this is resolved, clients won't need to put all of their configuration for ZPT-Sharp
118+
// into their application configuration files. The code which achieves this is commented-out below:
119+
//
120+
// var pluginConfig = new HardCodedZptSharpConfigurationProvider();
121+
// documentFactory = new ZptDocumentFactory(new ZptDocumentProviderService(pluginConfig));
122+
123+
documentFactory = new ZptDocumentFactory();
124+
}
125+
126+
/// <summary>
127+
/// Write the report to a file path.
128+
/// </summary>
129+
/// <param name="report">The report.</param>
130+
/// <param name="path">Destination file path.</param>
131+
public static void WriteToFile(IReport report, string path)
132+
{
133+
using(var reportWriter = new HtmlReportRenderer(new StreamWriter(path)))
134+
{
135+
reportWriter.Render(report);
136+
}
137+
}
138+
}
139+
}

0 commit comments

Comments
 (0)