Exemplo n.º 1
0
        public void TestExport()
        {
            string path     = GetTemporaryPath();
            string file     = Path.Combine(path, "foo");
            string diffText = string.Empty;

            CommandClient.Initialize(path, MercurialPath);

            using (var client = new CommandClient(path, null, null, MercurialPath)) {
                File.WriteAllText(file, "1\n");
                client.Add(file);
                client.Commit("1");
                File.WriteAllText(file, "2\n");
                client.Commit("2");
                diffText = client.Export("1");
            }
            string[] lines = diffText.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries)
                             .Where(line => !line.StartsWith("#")).ToArray();
            Assert.AreEqual(7, lines.Count(), "Unexpected diff length");
            Assert.AreEqual("@@ -1,1 +1,1 @@", lines [4]);
            Assert.AreEqual("-1", lines [5]);
            Assert.AreEqual("+2", lines [6]);
        }