public void ExceptionShouldBeThrownWhenNullOptions() { var mockFormatter = new Mock <ICSVFormatter>(); var detailedReport = new detailedreport(); var sut = new CSVAnalysisWriter(mockFormatter.Object); using var resultStream = new MemoryStream(); using var resultWriter = new StreamWriter(resultStream); Should.Throw <ArgumentNullException>(() => sut.Write(resultWriter, detailedReport, null)); }
public void ExceptionShouldBeThrownWhenNullWriter() { var mockFormatter = new Mock <ICSVFormatter>(); var options = new Options { OutputFileName = "output.csv" }; var detailedReport = new detailedreport(); var sut = new CSVAnalysisWriter(mockFormatter.Object); Should.Throw <ArgumentNullException>(() => sut.Write(null, detailedReport, options)); }
public void ExceptionShouldBeThrownWhenNullReport() { var mockFormatter = new Mock <ICSVFormatter>(); var options = new Options { OutputFileName = "output.csv" }; var sut = new CSVAnalysisWriter(mockFormatter.Object); using var resultStream = new MemoryStream(); using var resultWriter = new StreamWriter(resultStream); Should.Throw <ArgumentNullException>(() => sut.Write(resultWriter, null, options)); }
public void ShouldLoadStaticResultsWithSCA() { var detailedReport = detailedreport.LoadFromFile("./xml/LoadValidStaticFileWithSCATest.xml"); var mockFormatter = new Mock <ICSVFormatter>(); var options = new Options { GenerateAnalysis = true }; using (var resultStream = new MemoryStream()) using (var resultWriter = new StreamWriter(resultStream)) { var sut = new CSVAnalysisWriter(mockFormatter.Object); sut.Write(resultWriter, detailedReport, options); resultWriter.Flush(); } // 1 for header, 2 for sca results mockFormatter.Verify(x => x.FormatLine(It.IsAny <List <string> >()), Times.Exactly(3)); }