public void DrawGraphTest() { List <ProjectStatsGraph> graphs = new List <ProjectStatsGraph>(); //ProjectStatsGraph graph = new ProjectStatsGraph(); //graph.IgnoreFailures = true; //graph.GraphName = "Build Duration"; //graph.YAxisTitle = "Seconds"; //graph.AddParameter<TimeSpan>("Duration", "Green"); ProjectStatsGraph graph = new ProjectStatsGraph(); graph.IgnoreFailures = false; graph.GraphName = "Build Report"; graph.YAxisTitle = "Build"; graph.AddParameter <double>("Success", "Green"); graph.AddParameter <double>("Failure", "Red"); graph.AddParameter <double>("Exception", "Blue"); graphs.Add(graph); ProjectPilotConfiguration projectPilotConfiguration = new ProjectPilotConfiguration(); projectPilotConfiguration.ProjectPilotWebAppRootUrl = "http://localhost/projectpilot/"; ProjectRegistry projectRegistry = new ProjectRegistry(); Project project = new Project("CCNetStatistics", String.Empty); projectRegistry.AddProject(project); IFileManager fileManager = new DefaultFileManager(String.Empty, projectPilotConfiguration); projectRegistry.FileManager = fileManager; IFileManager templateFileManager = MockRepository.GenerateStub <IFileManager>(); templateFileManager.Stub(action => action.GetFullFileName(null, null)).IgnoreArguments().Return(@"..\..\..\Data\Templates\CCNetReportStatistics.vm"); ITemplateEngine templateEngine = new DefaultTemplateEngine(templateFileManager); // prepare test data ProjectStatsData data = GetStatisticDataFromFile(); ICCNetProjectStatisticsPlugIn plugIn = MockRepository.GenerateStub <ICCNetProjectStatisticsPlugIn>(); plugIn.Stub(action => action.FetchStatistics()).Return(data); // ignore failures only if you want to build build report statistic CCNetProjectStatisticsModule module = new CCNetProjectStatisticsModule( plugIn, graphs, fileManager, templateEngine, true); module.ProjectId = "CCNetStatistics"; project.AddModule(module); module.ExecuteTask(null); module.FetchHtmlReport(); Assert.AreEqual(module.ProjectId, "CCNetStatistics"); Assert.AreEqual(module.ModuleName, "CCNet Project Statistics"); }
/// <summary> /// Initializes a new instance of the CCNetProjectStatisticsModule class /// using the specified <see cref="IProjectModule" />, <see cref="IViewable" /> /// and <see cref="ITask" /> /// </summary> /// <param name="ccnetPlugIn">Instance of <see cref="ICCNetProjectStatisticsPlugIn" /></param> /// <param name="graphs">List of graphs and parameters</param> /// <param name="fileManager">Instance of <see cref="IFileManager" /></param> /// <param name="templateEngine">Instance of <see cref="CCNetProjectStatisticsPlugIn" /></param> /// <param name="showBuildProjectHistory">Flag indicates whether graph will be made form entire history</param> public CCNetProjectStatisticsModule( ICCNetProjectStatisticsPlugIn ccnetPlugIn, IEnumerable <ProjectStatsGraph> graphs, IFileManager fileManager, ITemplateEngine templateEngine, bool showBuildProjectHistory) { this.ccnetPlugIn = ccnetPlugIn; this.graphs = (List <ProjectStatsGraph>)graphs; this.fileManager = fileManager; this.templateEngine = templateEngine; this.showBuildProjectHistory = showBuildProjectHistory; }