Exemplo n.º 1
0
        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.");
        }
Exemplo n.º 2
0
        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.");
        }
Exemplo n.º 3
0
        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.");
        }
Exemplo n.º 4
0
        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.");
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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());
        }
Exemplo n.º 7
0
        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());
        }