public void ZipFileObjectDirectories()
		{
			IIoRepository repo = new IoRepository();
			FileInfo zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip"));

			System.IO.File.CreateText(path.Combine(TestDir.FullName, "test2.txt")).Close();
			TestZip.AddFile(path.Combine(TestDir.FullName, "test2.txt"), "projects");
			TestZip.Save();
			foreach (var entry in TestZip.Entries)
			{
				Debug.WriteLine("Zip entry name: " + entry.FileName);
			}
			Debug.WriteLine("");
			using (var zipObject = new ZipFileObject(zipFileInfo, repo))
			{
				foreach (var item in zipObject.GetContents())
				{
					Debug.WriteLine(item.FullName);
				}
				Assert.AreEqual(2, zipObject.GetContents().Count(), "should be 2 root objects");
				Assert.AreEqual(1, zipObject.GetDirectories().Count(), "should be 1 root dir");
				Assert.AreEqual(1, zipObject.GetFiles().Count(), "should be 1 root file");

			}
		}
		public void ZipFileObjectRetrievesObjects()
		{
			IIoRepository repo = new IoRepository();
			FileInfo zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip"));
			using (var zipObject = new ZipFileObject(zipFileInfo, repo))
			{
				Assert.AreEqual(0, zipObject.GetContents().Count(), "should be no root objects");
			}
		}
Пример #3
0
        public void ZipFileObjectRetrievesObjects()
        {
            IIoRepository repo        = new IoRepository();
            FileInfo      zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip"));

            using (var zipObject = new ZipFileObject(zipFileInfo, repo))
            {
                Assert.AreEqual(0, zipObject.GetContents().Count(), "should be no root objects");
            }
        }
		public void TestIfZipEntryHasFullPathInFilename()
		{
			IIoRepository repo = new IoRepository();

			Assert.AreEqual(1, TestDir.GetFiles("test.zip").Count(), "zip file not exist");

			var stream = System.IO.File.CreateText(path.Combine(TestDir.FullName, "test2.txt"));
				stream.Close();
				TestZip.AddFile(path.Combine(TestDir.FullName, "test2.txt"), "");
				TestZip.Save();
				foreach (var entry in TestZip.Entries)
				{
					Debug.WriteLine(entry.ToString());
					Debug.WriteLine(entry.FileName);
				}
		}
Пример #5
0
        public void GetContentsReturnsCorrectNumberOfFiles()
        {
            IIoRepository repository = new IoRepository();

            string testDirName = null;

            try
            {
                testDirName = CreateTempTestDir(testDirName);
                IList <IFileSystemObject> dirList = repository.GetContents(testDirName);
                Assert.AreEqual(1, dirList.Count, "GetContents not returning right number of objects");
            }
            finally
            {
                Directory.Delete(testDirName, true);
            }
        }
Пример #6
0
        public void TestIfZipEntryHasFullPathInFilename()
        {
            IIoRepository repo = new IoRepository();

            Assert.AreEqual(1, TestDir.GetFiles("test.zip").Count(), "zip file not exist");

            var stream = System.IO.File.CreateText(path.Combine(TestDir.FullName, "test2.txt"));

            stream.Close();
            TestZip.AddFile(path.Combine(TestDir.FullName, "test2.txt"), "");
            TestZip.Save();
            foreach (var entry in TestZip.Entries)
            {
                Debug.WriteLine(entry.ToString());
                Debug.WriteLine(entry.FileName);
            }
        }
Пример #7
0
		public void GetContentsReturnsCorrectNumberOfFiles()
		{
			IIoRepository repository = new IoRepository();

			string testDirName = null;
			try
			{
				testDirName = CreateTempTestDir(testDirName);
				IList<IFileSystemObject> dirList = repository.GetContents(testDirName);
				Assert.AreEqual(1, dirList.Count, "GetContents not returning right number of objects");
			}
			finally
			{
				Directory.Delete(testDirName, true);
			}
			
		}
Пример #8
0
		public void GetContentsForCurrentDirectoryNotNull()
		{
			IIoRepository repository = new IoRepository();

			DirectoryInfo CurrentDirectory = new DirectoryInfo(".");
			DirectoryInfo testDir = null;
			var testDirName = Guid.NewGuid().ToString();
			try
			{
				Assert.IsTrue(CurrentDirectory.Exists, "current ("+CurrentDirectory.FullName+") dir not exist");
				testDir = CurrentDirectory.CreateSubdirectory(testDirName);
				IList<IFileSystemObject> dirList = repository.GetContents(testDir.FullName);
				Assert.IsNotNull(dirList);
			}
			finally
			{
				testDir.Delete();
			}
		}
Пример #9
0
        public void GetContentsForCurrentDirectoryNotNull()
        {
            IIoRepository repository = new IoRepository();

            DirectoryInfo CurrentDirectory = new DirectoryInfo(".");
            DirectoryInfo testDir          = null;
            var           testDirName      = Guid.NewGuid().ToString();

            try
            {
                Assert.IsTrue(CurrentDirectory.Exists, "current (" + CurrentDirectory.FullName + ") dir not exist");
                testDir = CurrentDirectory.CreateSubdirectory(testDirName);
                IList <IFileSystemObject> dirList = repository.GetContents(testDir.FullName);
                Assert.IsNotNull(dirList);
            }
            finally
            {
                testDir.Delete();
            }
        }
Пример #10
0
        public void ZipFileObjectDirectories()
        {
            IIoRepository repo        = new IoRepository();
            FileInfo      zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip"));

            System.IO.File.CreateText(path.Combine(TestDir.FullName, "test2.txt")).Close();
            TestZip.AddFile(path.Combine(TestDir.FullName, "test2.txt"), "projects");
            TestZip.Save();
            foreach (var entry in TestZip.Entries)
            {
                Debug.WriteLine("Zip entry name: " + entry.FileName);
            }
            Debug.WriteLine("");
            using (var zipObject = new ZipFileObject(zipFileInfo, repo))
            {
                foreach (var item in zipObject.GetContents())
                {
                    Debug.WriteLine(item.FullName);
                }
                Assert.AreEqual(2, zipObject.GetContents().Count(), "should be 2 root objects");
                Assert.AreEqual(1, zipObject.GetDirectories().Count(), "should be 1 root dir");
                Assert.AreEqual(1, zipObject.GetFiles().Count(), "should be 1 root file");
            }
        }
		public void CanCreateZipFileObject()
		{
			IIoRepository repo = new IoRepository();
			FileInfo zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip"));
			var zipObject = new ZipFileObject(zipFileInfo, repo);
		}
Пример #12
0
 public void CanCreateZipFileObject()
 {
     IIoRepository repo        = new IoRepository();
     FileInfo      zipFileInfo = new FileInfo(path.Combine(TestDir.FullName, "test.zip"));
     var           zipObject   = new ZipFileObject(zipFileInfo, repo);
 }
Пример #13
0
        public void GetContentsFailsForBadPath()
        {
            IIoRepository repository = new IoRepository();

            IList <IFileSystemObject> dirList = repository.GetContents(path: "");
        }
Пример #14
0
		public void GetContentsFailsForBadPath()
		{
			IIoRepository repository = new IoRepository();

			IList<IFileSystemObject> dirList = repository.GetContents(path: "");
		}