Exemple #1
0
        public void CopyTo()
        {
            string tempFile = Path.GetTempFileName();
            string tempFile2 = Path.GetFileNameWithoutExtension(tempFile) + "Copy" + Path.GetExtension(tempFile);

            ExtendedFileInfo efi = new ExtendedFileInfo(tempFile);
            efi.CopyTo(tempFile2);

            Assert.IsTrue(File.Exists(tempFile2));
        }
Exemple #2
0
        public void CopyTo2()
        {
            string tempFile = Path.GetTempFileName();
            string tempFile2 = Path.GetFileNameWithoutExtension(tempFile) + "Copy" + Path.GetExtension(tempFile);

            ExtendedFileInfo efi = new ExtendedFileInfo(tempFile);
            efi.CopyTo(tempFile2, true);

            Assert.IsTrue(File.Exists(tempFile2));

            try
            {
                efi.CopyTo(tempFile2, false);
            }
            catch (IOException)
            {
                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }