public void GetHeaders_FileDoesNotExist_ThrowsException(AsciiSettings NotExisitngFileAsciiSettings) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(NotExisitngFileAsciiSettings); // act TestDelegate action = () => asciiImport.GetHeaders(); // assert Assert.Throws <FileNotFoundException>(action, "Expected exception was not thrown."); }
public void GetHeaders_EmptyFileAndUseFirstRowAsHeaders_ReturnEmptyHeaders(AsciiSettings EmptyFilesAsciiSettings, int rowsNum) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(EmptyFilesAsciiSettings); // act var headers = asciiImport.GetHeaders(); // assert Assert.AreEqual(rowsNum, headers.Count(), "The returned headers are not empty."); }
public void GetHeaders_FileWithoutHeadersinFirstRow_ReturnGenericHeaders(AsciiSettings GenericHeadersAsciiSettings, IEnumerable <object> genericHeaders) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(GenericHeadersAsciiSettings); // act var headers = asciiImport.GetHeaders().ToList(); // assert CollectionAssert.AreEqual(genericHeaders, headers); Assert.AreEqual(genericHeaders.Count(), headers.Count()); }
public void GetHeaders_FirstRowAsHeaders_ReturnHeadersFromFirstRow(AsciiSettings ValidAsciiSettings, IEnumerable <object> validHeaders) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(ValidAsciiSettings); // act var headers = asciiImport.GetHeaders(); // assert CollectionAssert.AreEqual(validHeaders, headers); Assert.AreEqual(validHeaders.Count(), headers.Count()); }
public void LoadAll_ValidFile_ReturnAllRowsFromFile(AsciiSettings ValidAsciiSettings, IEnumerable <object> validHeaders) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(ValidAsciiSettings); int headersNum, samplesNum; // act var rows = asciiImport.LoadAll(); var headers = asciiImport.GetHeaders(); samplesNum = rows.First().Samples.Count(); headersNum = headers.Count() - 1; // Timestamp is not sample CollectionAssert.AreEqual(validHeaders, headers); // assert Assert.AreEqual(1, rows.GroupBy(arg => arg.Samples.Count()).Count(), "Rows have a different number of columns."); Assert.AreEqual(samplesNum, headersNum, "The number of samples" + samplesNum + "is different from the number of headers" + headersNum); }