示例#1
0
        public void should_be_able_to_generate_an_id_per_default()
        {
            var sut = new ReportIdGenerator();

            var actual = sut.GenerateImp(new Exception());

            actual.Should().NotBeNullOrWhiteSpace();
        }
示例#2
0
        public void should_use_the_new_factory_when_configured()
        {
            var sut = new ReportIdGenerator();

            var actual = sut.GenerateImp(new Exception());

            actual.Should().NotBeNullOrWhiteSpace();
        }
示例#3
0
        public ErrorReportDTO ReportCopy(ErrorReportDTO blueprint, string message,
                                         Action <ErrorReportDTO> customizations = null)
        {
            var id        = ReportIdGenerator.Generate(new Exception());
            var newDto    = new ExceptionDTO(blueprint.Exception);
            var newReport = new ErrorReportDTO(id, blueprint.Exception, blueprint.ContextCollections);

            customizations?.Invoke(newReport);
            _config.Uploaders.Upload(newReport);
            return(newReport);
        }
示例#4
0
        public void should_use_the_assigned_reportId_factory_to_assign_a_report_id()
        {
            var dispatcher   = Substitute.For <IUploadDispatcher>();
            var config       = new CoderrConfiguration(dispatcher);
            var ex           = new Exception();
            var timesInvoked = 0;

            ReportIdGenerator.Assign(x => { timesInvoked++; return("a"); });

            var sut = new ExceptionProcessor(config);

            sut.Build(ex);
            sut.Build(ex, "Hello world");
            sut.Build(new ErrorReporterContext(this, ex));

            timesInvoked.Should().Be(3);
        }