public void ExcludedVideosFileNotAdded()
        {
            using (var setup = new RepositorySetup("Dan"))
            {
                var atRoot = setup.ProjectFolder.Combine("first.wmv");
                File.WriteAllText(atRoot, "hello");

                var pictures = setup.ProjectFolder.Combine("pictures");
                Directory.CreateDirectory(pictures);
                var videoExtensions = ProjectFolderConfiguration.VideoExtensions.ToList();
                foreach (var videoExtension in videoExtensions)
                {
                    var bad = Path.Combine(pictures, "nested." + videoExtension);
                    File.WriteAllText(bad, "hello");
                }

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

                LiftFolder.AddLiftFileInfoToFolderConfiguration(setup.ProjectFolderConfig);

                setup.AddAndCheckIn();
                setup.AssertFileDoesNotExistInRepository("first.wmv");
                foreach (var videoExtension in videoExtensions)
                    setup.AssertFileDoesNotExistInRepository("pictures/nested." + videoExtension);
            }
        }
 public void IncludeAllButExcludeOne_FileNotAdded()
 {
     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("*.*");
         setup.ProjectFolderConfig.ExcludePatterns.Clear();
         setup.ProjectFolderConfig.ExcludePatterns.Add("*.1w1");
         setup.AddAndCheckIn();
         setup.AssertFileDoesNotExistInRepository("test.1w1");
     }
 }
Exemple #3
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");
     }
 }
        public void LongWavFileIsFilteredOutAndNotInRepo()
        {
            using (var bob = new RepositorySetup("bob"))
            {
                var megabyteLongData = "long" + Environment.NewLine;
                while (megabyteLongData.Length < LargeFileFilter.Megabyte)
                    megabyteLongData += megabyteLongData;

                const string fileName = "big.wav";
                bob.ChangeFile(fileName, megabyteLongData);
                var fullPathname = Path.Combine(bob.ProjectFolderConfig.FolderPath, fileName);
                var pathToRepo = bob.Repository.PathToRepo + Path.DirectorySeparatorChar;
                bob.Repository.TestOnlyAddSansCommit(fullPathname);
                var config = bob.ProjectFolderConfig;
                config.ExcludePatterns.Clear();
                config.IncludePatterns.Clear();
                config.IncludePatterns.Add("**.wav");

                var result = LargeFileFilter.FilterFiles(
                    bob.Repository,
                    config,
                    ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers());
                Assert.IsFalse(string.IsNullOrEmpty(result));
                var shortpath = fullPathname.Replace(pathToRepo, "");
                Assert.IsTrue(config.ExcludePatterns.Contains(shortpath));
                Assert.IsFalse(config.IncludePatterns.Contains(shortpath));
                bob.Repository.AddAndCheckinFiles(config.IncludePatterns, config.ExcludePatterns, "Some commit");
                bob.AssertFileDoesNotExistInRepository("big.wav");
            }
        }
        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");
            }
        }