Beispiel #1
0
        public void ReadFileAndCheckRowCount()
        {
            TextFileReader reader = new TextFileReader(TestFolder + "TestFile1.sha1");

            Sha1File sumFile = new Sha1File();
            List <Pair <string> > itemList = sumFile.ReadData(reader);

            Assert.AreEqual(itemList.Count, _testFile1RowCount);
        }
Beispiel #2
0
        public void WriteHeader()
        {
            StreamWriter fileOut = new StreamWriter(@"../../TestData/UnitTestFolder/TestFileWrite1.Sha1", false);
            Sha1File     sumFile = new Sha1File();

            sumFile.Header(fileOut);
            fileOut.Close();

            Assert.IsTrue(File.Exists(@"../../TestData/UnitTestFolder/TestFileWrite1.sha1"));

            string[] lines = File.ReadAllLines(@"../../TestData/UnitTestFolder/TestFileWrite1.sha1");
            Assert.GreaterOrEqual(lines.Length, 1);

            File.Delete(@"../../TestData/UnitTestFolder/TestFileWrite1.sha1");
        }
Beispiel #3
0
        public void ReadFile()
        {
            TextFileReader reader = new TextFileReader(TestFolder + "TestFile1.sha1");

            Sha1File sumFile = new Sha1File();
            List <Pair <string> > itemList = sumFile.ReadData(reader);

            int i = 0;

            foreach (Pair <string> item in itemList)
            {
                // TODO: must validity-check values!
                Assert.AreEqual(item.Item1.ToString(), _checkSum[i]);
                i++;
            }
        }
Beispiel #4
0
        public void WriteSums()
        {
            StreamWriter fileOut = new StreamWriter(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1", false);
            Sha1File     sumFile = new Sha1File();

            sumFile.WriteDataRow(fileOut, "94a3225c6bac573a06da75b05bcf6de59f65db2c",
                                 "test.txt");
            fileOut.Close();

            Assert.IsTrue(File.Exists(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1"));

            string[] lines = File.ReadAllLines(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1");
            Assert.AreEqual(1, lines.Length);
            Assert.IsTrue(lines[0] == "94a3225c6bac573a06da75b05bcf6de59f65db2c test.txt");

            File.Delete(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1");
        }
Beispiel #5
0
        public void WriteSums()
        {
            StreamWriter fileOut = new StreamWriter(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1", false);
            Sha1File sumFile = new Sha1File();
            sumFile.WriteDataRow(fileOut, "94a3225c6bac573a06da75b05bcf6de59f65db2c",
                                 "test.txt");
            fileOut.Close();

            Assert.IsTrue(File.Exists(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1"));

            string[] lines = File.ReadAllLines(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1");
            Assert.AreEqual(1, lines.Length);
            Assert.IsTrue(lines[0] == "94a3225c6bac573a06da75b05bcf6de59f65db2c test.txt");

            File.Delete(@"../../TestData/UnitTestFolder/TestFileWrite2.sha1");
        }
Beispiel #6
0
        public void WriteHeader()
        {
            StreamWriter fileOut = new StreamWriter(@"../../TestData/UnitTestFolder/TestFileWrite1.Sha1", false);
            Sha1File sumFile = new Sha1File();
            sumFile.Header(fileOut);
            fileOut.Close();

            Assert.IsTrue(File.Exists(@"../../TestData/UnitTestFolder/TestFileWrite1.sha1"));

            string[] lines = File.ReadAllLines(@"../../TestData/UnitTestFolder/TestFileWrite1.sha1");
            Assert.GreaterOrEqual(lines.Length, 1);

            File.Delete(@"../../TestData/UnitTestFolder/TestFileWrite1.sha1");
        }
Beispiel #7
0
        public void ReadFileAndCheckRowCount()
        {
            TextFileReader reader = new TextFileReader(TestFolder + "TestFile1.sha1");

            Sha1File sumFile = new Sha1File();
            List<Pair<string>> itemList = sumFile.ReadData(reader);

            Assert.AreEqual(itemList.Count, _testFile1RowCount);
        }
Beispiel #8
0
        public void ReadFile()
        {
            TextFileReader reader = new TextFileReader(TestFolder + "TestFile1.sha1");

            Sha1File sumFile = new Sha1File();
            List<Pair<string>> itemList = sumFile.ReadData(reader);

            int i = 0;
            foreach (Pair<string> item in itemList)
            {
                // TODO: must validity-check values!
                Assert.AreEqual(item.Item1.ToString(), _checkSum[i]);
                i++;
            }
        }