当前位置: 首页>>代码示例>>C#>>正文


C# RepositorySetup.AddAndCheckinFile方法代码示例

本文整理汇总了C#中LibChorus.TestUtilities.RepositorySetup.AddAndCheckinFile方法的典型用法代码示例。如果您正苦于以下问题:C# RepositorySetup.AddAndCheckinFile方法的具体用法?C# RepositorySetup.AddAndCheckinFile怎么用?C# RepositorySetup.AddAndCheckinFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibChorus.TestUtilities.RepositorySetup的用法示例。


在下文中一共展示了RepositorySetup.AddAndCheckinFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SampleDiff

        public void SampleDiff()
        {
            const string parent =
            @"<?xml version='1.0' encoding='utf-8'?>
            <ImportSettings>
            <ScrImportSet guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' >
            <ImportType val='2' />
            </ScrImportSet>
            </ImportSettings>";

            var child = parent.Replace("val='2'", "val='3'");

            using (var repositorySetup = new RepositorySetup("randy"))
            {
                repositorySetup.AddAndCheckinFile(SharedConstants.ImportSettingsFilename, parent);
                repositorySetup.ChangeFileAndCommit(SharedConstants.ImportSettingsFilename, child, "change it");
                var hgRepository = repositorySetup.Repository;
                var allRevisions = (from rev in hgRepository.GetAllRevisions()
                                    orderby rev.Number.LocalRevisionNumber
                                    select rev).ToList();
                var first = allRevisions[0];
                var second = allRevisions[1];
                var firstFiR = hgRepository.GetFilesInRevision(first).First();
                var secondFiR = hgRepository.GetFilesInRevision(second).First();
                var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
                Assert.AreEqual(1, result.Count);
                var onlyReport = result[0];
                Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
                Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
            }
        }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:31,代码来源:FieldWorksImportSettingsTypeHandlerTests.cs

示例2: SampleDiff

        public void SampleDiff()
        {
            const string parent =
            @"<?xml version='1.0' encoding='utf-8'?>
            <TranslatedScripture>
            <Scripture guid='06425922-3258-4094-a9ec-3c2fe5b52b39'>
            <VerseSepr>
            <Uni>,</Uni>
            </VerseSepr>
            </Scripture>
            </TranslatedScripture>";

            var child = parent.Replace("<Uni>,</Uni>", "<Uni>+</Uni>");

            using (var repositorySetup = new RepositorySetup("randy"))
            {
                repositorySetup.AddAndCheckinFile(SharedConstants.ScriptureTransFilename, parent);
                repositorySetup.ChangeFileAndCommit(SharedConstants.ScriptureTransFilename, child, "change it");
                var hgRepository = repositorySetup.Repository;
                var allRevisions = (from rev in hgRepository.GetAllRevisions()
                                    orderby rev.Number.LocalRevisionNumber
                                    select rev).ToList();
                var first = allRevisions[0];
                var second = allRevisions[1];
                var firstFiR = hgRepository.GetFilesInRevision(first).First();
                var secondFiR = hgRepository.GetFilesInRevision(second).First();
                var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
                Assert.AreEqual(1, result.Count);
                var onlyReport = result[0];
                Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
                Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
            }
        }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:33,代码来源:FieldWorksScriptureTranslationTypeHandlerTests.cs

示例3: Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade

 public void Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade()
 {
     // There are actually more than one change, but we don't fret about that at this point.
     const string parent =
     @"<?xml version='1.0' encoding='utf-8'?>
     <ProjectLexiconSettings>
     </ProjectLexiconSettings>";
     const string child =
     @"<?xml version='1.0' encoding='utf-8'?>
     <ProjectLexiconSettings>
     <WritingSystems addToSldr='true' />
     </ProjectLexiconSettings>";
     using (var repositorySetup = new RepositorySetup("randy-" + Guid.NewGuid()))
     {
         repositorySetup.AddAndCheckinFile("some.plsx", parent);
         repositorySetup.ChangeFileAndCommit("some.plsx", child, "change it");
         var hgRepository = repositorySetup.Repository;
         var allRevisions = (from rev in hgRepository.GetAllRevisions()
                             orderby rev.Number.LocalRevisionNumber
                             select rev).ToList();
         var first = allRevisions[0];
         var second = allRevisions[1];
         var firstFiR = hgRepository.GetFilesInRevision(first).First();
         var secondFiR = hgRepository.GetFilesInRevision(second).First();
         var result = _projectLexiconSettingsFileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
         Assert.AreEqual(1, result.Count());
         Assert.AreEqual("Edited", result.First().ActionLabel);
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:29,代码来源:ProjectLexiconSettingsFileHandlerTests.cs

示例4: SampleDiff

        public void SampleDiff()
        {
            const string parent =
            @"<?xml version='1.0' encoding='utf-8'?>
            <LayoutInventory>
              <layout class='CmLocation' type='jtview' name='publishStemLocation#Stem-612' version='19'>
            <generate class='LexExampleSentence' fieldType='mlstring' restrictions='customOnly' />
              </layout>
            </LayoutInventory>";

            var child = parent.Replace("19", "20");

            using (var repositorySetup = new RepositorySetup("randy"))
            {
                repositorySetup.AddAndCheckinFile("Sample." + SharedConstants.fwlayout, parent);
                repositorySetup.ChangeFileAndCommit("Sample." + SharedConstants.fwlayout, child, "change it");
                var hgRepository = repositorySetup.Repository;
                var allRevisions = (from rev in hgRepository.GetAllRevisions()
                                    orderby rev.Number.LocalRevisionNumber
                                    select rev).ToList();
                var first = allRevisions[0];
                var second = allRevisions[1];
                var firstFiR = hgRepository.GetFilesInRevision(first).First();
                var secondFiR = hgRepository.GetFilesInRevision(second).First();
                var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
                Assert.AreEqual(1, result.Count);
                var onlyReport = result[0];
                Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
                Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
            }
        }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:31,代码来源:FieldWorksCustomLayoutTypeHandlerTests.cs

示例5: Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade

 public void Find2WayDifferencesShouldReportOneChangeNoMatterHowManyWereMade()
 {
     // There are actually more than one change, but we don't fret about that at this point.
     const string parent =
     @"<?xml version='1.0' encoding='utf-8'?>
     <ldml>
     <special xmlns:palaso='urn://palaso.org/ldmlExtensions/v1' />
     </ldml>";
     const string child =
     @"<?xml version='1.0' encoding='utf-8'?>
     <ldml>
     <identity />
     <special xmlns:fw='urn://fieldworks.sil.org/ldmlExtensions/v1' />
     <special xmlns:palaso='urn://palaso.org/ldmlExtensions/v1' />
     </ldml>";
     using (var repositorySetup = new RepositorySetup("randy-" + Guid.NewGuid()))
     {
         repositorySetup.AddAndCheckinFile("some.ldml", parent);
         repositorySetup.ChangeFileAndCommit("some.ldml", child, "change it");
         var hgRepository = repositorySetup.Repository;
         var allRevisions = (from rev in hgRepository.GetAllRevisions()
                             orderby rev.Number.LocalRevisionNumber
                             select rev).ToList();
         var first = allRevisions[0];
         var second = allRevisions[1];
         var firstFiR = hgRepository.GetFilesInRevision(first).First();
         var secondFiR = hgRepository.GetFilesInRevision(second).First();
         var result = _ldmlFileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
         Assert.AreEqual(1, result.Count());
         Assert.AreEqual("Edited", result.First().ActionLabel);
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:32,代码来源:LdmlFileHandlerTests.cs

示例6: HasFileHandlers_ValidCommit_Validates_DoesNothing

 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");
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:18,代码来源:CommitCopTests.cs

示例7: NoMatchingFileHandlers_DoesNothing

 public void NoMatchingFileHandlers_DoesNothing()
 {
     using (var bob = new RepositorySetup("bob"))
     {
         using(var cop = new CommitCop(bob.Repository , ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             bob.AddAndCheckinFile("test.abc", "hello");
         }
         bob.AssertLocalRevisionNumber(0);
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:11,代码来源:CommitCopTests.cs

示例8: HasFileHandlers_Validates_DoesNothing

 public void HasFileHandlers_Validates_DoesNothing()
 {
     using (var bob = new RepositorySetup("bob"))
     {
         using (var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             bob.AddAndCheckinFile("test.chorusTest", "hello");
             // SUT
             Assert.IsNullOrEmpty(cop.ValidationResult);
         }
         bob.AssertLocalRevisionNumber(0);
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:13,代码来源:CommitCopTests.cs

示例9: SynchNow_OnDefaultBranchAndAnotherBranchExists_DoesNotMergeWithIt

 public void SynchNow_OnDefaultBranchAndAnotherBranchExists_DoesNotMergeWithIt()
 {
     using (var repo = new RepositorySetup("bob"))
     {
         repo.AddAndCheckinFile("test.txt", "hello");
         repo.AssertHeadCount(1);
         repo.ChangeFileOnNamedBranchAndComeBack("test.txt", "blah", "mybranch");
        //NB: this used to pass prior to hg 1.5, but, well, it shouldn't!
         //	Shouldn't there be two heads after the branch, above? (jh, April 2010)
         //			repo.AssertHeadCount(1);
         repo.ChangeFileAndCommit("test.txt", "hello there", "second");
         repo.AssertHeadCount(2);
         repo.CheckinAndPullAndMerge();
         repo.AssertHeadCount(2);
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:16,代码来源:RevisionMergeBehaviorTests.cs

示例10: DeletionReport_Not_ProducedForDeletedAnnotationUsingNotesHandler

        public void DeletionReport_Not_ProducedForDeletedAnnotationUsingNotesHandler()
        {
            const string parent = @"<?xml version='1.0' encoding='utf-8'?>
                    <notes version='0'>
                        <annotation guid='old1'/>
                        <annotation guid='soonToBeGoner'/>
                    </notes>";
            const string child = @"<?xml version='1.0' encoding='utf-8'?>
                    <notes version='0'>
                        <annotation guid='old1'/>
                    </notes>";

            // Make sure the common differ code does produce the deletion report.
            using (var parentTempFile = new TempFile(parent))
            using (var childTempFile = new TempFile(child))
            {
                var listener = new ListenerForUnitTests();
                var differ = Xml2WayDiffer.CreateFromFiles(parentTempFile.Path, childTempFile.Path,
                    listener,
                    null,
                    "annotation",
                    "guid");
                differ.ReportDifferencesToListener();
                listener.AssertExpectedChangesCount(1);
                listener.AssertFirstChangeType<XmlDeletionChangeReport>();
            }
            // Now make sure the ChorusNotesFileHandler filters it out, and does not return it,
            // as per the original notes differ code.
            var notesHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers
                                where handler.GetType().Name == "ChorusNotesFileHandler"
                                select handler).First();
            using (var repositorySetup = new RepositorySetup("randy"))
            {
                repositorySetup.AddAndCheckinFile("notestest.ChorusNotes", parent);
                repositorySetup.ChangeFileAndCommit("notestest.ChorusNotes", child, "change it");
                var hgRepository = repositorySetup.Repository;
                var allRevisions = (from rev in hgRepository.GetAllRevisions()
                                    orderby rev.Number.LocalRevisionNumber
                                    select rev).ToList();
                var first = allRevisions[0];
                var second = allRevisions[1];
                var firstFiR = hgRepository.GetFilesInRevision(first).First();
                var secondFiR = hgRepository.GetFilesInRevision(second).First();
                var result = notesHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
                Assert.AreEqual(0, result.Count());
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:47,代码来源:FileLevelDiffTests.cs

示例11: SecondCheckin_Invalid_BacksOut

 public void SecondCheckin_Invalid_BacksOut()
 {
     using (var bob = new RepositorySetup("bob"))
     {
         bob.AddAndCheckinFile("test.chorusTest", "hello");
         bob.ChangeFile("test.chorusTest",ChorusTestFileHandler.GetInvalidContents());
         using (var cop = new CommitCop(bob.Repository, ChorusFileTypeHandlerCollection.CreateWithTestHandlerOnly(), bob.Progress))
         {
             Assert.IsFalse(string.IsNullOrEmpty(cop.ValidationResult));
             bob.Repository.Commit(false, "bad data");
         }
         Debug.WriteLine(bob.Repository.GetLog(-1));
         bob.AssertHeadCount(1);
         bob.AssertLocalRevisionNumber(2);
         bob.AssertFileContents("test.chorusTest", "hello");
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:17,代码来源:CommitCopTests.cs

示例12: InitialFileCommit_Invalid_BacksOut

 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");
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:18,代码来源:CommitCopTests.cs

示例13: Find2WayDifferencesShouldReportOneChangeEvenWhenNoneArePresent

 public void Find2WayDifferencesShouldReportOneChangeEvenWhenNoneArePresent()
 {
     // One 'change' reported, even for the exact same file.
     const string parent =
     @"<?xml version='1.0' encoding='utf-8'?>
     <ProjectLexiconSettings>
     </ProjectLexiconSettings>";
     using (var repositorySetup = new RepositorySetup("randy-" + Guid.NewGuid()))
     {
         repositorySetup.AddAndCheckinFile("some.plsx", parent);
         repositorySetup.ChangeFileAndCommit("some.plsx", parent, "change it");
         var hgRepository = repositorySetup.Repository;
         var allRevisions = (from rev in hgRepository.GetAllRevisions()
                             orderby rev.Number.LocalRevisionNumber
                             select rev).ToList();
         var first = allRevisions[0];
         var firstFiR = hgRepository.GetFilesInRevision(first).First();
         var result = _projectLexiconSettingsFileHandler.Find2WayDifferences(firstFiR, firstFiR, hgRepository);
         Assert.AreEqual(1, result.Count());
         Assert.AreEqual("Edited", result.First().ActionLabel);
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:22,代码来源:ProjectLexiconSettingsFileHandlerTests.cs

示例14: SynchNow_OnNamedBranchAndDefaultBranchExists_DoesNotMergeWithIt

        public void SynchNow_OnNamedBranchAndDefaultBranchExists_DoesNotMergeWithIt()
        {
            using (var repo = new RepositorySetup("bob"))
            {
                if (repo.Synchronizer == null)
                    repo.Synchronizer = repo.CreateSynchronizer();
                repo.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("default");
                repo.AddAndCheckinFile("test.txt", "apple");
                var afterFirstCheckin = repo.CreateBookmarkHere();
                repo.ChangeFileAndCommit("test.txt", "pear", "second on default");

                afterFirstCheckin.Go();
                repo.Repository.BranchingHelper.Branch(new ConsoleProgress(), "animals");
                repo.Synchronizer.SynchronizerAdjunct = new ProgrammableSynchronizerAdjunct("animals");
                repo.ChangeFileAndCommit("test.txt", "dog", "first on animals");
                var animalHead = repo.CreateBookmarkHere();

                repo.AssertHeadCount(2);
                repo.CheckinAndPullAndMerge();
                repo.AssertHeadCount(2);
                animalHead.AssertRepoIsAtThisPoint();
            }
        }
开发者ID:regnrand,项目名称:chorus,代码行数:23,代码来源:RevisionMergeBehaviorTests.cs

示例15: SampleDiff

        public void SampleDiff()
        {
            const string parent =
            @"<?xml version='1.0' encoding='utf-8'?>
            <ReferenceSystem>
            <ScrRefSystem guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' >
            <Books>
            <ScrBookRef guid='51caa4a0-8cd1-4c66-acac-7daead917510'>
                <BookName>
                    <AUni ws='en'>Genesis</AUni>
                </BookName>
            </ScrBookRef>
            </Books>
            </ScrRefSystem>
            </ReferenceSystem>";

            var child = parent.Replace("Genesis", "Startup");

            using (var repositorySetup = new RepositorySetup("randy"))
            {
                repositorySetup.AddAndCheckinFile(SharedConstants.ScriptureReferenceSystemFilename, parent);
                repositorySetup.ChangeFileAndCommit(SharedConstants.ScriptureReferenceSystemFilename, child, "change it");
                var hgRepository = repositorySetup.Repository;
                var allRevisions = (from rev in hgRepository.GetAllRevisions()
                                    orderby rev.Number.LocalRevisionNumber
                                    select rev).ToList();
                var first = allRevisions[0];
                var second = allRevisions[1];
                var firstFiR = hgRepository.GetFilesInRevision(first).First();
                var secondFiR = hgRepository.GetFilesInRevision(second).First();
                var result = FileHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository).ToList();
                Assert.AreEqual(1, result.Count);
                var onlyReport = result[0];
                Assert.IsInstanceOf<XmlChangedRecordReport>(onlyReport);
                Assert.AreEqual(firstFiR.FullPath, onlyReport.PathToFile);
            }
        }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:37,代码来源:FieldWorksScriptureReferenceSystemTypeHandlerTests.cs


注:本文中的LibChorus.TestUtilities.RepositorySetup.AddAndCheckinFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。