public void It_should_allow_clear_add_and_remove_items() { var writer = Mock.Of <IReportWriter>(); var writer2 = Mock.Of <IReportWriter>(); var configuration = new ReportWritersConfiguration(); Assert.That(configuration.Clear(), Is.Empty); Assert.That(configuration.Add(writer).Add(writer2).ToArray(), Is.EqualTo(new[] { writer, writer2 })); Assert.That(configuration.Remove(writer).ToArray(), Is.EqualTo(new[] { writer2 })); }
public void It_should_not_allow_null_items() { var configuration = new ReportWritersConfiguration(); Assert.Throws <ArgumentNullException>(() => configuration.Add(null)); }
/// <summary> /// Adds <see cref="ReportFileWriter"/> instance configured to format report with <typeparamref name="TFormatter"/> and write it to <paramref name="outputPath"/>. /// </summary> /// <typeparam name="TFormatter">Type of report formatter.</typeparam> /// <param name="configuration">Configuration.</param> /// <param name="outputPath">Output path for the report.</param> /// <returns>Configuration.</returns> public static ReportWritersConfiguration AddFileWriter <TFormatter>(this ReportWritersConfiguration configuration, string outputPath) where TFormatter : IReportFormatter, new() { return(configuration.Add(new ReportFileWriter(new TFormatter(), outputPath))); }
/// <summary> /// Applies default report generators to generate <c>~\\Reports\\FeaturesReport.html</c>(Win) <c>~/Reports/FeaturesReport.html</c>(Unix) reports. /// </summary> public static ReportWritersConfiguration RegisterFrameworkDefaultReportWriters(this ReportWritersConfiguration configuration) { return(configuration.Add(new ReportFileWriter(new HtmlReportFormatter(), "~" + Path.DirectorySeparatorChar + "Reports" + Path.DirectorySeparatorChar + "FeaturesReport.html"))); }