public void Test_ReportOk_Single( ) { ImportRun importRun = new ImportRun( ); ImportRunReporter reporter = new ImportRunReporter(importRun); reporter.ReportOk( ); reporter.ReportOk(2); reporter.Flush( ); Assert.That(importRun.ImportRecordsFailed, Is.EqualTo(0)); Assert.That(importRun.ImportRecordsSucceeded, Is.EqualTo(3)); Assert.That(importRun.ImportMessages, Is.Null); }
public void Test_Calls_DontAccumulateForSameRecord( ) { ImportRun importRun = new ImportRun( ); ImportRunReporter reporter = new ImportRunReporter(importRun); Mock <IObjectReader> mockObject = new Mock <IObjectReader>( ); mockObject.Setup(obj => obj.GetLocation( )).Returns(() => "Line 1"); reporter.ReportError(mockObject.Object, "Message"); reporter.ReportError(mockObject.Object, "Message"); reporter.ReportOk( ); reporter.Flush( ); reporter.ReportOk(2); reporter.Flush( ); Assert.That(importRun.ImportRecordsFailed, Is.EqualTo(1)); Assert.That(importRun.ImportRecordsSucceeded, Is.EqualTo(3)); Assert.That(importRun.ImportMessages, Is.EqualTo("Line 1: Message\r\nLine 1: Message\r\n")); }