public IReport SubReport(string name)
        {
            var subReport = new SerializableReport();

            ReportInner(name, subReport);

            return(subReport);
        }
        public void ReportToFile()
        {
            lock (_lock)
            {
                var report = new SerializableReport();

                var timestamp = _dateTimeProvider.CurrentDateTime.ToStringISO8601(DateTimeFormatting.UtcAndLocalTemplate.UtcAndLocal);
                report.Prefix = string.Format("######## {0}", timestamp);

                _reporters.ForEach(reporter => reporter(report));

                _fileSystem.WriteReport(_reportFilePath, report, append: true);
            }
        }
Example #3
0
        private SerializableReport GetOrInitReport(string id)
        {
            lock (_lock)
            {
                if (!_reports.ContainsKey(id))
                {
                    var report = new SerializableReport();
                    report.Prefix = string.Format("######## ID: {0}\n", id);

                    _reports[id] = report;
                }

                return _reports[id];
            }
        }
        public void WriteReport_writes_report_to_file()
        {
            var report = new SerializableReport();

            report.Report("foo", "bar");
            var expected = "foo: bar\n";

            var path = new FileSystemPath("moo.report");

            var fileSystemMock = FileSystemTestUtils.CreateMock();

            fileSystemMock.SetupWritableFile(path, expected);

            fileSystemMock.Object.WriteReport(path, report, append: false);

            fileSystemMock.AssertFileWritten(path, expected);
        }
Example #5
0
 public void SetUp()
 {
     _report = new SerializableReport();
 }
Example #6
0
 public static void WriteReport(this IFileSystem @this, FileSystemPath path, SerializableReport report, bool append = false)
 {
     @this.WriteTextFile(path, report.Serialize(), append);
 }