Skip to content

Commit 219aff0

Browse files
committed
removed HtmlMetroReporter
1 parent 18a3f42 commit 219aff0

8 files changed

Lines changed: 23 additions & 90 deletions

File tree

TestStack.BDDfy.Tests/Configuration/BatchProcessorsTests.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace TestStack.BDDfy.Tests.Configuration
1010
[TestFixture]
1111
public class BatchProcessorsTests
1212
{
13+
static bool MetroReportProcessorIsActive(IBatchProcessor batchProcessor)
14+
{
15+
return batchProcessor is HtmlReporter && ((HtmlReporter)batchProcessor).ReportBuilder is HtmlMetroReportBuilder;
16+
}
17+
1318
[Test]
1419
public void ReturnsHtmlReporterByDefault()
1520
{
@@ -28,26 +33,28 @@ public void DoesNotReturnMarkDownReporterByDefault()
2833
public void DoesNotReturnHtmlMetroReporterByDefault()
2934
{
3035
var processors = Configurator.BatchProcessors.GetProcessors().ToList();
31-
Assert.IsFalse(processors.Any(p => p is HtmlMetroReporter));
36+
Assert.IsFalse(processors.Any(MetroReportProcessorIsActive));
3237
}
3338

3439
[Test]
3540
public void DoesNotReturnHtmlReporterWhenItIsDeactivated()
3641
{
3742
Configurator.BatchProcessors.HtmlReport.Disable();
43+
3844
var processors = Configurator.BatchProcessors.GetProcessors().ToList();
39-
4045
Assert.IsFalse(processors.Any(p => p is HtmlReporter));
46+
4147
Configurator.BatchProcessors.HtmlReport.Enable();
4248
}
4349

4450
[Test]
4551
public void ReturnsMarkdownReporterWhenItIsActivated()
4652
{
4753
Configurator.BatchProcessors.MarkDownReport.Enable();
54+
4855
var processors = Configurator.BatchProcessors.GetProcessors().ToList();
49-
5056
Assert.IsTrue(processors.Any(p => p is MarkDownReporter));
57+
5158
Configurator.BatchProcessors.MarkDownReport.Disable();
5259
}
5360

@@ -57,10 +64,8 @@ public void ReturnsHtmlMetroReporterWhenItIsActivated()
5764
Configurator.BatchProcessors.HtmlMetroReport.Enable();
5865

5966
var processors = Configurator.BatchProcessors.GetProcessors().ToList();
60-
61-
Assert.IsTrue(processors.OfType<HtmlMetroReporter>().Any(),
62-
"The metro Html report was not found in batch processors");
63-
67+
Assert.IsTrue(processors.Any(MetroReportProcessorIsActive), "The metro Html report was not found in batch processors");
68+
6469
Configurator.BatchProcessors.HtmlMetroReport.Disable();
6570
}
6671
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void SetUp()
2525
[Test]
2626
public void ShouldCreateReportIfProcessingSucceeds()
2727
{
28-
_sut.Builder.CreateReport(Arg.Any<FileReportModel>()).Returns(ReportData);
28+
_sut.ReportBuilder.CreateReport(Arg.Any<FileReportModel>()).Returns(ReportData);
2929

3030
_sut.Process(new List<Story>());
3131

@@ -35,7 +35,7 @@ public void ShouldCreateReportIfProcessingSucceeds()
3535
[Test]
3636
public void ShouldPrintErrorInReportIfProcessingFails()
3737
{
38-
_sut.Builder.CreateReport(Arg.Any<FileReportModel>()).Returns(x => { throw new Exception(ErrorMessage); });
38+
_sut.ReportBuilder.CreateReport(Arg.Any<FileReportModel>()).Returns(x => { throw new Exception(ErrorMessage); });
3939

4040
_sut.Process(new ReportTestData().CreateTwoStoriesEachWithTwoScenariosWithThreeStepsOfFiveMilliseconds());
4141

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ namespace TestStack.BDDfy.Tests.Reporters.Html
99
public class TestableHtmlReporter : HtmlReporter
1010
{
1111
public IHtmlReportConfiguration Configuration { get; set; }
12-
public IReportBuilder Builder { get; set; }
1312
public IReportWriter Writer { get; set; }
1413
public IFileReader FileReader { get; set; }
1514

16-
public TestableHtmlReporter(IHtmlReportConfiguration configuration, IReportBuilder builder, IReportWriter writer, IFileReader fileReader)
17-
: base(configuration, builder, writer, fileReader)
15+
public TestableHtmlReporter(IHtmlReportConfiguration configuration, IReportBuilder reportBuilder, IReportWriter writer, IFileReader fileReader)
16+
: base(configuration, reportBuilder, writer, fileReader)
1817
{
1918
Configuration = configuration;
20-
Builder = builder;
19+
ReportBuilder = reportBuilder;
2120
Writer = writer;
2221
FileReader = fileReader;
2322
Configuration.RunsOn(Arg.Any<Story>()).Returns(true);

TestStack.BDDfy/Configuration/BatchProcessors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ IEnumerable<IBatchProcessor> _GetProcessors()
3737
private readonly BatchProcessorFactory _htmlReportFactory = new BatchProcessorFactory(() => new HtmlReporter(new DefaultHtmlReportConfiguration()));
3838
public BatchProcessorFactory HtmlReport { get { return _htmlReportFactory; } }
3939

40-
private readonly BatchProcessorFactory _htmlMetroReportFactory = new BatchProcessorFactory(() => new HtmlMetroReporter(new DefaultHtmlReportConfiguration()),false);
40+
private readonly BatchProcessorFactory _htmlMetroReportFactory = new BatchProcessorFactory(() => new HtmlReporter(new DefaultHtmlReportConfiguration(), new HtmlMetroReportBuilder()), false);
4141
public BatchProcessorFactory HtmlMetroReport { get { return _htmlMetroReportFactory; } }
4242

4343
private readonly BatchProcessorFactory _markDownFactory = new BatchProcessorFactory(() => new MarkDownReporter(), false);

TestStack.BDDfy/Reporters/Html/HtmlReporter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace TestStack.BDDfy.Reporters.Html
99
{
1010
public class HtmlReporter : IBatchProcessor
1111
{
12-
private readonly IReportBuilder _builder;
12+
public IReportBuilder ReportBuilder { get; set; }
1313
private readonly IReportWriter _writer;
1414
private readonly IFileReader _fileReader;
1515
readonly IHtmlReportConfiguration _configuration;
@@ -27,12 +27,12 @@ public HtmlReporter(IHtmlReportConfiguration configuration, IReportBuilder htmlR
2727

2828
public HtmlReporter(
2929
IHtmlReportConfiguration configuration,
30-
IReportBuilder builder,
30+
IReportBuilder reportBuilder,
3131
IReportWriter writer,
3232
IFileReader reader)
3333
{
3434
_configuration = configuration;
35-
_builder = builder;
35+
ReportBuilder = reportBuilder;
3636
_writer = writer;
3737
_fileReader = reader;
3838
}
@@ -51,7 +51,7 @@ void WriteOutHtmlReport(IEnumerable<Story> stories)
5151

5252
try
5353
{
54-
report = _builder.CreateReport(Model);
54+
report = ReportBuilder.CreateReport(Model);
5555
}
5656
catch (Exception ex)
5757
{

TestStack.BDDfy/Reporters/HtmlMetro/HtmlMetroReportBuilder.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ string IReportBuilder.CreateReport(FileReportModel model)
1414

1515
public string CreateReport(HtmlReportViewModel model)
1616
{
17-
var t = new MetroHtmlReportTemplate(model, DateProvider());
18-
19-
var html = t.TransformText();
20-
21-
return html;
17+
return new MetroHtmlReportTemplate(model, DateProvider()).TransformText();
2218
}
2319

2420
public Func<DateTime> DateProvider

TestStack.BDDfy/Reporters/HtmlMetro/HtmlMetroReporter.cs

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

TestStack.BDDfy/TestStack.BDDfy.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
<Compile Include="Reporters\Html\DefaultHtmlReportConfiguration.cs" />
9191
<Compile Include="Reporters\Html\HtmlReporter.cs" />
9292
<Compile Include="Reporters\Html\HtmlReportBuilder.cs" />
93-
<Compile Include="Reporters\HtmlMetro\HtmlMetroReporter.cs" />
9493
<Compile Include="Reporters\Html\HtmlReportResources.Designer.cs">
9594
<AutoGen>True</AutoGen>
9695
<DesignTime>True</DesignTime>

0 commit comments

Comments
 (0)