Ejemplo n.º 1
0
        public void Close()
        {
            _isClosed = true;

            if (_xmlReader != null)
            {
                _xmlReader.Close();
            }

            if (_sheetStream != null)
            {
                _sheetStream.Close();
            }

            if (_zipWorker != null)
            {
                _zipWorker.Dispose();
            }
        }
Ejemplo n.º 2
0
        public void ZipWorker_Extract_Test()
        {
            var zipper = new ZipWorker();

            zipper.Extract(Helper.GetTestWorkbook("TestChess"));
            Assert.AreEqual(false, Directory.Exists(zipper.TempPath));
            Assert.AreEqual(false, zipper.IsValid);

            zipper.Extract(Helper.GetTestWorkbook("xTestOpenXml"));

            Assert.AreEqual(true, Directory.Exists(zipper.TempPath));
            Assert.AreEqual(true, zipper.IsValid);

            string tPath = zipper.TempPath;

            zipper.Dispose();

            Assert.AreEqual(false, Directory.Exists(tPath));
        }
Ejemplo n.º 3
0
        public void ZipWorker_Extract_Test()
        {
            var zipper = new ZipWorker(FileSystem.Current, new FileHelper());

            //this first one isn't a valid xlsx so we are expecting no side effects in the directory tree
            zipper.Extract(Helper.GetTestWorkbook("TestChess"));
            Assert.AreEqual(false, Directory.Exists(zipper.TempPath));
            Assert.AreEqual(false, zipper.IsValid);

            //this one is valid so we expect to find the files
            zipper.Extract(Helper.GetTestWorkbook("xTestOpenXml"));

            Assert.AreEqual(true, Directory.Exists(zipper.TempPath));
            Assert.AreEqual(true, zipper.IsValid);

            string tPath = zipper.TempPath;

            //make sure that dispose gets rid of the files
            zipper.Dispose();

            Assert.AreEqual(false, Directory.Exists(tPath));
        }