Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ProcessNames();

            _dService = new DecompresService(path, search_pattern, true);
            _dService.ExtractAll();

            Console.WriteLine("\nPress enter to finish.");
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public void TestDecompresService()
        {
            Assert.IsInstanceOfType(_dService, typeof(IDecompresService));
            Assert.IsNotNull(_dService);

            using (var archive = _dService.OpenRead())
            {
                Assert.IsNotNull(archive);
                _dService._zip = archive;
                Assert.AreEqual(archive, _dService._zip);

                var temp_directory = _dService.CreateTempDirectory();
                Assert.IsNotNull(temp_directory);

                _dService._temp_directory = temp_directory;
                Assert.AreEqual(temp_directory, _dService._temp_directory);

                try
                {
                    _dService.ExtractAll();
                    Assert.IsTrue(true);
                }
                catch (UnitTestAssertException ex)
                {
                    Assert.Fail(ex.Message);
                }

                try
                {
                    _dService.RemoveTempDirectory();
                    var is_temp_exist = Directory.Exists(temp_directory);
                    Assert.IsFalse(is_temp_exist);
                }
                catch (AssertFailedException ex)
                {
                    Assert.Fail(ex.Message);
                }

                _dService.Dispose();
            }
        }