Esempio n. 1
0
        public virtual void TestAddA1Sub()
        {
            ApplyResult result = Init("A1_sub", false, false);

            NUnit.Framework.Assert.AreEqual(1, result.GetUpdatedFiles().Count);
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, "sub/A1"), result.GetUpdatedFiles
                                                ()[0]);
        }
Esempio n. 2
0
        public void TestThatPatchingWhichMakesFileEmptyCanBeApplied()
        {
            ApplyResult result = Init("ToEmpty", true, true);

            NUnit.Framework.Assert.AreEqual(1, result.GetUpdatedFiles().Count);
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, "ToEmpty"), result.GetUpdatedFiles
                                                ()[0]);
            CheckFile(new FilePath(db.WorkTree, "ToEmpty"), b.GetString(0, b.Size(), false));
        }
Esempio n. 3
0
        public virtual void TestAddA1()
        {
            ApplyResult result = Init("A1", false, true);

            NUnit.Framework.Assert.AreEqual(1, result.GetUpdatedFiles().Count);
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, "A1"), result.GetUpdatedFiles
                                                ()[0]);
            CheckFile(new FilePath(db.WorkTree, "A1"), b.GetString(0, b.Size(), false));
        }
Esempio n. 4
0
        public virtual void TestDeleteD()
        {
            ApplyResult result = Init("D", true, false);

            NUnit.Framework.Assert.AreEqual(1, result.GetUpdatedFiles().Count);
            NUnit.Framework.Assert.AreEqual(new FilePath(db.WorkTree, "D"), result.GetUpdatedFiles
                                                ()[0]);
            NUnit.Framework.Assert.IsFalse(new FilePath(db.WorkTree, "D").Exists());
        }
Esempio n. 5
0
        public void TestThatPatchWhichHasUtf8ByteOrderMarkInContextCanBeApplied()
        {
            ApplyResult result = Init("FileStartingWithUtf8Bom", true, true);

            Assert.AreEqual(1, result.GetUpdatedFiles().Count);
            Assert.AreEqual(new FilePath(db.WorkTree, "FileStartingWithUtf8Bom"), result.GetUpdatedFiles()[0]);
            Assert.That(
                File.ReadAllBytes(new FilePath(db.WorkTree, "FileStartingWithUtf8Bom")),
                Is.EqualTo(Encoding.UTF8.GetBytes(b.GetString(0, b.Size(), false))));
        }
        public void PatchesContainingModifiedFilesWithDifferentFileNameCasingCanBeApplied()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                Assert.Ignore("This doesn't make sense on a case-sensitive file system.");
            }
            ApplyResult result = Init();

            NUnit.Framework.Assert.AreEqual(2, result.GetUpdatedFiles().Count);
            CheckFile(new FilePath(db.WorkTree, "FILECASING"), b.GetString(0, b.Size(), false));
        }