public void should_be_able_to_generate_an_id_per_default() { var sut = new ReportIdGenerator(); var actual = sut.GenerateImp(new Exception()); actual.Should().NotBeNullOrWhiteSpace(); }
public void should_use_the_new_factory_when_configured() { var sut = new ReportIdGenerator(); var actual = sut.GenerateImp(new Exception()); actual.Should().NotBeNullOrWhiteSpace(); }
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); }
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); }