Esempio n. 1
0
 public void HasFileHandlers_ValidCommit_Validates_DoesNothing()
 {
     using(var bob = new RepositorySetup("bob"))
     {
         bob.AddAndCheckinFile("test.chorusTest", "hello");
         using(var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             bob.ChangeFile("test.chorusTest", "aloha");
             bob.AddAndCheckinFile("test2.chorusTest", "hi");
             Assert.IsNullOrEmpty(cop.ValidationResult);
         }
         bob.AssertHeadCount(1);
         bob.AssertLocalRevisionNumber(1);
         bob.AssertFileExistsInRepository("test2.chorusTest");
         bob.AssertFileContents("test.chorusTest", "aloha");
         bob.AssertFileContents("test2.chorusTest", "hi");
     }
 }
Esempio n. 2
0
 public void InitialFileCommit_Invalid_BacksOut()
 {
     using(var bob = new RepositorySetup("bob"))
     {
         bob.AddAndCheckinFile("validfile.chorustest", "valid contents");
         bob.ChangeFile("test.chorusTest", ChorusTestFileHandler.GetInvalidContents());
         using(var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             bob.Repository.AddAndCheckinFile("test.chorusTest");
             Assert.That(cop.ValidationResult, Is.StringContaining("Failed"));
         }
         Debug.WriteLine(bob.Repository.GetLog(-1));
         bob.AssertHeadCount(1);
         bob.AssertLocalRevisionNumber(2);
         bob.AssertFileDoesNotExistInRepository("test.chorusTest");
         bob.AssertFileExistsInRepository("validfile.chorustest");
     }
 }
Esempio n. 3
0
        public void Utf8ExtensionPresent_LocalMercurialIniIncorrect_MercurialOpStillWorks()
        {
            using (new MercurialIniHider())
            using (var setup = new RepositorySetup("Dan"))
            {
                const string utf8FilePath = "açesbsun.wav";
                setup.ChangeFile(utf8FilePath, "hello1");
                setup.ProjectFolderConfig.IncludePatterns.Add("*.wav");
                setup.AddAndCheckIn();

                setup.AssertFileExistsInRepository("açesbsun.wav");

            }
        }
Esempio n. 4
0
        public void IncludeFilesInSubFolders()
        {
            using (var setup = new RepositorySetup("Dan"))
            {
                var subpictures = setup.ProjectFolder.Combine("pictures", "subpictures");
                Directory.CreateDirectory(subpictures);
                var goodpicture = setup.ProjectFolder.Combine(subpictures, "good.picture");
                File.WriteAllText(goodpicture, "hello"); // Not a real jpeg file

                var subaudio = setup.ProjectFolder.Combine("audio", "subaudio");
                Directory.CreateDirectory(subaudio);
                var goodaudio = setup.ProjectFolder.Combine(subaudio, "good.audio");
                File.WriteAllText(goodaudio, "hello"); // Not a real mp3 file

                var subothers = setup.ProjectFolder.Combine("others", "subothers");
                Directory.CreateDirectory(subothers);
                var goodother = setup.ProjectFolder.Combine(subothers, "good.other");
                File.WriteAllText(goodother, "hello");

                setup.ProjectFolderConfig.ExcludePatterns.Clear();
                setup.ProjectFolderConfig.IncludePatterns.Clear();

                LiftFolder.AddLiftFileInfoToFolderConfiguration(setup.ProjectFolderConfig);

                setup.AddAndCheckIn();
                setup.AssertFileExistsInRepository("pictures/subpictures/good.picture");
                setup.AssertFileExistsInRepository("audio/subaudio/good.audio");
                setup.AssertFileExistsInRepository("others/subothers/good.other");
            }
        }
Esempio n. 5
0
 public void WavFileInRepoEvenWhenExcluded()
 {
     using (var setup = new RepositorySetup("Dan"))
     {
         var path = setup.ProjectFolder.Combine("test.wav");
         File.WriteAllText(path, "hello");
         setup.ProjectFolderConfig.IncludePatterns.Clear();
         setup.ProjectFolderConfig.IncludePatterns.Add("*.*");
         setup.ProjectFolderConfig.ExcludePatterns.Clear();
         setup.ProjectFolderConfig.ExcludePatterns.Add("test.wav");
         setup.AddAndCheckIn();
         // TODO: If Hg is fixed to exclude "wav" files,
         // revise this test to assert it is *not* in repo.
         // Very important: Also fix the "wav" extension hacks in LargeFileFilter AND AudioFileTypeHandlerTests
         setup.AssertFileExistsInRepository("test.wav");
     }
 }
Esempio n. 6
0
 public void StarDotExtensionPatternSpecified_FileAdded()
 {
     using (var setup = new RepositorySetup("Dan"))
     {
         var path = setup.ProjectFolder.Combine("test.1w1");
         File.WriteAllText(path, "hello");
         setup.ProjectFolderConfig.IncludePatterns.Clear();
         setup.ProjectFolderConfig.IncludePatterns.Add("*.1w1");
         setup.ProjectFolderConfig.ExcludePatterns.Clear();
         setup.AddAndCheckIn();
         setup.AssertFileExistsInRepository("test.1w1");
     }
 }
Esempio n. 7
0
        public void IncludeInGeneralButExcludeInSubfolder_FileNotAdded()
        {
            using (var setup = new RepositorySetup("Dan"))
            {
                var good = setup.ProjectFolder.Combine("good.lift");
                File.WriteAllText(good, "hello");

                var export = setup.ProjectFolder.Combine("export");
                Directory.CreateDirectory(export);
                var bad = Path.Combine(export, "bad.lift");
                File.WriteAllText(bad, "hello");

                var goodFontCss = Path.Combine(export, "customFonts.css");
                File.WriteAllText(goodFontCss, "hello");

                var goodLayoutCss = Path.Combine(export, "customLayout.css");
                File.WriteAllText(goodLayoutCss, "hello");

                var other = setup.ProjectFolder.Combine("other");
                Directory.CreateDirectory(other);
                var otherBad = Path.Combine(export, "otherBad.lift");
                File.WriteAllText(otherBad, "hello");

                setup.ProjectFolderConfig.ExcludePatterns.Clear();
                setup.ProjectFolderConfig.IncludePatterns.Clear();

                LiftFolder.AddLiftFileInfoToFolderConfiguration(setup.ProjectFolderConfig);

                setup.AddAndCheckIn();
                setup.AssertFileExistsInRepository("good.lift");
                setup.AssertFileExistsInRepository("export/customFonts.css");
                setup.AssertFileExistsInRepository("export/customLayout.css");
                setup.AssertFileDoesNotExistInRepository("export/bad.lift");
                setup.AssertFileDoesNotExistInRepository("other/otherBad.lift");
            }
        }