Esempio n. 1
0
        public void TestSaveMethod()
        {
            LanguageFile languageFile = new LanguageFile();

            languageFile.Load(TEST_FILE);

            MemoryStream savedStream = new MemoryStream();

            languageFile.Save(savedStream);

            savedStream.Seek(0, SeekOrigin.Begin);

            LanguageFile savedLanguageFile = new LanguageFile();

            savedLanguageFile.Load(savedStream);

            savedStream.Close();

            Assert.AreEqual(languageFile.RowCount, savedLanguageFile.RowCount, "Row counts do not match");
            Assert.AreEqual(languageFile.ColumnCount, savedLanguageFile.ColumnCount, "Column counts do not match");

            for (int i = 0; i < languageFile.RowCount; i++)
            {
                for (int j = 0; j < languageFile.ColumnCount; j++)
                {
                    Assert.AreEqual(languageFile[i][j], savedLanguageFile[i][j], "Cell values do not match");
                }
            }
        }
Esempio n. 2
0
        public void TestLoadMethod()
        {
            const int ROW_COUNT    = 200;
            const int COLUMN_COUNT = 6;

            Stream stream = File.OpenRead(TEST_FILE);

            stream.Seek(0, SeekOrigin.End);
            long fileSize = stream.Position;

            stream.Seek(0, SeekOrigin.Begin);

            LanguageFile languageFile = new LanguageFile();

            languageFile.Load(stream);

            long streamPosition = stream.Position;

            stream.Close();

            Assert.AreEqual(fileSize, streamPosition, "Not all of the file was read");
            Assert.AreEqual(ROW_COUNT, languageFile.RowCount, "Incorrect row count");
            Assert.AreEqual(COLUMN_COUNT, languageFile.ColumnCount, "Incorrect column count");
        }