コード例 #1
0
        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.");
        }
コード例 #2
0
        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.");
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        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());
        }
コード例 #5
0
        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);
        }