public void Load_ColumnDelimiterAsElementofDateTimeFormat_ThrowsException(AsciiSettings ColumnDelimiterAsElementofDateTimeFormatAsciiSettings, int rows) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(ColumnDelimiterAsElementofDateTimeFormatAsciiSettings); // act TestDelegate action = () => asciiImport.Load(0, rows).ToList(); // assert Assert.Throws <ArgumentException>(action, "Expected exception was not thrown."); }
public void Load_InvalidDateTimeFormat_ThrowsException(AsciiSettings InvalidDateTimeFormatAsciiSettings, int rows) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(InvalidDateTimeFormatAsciiSettings); // act TestDelegate action = () => asciiImport.Load(0, rows).ToList(); // assert Assert.Throws <FormatException>(action, "Expected exception was not thrown."); }
public void Load_FileWithColumnDelimiterTheSameAsNumberDelimiter_ThrowsException(AsciiSettings FileWithColumnDelimiterTheSameAsNumberDelimiterAsciiSettings, int rows) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(FileWithColumnDelimiterTheSameAsNumberDelimiterAsciiSettings); // act TestDelegate action = () => asciiImport.Load(0, rows).ToList().ForEach(arg => arg.Samples.ToList()); // assert Assert.Throws <ArgumentException>(action, "Expected exception was not thrown."); }
public void Load_SettingsWithColumnDelimiterTheSameAsNumberDelimiter_ThrowsException(AsciiSettings ColumnDelimiterTheSameAsNumberDelimiterAsciiSettings, int rows) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(ColumnDelimiterTheSameAsNumberDelimiterAsciiSettings); // act TestDelegate action = () => asciiImport.Load(0, rows); // assert Assert.Throws <ArgumentException>(action, "Expected exception was not thrown."); }
public void Load_SkipAllRows_ReturnEmpty(AsciiSettings SkipAllRowsAsciiSettings, int skip, int take) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(SkipAllRowsAsciiSettings); string failInfo = "Returned collection are invalid."; // act var rows = asciiImport.Load(skip, take); // assert Assert.AreEqual(0, rows.Count(), failInfo); }
public void Load_ValidColumnDelimiter_ReturnValidRows(AsciiSettings ColumnDelimitersAsciiSettings, int rowsNum, int columnsNum) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(ColumnDelimitersAsciiSettings); // act var rows = asciiImport.Load(0, rowsNum); // assert Assert.AreEqual(rowsNum, rows.Count()); Assert.AreEqual(1, rows.GroupBy(arg => arg.Samples.Count()).Count()); Assert.AreEqual(columnsNum, rows.ElementAt(0).Samples.Count()); }
public void Load_ValidFile_ReturnSpecificRowsRangeFromFile(AsciiSettings ReturnSpecificRowsRangeFromFile, int rowsNum) { // arrange AsciiDataImport asciiImport = new AsciiDataImport(ReturnSpecificRowsRangeFromFile); // act var rows = asciiImport.Load(0, rowsNum); // assert Assert.AreEqual(rowsNum, rows.Count()); //Check if all rows have the same columns number Assert.AreEqual(1, rows.GroupBy(arg => arg.Samples.Count()).Count()); }