예제 #1
0
        public static SpecificationDataset Build(Assembly assemblyUnderTest)
        {
            SpecificationDataset specificationDataset = new SpecificationDataset(assemblyUnderTest);

            specificationDataset.BuildConcerns();
            return(specificationDataset);
        }
예제 #2
0
        public static string RenderTitle(SpecificationDataset specificationDataset)
        {
            StringBuilder reportBuilder = new StringBuilder();

            RenderTitle(specificationDataset, reportBuilder);
            return(reportBuilder.ToString());
        }
예제 #3
0
        private static void RenderTitle(SpecificationDataset specificationDataset, StringBuilder reportBuilder)
        {
            string concernsCaption       = ConcernsCaption(specificationDataset.Concerns);
            string contextsCaption       = ContextsCaption(specificationDataset.Concerns);
            string specificationsCaption = SpecificationsCaption(specificationDataset.Concerns);

            string title = String.Format("<h1>{0}&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"count\">{1}, {2}, {3}</span></h1>", specificationDataset.Name, concernsCaption, contextsCaption, specificationsCaption);

            reportBuilder.Append(title);
        }
예제 #4
0
        public static string Render(SpecificationDataset specificationDataset)
        {
            StringBuilder reportBuilder = new StringBuilder();

            RenderTitle(specificationDataset, reportBuilder);
            RenderHR(reportBuilder);

            Concern[] concerns =
                (from c in specificationDataset.Concerns
                 orderby c.Name
                 select c).ToArray();

            RenderConcerns(concerns, reportBuilder);

            string reportBody = reportBuilder.ToString();

            return(String.Format(GetTemplate(), specificationDataset.Name, reportBody));
        }
예제 #5
0
        public virtual void WriteReport(Assembly assemblyUnderTest)
        {
            SpecificationDataset specificationDataset = SpecificationDataset.Build(assemblyUnderTest);

            string generatedReport = Render(specificationDataset);

            string reportFilePath = assemblyUnderTest.GetName().Name + ".html";

            if (File.Exists(reportFilePath))
            {
                File.Delete(reportFilePath);
            }

            TextWriter tw = new StreamWriter(reportFilePath);

            tw.Write(generatedReport);
            tw.Close();
        }