Exemplo n.º 1
0
        public void LinkFileTest_Destination_DoesNotExist()
        {
            string source      = @"LinkFileTest\LinkFileTest_Destination_DoesNotExist.txt";
            string destination = @"LinkFileTest\NotFound\LinkFileTest_Destination_DoesNotExist.txt";

            Assert.IsFalse(Directory.Exists(Path.GetDirectoryName(destination)));
            Assert.ThrowsException <DestinationDirectoryNotFoundException>(() => LinkCreator.LinkFile(source, destination));
        }
Exemplo n.º 2
0
        public void LinkFileTest_Source_DoesNotExist()
        {
            string source      = @"LinkFileTest\LinkFileTest_Source_DoesNotExist.txt";
            string destination = @"LinkFileTest\Exists\LinkFileTest_Destination_Exists.txt";

            Assert.IsFalse(File.Exists(source));
            Assert.ThrowsException <SourceFileNotFoundException>(() => LinkCreator.LinkFile(source, destination));
        }
Exemplo n.º 3
0
        public void LinkFileTest_Destination_Exists()
        {
            string source      = @"LinkFileTest\LinkFileTest_Destination_Exists.txt";
            string destination = @"LinkFileTest\Exists\LinkFileTest_Destination_Exists.txt";

            Assert.ThrowsException <DestinationFileExistsException>(() => LinkCreator.LinkFile(source, destination));
            Assert.AreNotEqual(ReadFileContents(source), ReadFileContents(destination));
        }
Exemplo n.º 4
0
        public void LinkFileTest_Modification_Destination()
        {
            string source      = @"LinkFileTest\LinkFileTest_Modification_Destination.txt";
            string destination = @"LinkFileTest\Success\LinkFileTest_Modification_Destination.txt";

            CleanDestinationDirectory(source, destination);
            LinkCreator.LinkFile(source, destination);
            Assert.IsTrue(File.Exists(source));
            Assert.IsTrue(File.Exists(destination));
            Assert.AreEqual(ReadFileContents(source), ReadFileContents(destination));
            using (var writer = new StreamWriter(destination, true))
            {
                writer.WriteLine("I really hope that this also works cause that'd be cool");
            }
            Assert.AreEqual(ReadFileContents(source), ReadFileContents(destination));
        }
Exemplo n.º 5
0
        public void LinkFileTest()
        {
            string source      = @"LinkFileTest\LinkFileTest_NoModification.txt";
            string destination = @"LinkFileTest\Success\LinkFileTest_NoModification.txt";

            CleanDestinationDirectory(source, destination);
            LinkCreator.LinkFile(source, destination);
            Assert.IsTrue(File.Exists(source));
            Assert.IsTrue(File.Exists(destination));
            Assert.AreEqual(ReadFileContents(source), ReadFileContents(destination));
            File.Delete(source);
            Assert.IsFalse(File.Exists(source));
            Assert.IsTrue(File.Exists(destination));
            File.Delete(destination);
            Assert.IsFalse(File.Exists(destination));
        }