コード例 #1
0
        public void FileWithoutStringNumbers()
        {
            string  filePath = Test_StaticData.CreateAndFillFile("abc");
            ParseT9 parseT9  = new ParseT9();

            bool res = parseT9.ProcessFile(filePath);

            Assert.That(res, Is.EqualTo(false));
        }
コード例 #2
0
        public void EmptyFile()
        {
            string  filePath = Test_StaticData.CreateAndFillFile("");
            ParseT9 parseT9  = new ParseT9();

            bool res = parseT9.ProcessFile(filePath);

            Assert.That(res, Is.EqualTo(true));
        }
コード例 #3
0
        public void BadFormatFile()
        {
            ParseT9 parseT9 = new ParseT9();

            string filePath = Test_StaticData.CreateAndFillFile("abc");

            bool res = parseT9.ProcessFileAsync(filePath).Result;

            Assert.That(res, Is.EqualTo(false));
        }
コード例 #4
0
        public void BigFile()
        {
            string filePath    = Test_StaticData.CreateAndFillFile(Test_StaticData.BigFileContent);
            string outFilePath = Test_StaticData.CreateAndFillFile();

            ParseT9 parseT9 = new ParseT9(filePath, outFilePath);
            bool    res     = parseT9.ProcessFile();

            //Сравниваем с эталонным хэшем файла - означает что конвертировали правильно
            string resultHash = Test_StaticData.GetFileHash(outFilePath);

            File.Delete(filePath);
            File.Delete(outFilePath);

            Assert.That(resultHash, Is.EqualTo(Test_StaticData.BigFileHash));
        }
コード例 #5
0
        public void SmallFile()
        {
            string  fileContent = "2" + '\n' + "abc" + '\n' + "";
            string  filePath    = Test_StaticData.CreateAndFillFile(fileContent);
            ParseT9 parseT9     = new ParseT9();

            bool res = parseT9.ProcessFile(filePath);

            string retStr;

            parseT9.ResultConcurrentDictionary.TryGetValue(1, out retStr);

            File.Delete(filePath);

            Assert.That(retStr, Is.EqualTo(StaticData.StartString + "1" + StaticData.MiddleString + "2 22 222"));
        }
コード例 #6
0
        public void SmallFile()
        {
            string fileContent = "2" + '\n' + "abc" + '\n' + "";
            string filePath    = Test_StaticData.CreateAndFillFile(fileContent);

            ParseT9 parseT9 = new ParseT9()
            {
                NeedSaveToFile = false
            };
            bool res = parseT9.ProcessFileAsync(filePath).Result;

            parseT9.OutFilePath = Path.GetTempFileName();
            parseT9.SaveToFile();

            Assert.That(File.Exists(parseT9.OutFilePath), Is.EqualTo(true));

            File.Delete(filePath);
            File.Delete(parseT9.OutFilePath);
        }
コード例 #7
0
        public void BigFile()
        {
            string fileContent = Test_StaticData.BigFileContent;
            string filePath    = Test_StaticData.CreateAndFillFile(fileContent);

            ParseT9 parseT9 = new ParseT9()
            {
                NeedSaveToFile = false
            };
            bool res = parseT9.ProcessFileAsync(filePath).Result;

            parseT9.OutFilePath = Path.GetTempFileName();
            parseT9.SaveToFile();

            string resultHash = Test_StaticData.GetFileHash(parseT9.OutFilePath);

            File.Delete(filePath);
            File.Delete(parseT9.OutFilePath);

            Assert.That(resultHash, Is.EqualTo(Test_StaticData.BigFileHash));
        }