main
1using System.Collections.Generic;
2using MbUnit.Framework;
3using Rhino.Mocks;
4using Spec.Dox.Domain;
5using Spec.Dox.Test;
6using Spec.Dox.Test.Extensions;
7using Spec.Dox.Test.MetaData;
8
9namespace Spec.Dox.Presentation.Views
10{
11 public class HtmlReportSpecs {}
12
13 [Concern(typeof (HtmlReport))]
14 public class when_publishing_an_html_report_with_specification_added_to_it : context_spec<IHtmlReport>
15 {
16 IReportPublisher publisher;
17
18 protected override IHtmlReport EstablishContext()
19 {
20 publisher = Dependency<IReportPublisher>();
21
22 var fixture = Stub<ITestContext>();
23 var testSpecification = Stub<ITestSpecification>();
24
25
26 fixture.is_told_to(f => f.Name).Return("when_a_blah_blah");
27 testSpecification.is_told_to(t => t.Name).Return("should_do_some_stuff");
28
29 var context = new HtmlReport(publisher);
30 context.Add(fixture, new List<ITestSpecification> {testSpecification});
31 return context;
32 }
33
34 protected override void Because()
35 {
36 sut.publish_to_same_folder_as("path");
37 }
38
39 [Test]
40 public void should_publish_the_correct_html()
41 {
42 var expected_html =
43 "<html><head><title>Specifications Document</title></head><body><h1>when a blah blah</h1><ul><li>should do some stuff</li></ul></body></html>";
44
45 publisher.received(p => p.Publish(Arg<string>.Is.Equal(expected_html), "path"));
46 }
47 }
48}