コード例 #1
0
        public void NullPathThrows()
        {
            var instruction = new DeletePatchInstruction {
                Path = null,
            };

            Assert.Throws<InvalidOperationException>(
                                                     () => instruction.Apply(PatchDataRoot, ApplicationRoot)
                );
        }
コード例 #2
0
        public void ApplyThrowsOnBadPath()
        {
            var instruction = new DeletePatchInstruction {
                Path = "File1.txt",
            };

            Assert.Throws<FileNotFoundException>(
                                                 () => instruction.Apply(PatchDataRoot, ApplicationRoot)
                );
        }
コード例 #3
0
        public void ApplyThrowsOnDirectoryPath()
        {
            Directory.CreateDirectory(Path.Combine(ApplicationRoot, "dir"));

            var instruction = new DeletePatchInstruction {
                Path = "dir",
            };

            Assert.Throws<InvalidOperationException>(
                                                     () => instruction.Apply(PatchDataRoot, ApplicationRoot)
                );
        }
コード例 #4
0
        public void ApplyDeletes()
        {
            using (var writer = File.CreateText(Path.Combine(ApplicationRoot, "File1.txt"))) {
                writer.Write("Delete me");
            }

            var instruction = new DeletePatchInstruction {
                Path = "File1.txt",
            };

            instruction.Apply(PatchDataRoot, ApplicationRoot);

            Assert.IsFalse(File.Exists(Path.Combine(ApplicationRoot, "File1.txt")));
        }