Beispiel #1
0
        public void TestSaveMethod()
        {
            TableFile tableFile = new TableFile();

            tableFile.Load(TEST_FILE);

            MemoryStream savedStream = new MemoryStream();

            tableFile.Save(savedStream);

            savedStream.Seek(0, SeekOrigin.Begin);

            TableFile savedTableFile = new TableFile();

            savedTableFile.Load(savedStream);

            savedStream.Close();

            Assert.AreEqual(tableFile.MaximumRange, savedTableFile.MaximumRange, "Maximum range does not match");

            for (int i = 0; i < tableFile.MaximumRange; i++)
            {
                Assert.AreEqual(tableFile.StartIndices[i], tableFile.StartIndices[i], "Start index does not match");
                Assert.AreEqual(tableFile.IndexCounts[i], tableFile.IndexCounts[i], "Index count does not match");
            }

            Assert.AreEqual(tableFile.Points.Count, savedTableFile.Points.Count, "Points count does not match");

            for (int i = 0; i < tableFile.Points.Count; i++)
            {
                Assert.AreEqual(tableFile.Points[i].X, tableFile.Points[i].X, "Points do not match");
                Assert.AreEqual(tableFile.Points[i].Y, tableFile.Points[i].Y, "Points do not match");
            }
        }