private void LoadCustomScripts(HtmlReportViewModel viewModel)
        {
            var customStylesheet = Path.Combine(_configuration.OutputPath, "BDDfyCustom.css");
            if (File.Exists(customStylesheet))
                viewModel.CustomStylesheet = File.ReadAllText(customStylesheet);

            var customJavascript = Path.Combine(_configuration.OutputPath, "BDDfyCustom.js");
            if(File.Exists(customJavascript))
                viewModel.CustomJavascript = File.ReadAllText(customJavascript);
        }
        public string CreateReport(HtmlReportViewModel model)
        {
            _viewModel = model;
            AddLine("<!DOCTYPE html>");
            using(OpenTag(HtmlTag.html))
            {
                HtmlHead();
                HtmlBody();
            }

            return _html.ToString();
        }
        public string CreateReport(HtmlReportViewModel model)
        {
            _viewModel = model;
            AddLine("<!DOCTYPE html>");
            using (OpenTag(HtmlTag.html))
            {
                HtmlHead();
                HtmlBody();
            }

            return(_html.ToString());
        }
        void WriteOutHtmlReport(IEnumerable<Story> stories)
        {
            Model = new HtmlReportViewModel(_configuration, stories);
            LoadCustomScripts();
            string report;

            try
            {
                report = _builder.CreateReport(Model);
            }
            catch (Exception ex)
            {
                report = ex.Message + ex.StackTrace;
            }

            _writer.OutputReport(report, _configuration.OutputFileName, _configuration.OutputPath);
        }
        public void ShouldProduceExpectedHtml()
        {
            // somehow the scenario id keeps increasing on TC
            // resetting here explicitly
            Configurator.IdGenerator.Reset();

            // setting the culture to make sure the date is formatted the same on all machines
            using (new TemporaryCulture("en-GB"))
            {
                var model = new HtmlReportViewModel(
                    new DefaultHtmlReportConfiguration(),
                    new ReportTestData().CreateTwoStoriesEachWithTwoScenariosWithThreeStepsOfFiveMilliseconds());

                var sut = new HtmlReportBuilder {DateProvider = () => new DateTime(2014, 3, 25, 11, 30, 5)};
                var result = sut.CreateReport(model);
                Approvals.Verify(result);
            }
        }
        public void ShouldProduceExpectedHtml()
        {
            // somehow the scenario id keeps increasing on TC
            // resetting here explicitly
            Configurator.IdGenerator.Reset();

            // setting the culture to make sure the date is formatted the same on all machines
            using (new TemporaryCulture("en-GB"))
            {
                var model = new HtmlReportViewModel(
                    new DefaultHtmlReportConfiguration(),
                    new ReportTestData().CreateMixContainingEachTypeOfOutcome());
                model.RunDate = new DateTime(2014, 3, 25, 11, 30, 5);

                var sut = new HtmlMetroReportBuilder();
                var result = sut.CreateReport(model);
                Approvals.Verify(result);
            }
        }
 public string CreateReport(HtmlReportViewModel model)
 {
     return new MetroHtmlReportTemplate(model).TransformText();
 }
 public MetroHtmlReportTemplate(HtmlReportViewModel model)
 {
     _model = model;
 }