本文整理汇总了C#中LibChorus.TestUtilities.RepositorySetup类的典型用法代码示例。如果您正苦于以下问题:C# RepositorySetup类的具体用法?C# RepositorySetup怎么用?C# RepositorySetup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositorySetup类属于LibChorus.TestUtilities命名空间,在下文中一共展示了RepositorySetup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExcludedVideosFileNotAdded
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);
}
}
示例2: 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);
}
}
示例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);
}
}
示例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);
}
}
示例5: 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
示例6: IncludeFilesInSubFolders
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");
}
}
示例7: GetTip_BeforeAnySyncing_EmptyString
public void GetTip_BeforeAnySyncing_EmptyString()
{
using (var setup = new RepositorySetup("Dan"))
{
Assert.IsNull(setup.Repository.GetTip());
}
}
示例8: CreateOrLocate_FolderHasAccentedLetter_FindsIt
public void CreateOrLocate_FolderHasAccentedLetter_FindsIt()
{
using (var setup = new RepositorySetup("Abé Books"))
{
Assert.NotNull(HgRepository.CreateOrUseExisting(setup.Repository.PathToRepo, new ConsoleProgress()));
}
}
示例9: 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);
}
}
示例10: ExplicitlyExcludedNonexistantFileNotFiltered
public void ExplicitlyExcludedNonexistantFileNotFiltered()
{
using (var bob = new RepositorySetup("bob"))
{
const string largeDictionaryFilename = "ghost.dic";
var largeDictionaryPathname = Path.Combine("nestedFolder", largeDictionaryFilename);
var fullDictionaryPathname = Path.Combine(bob.ProjectFolderConfig.FolderPath, largeDictionaryPathname);
var pathToRepo = bob.Repository.PathToRepo + Path.DirectorySeparatorChar;
const string randomFile = "random.txt";
bob.ChangeFile(randomFile, "Some text.");
var fullRandomPathname = Path.Combine(bob.ProjectFolderConfig.FolderPath, randomFile);
bob.Repository.TestOnlyAddSansCommit(fullRandomPathname);
var config = bob.ProjectFolderConfig;
config.ExcludePatterns.Clear();
config.ExcludePatterns.Add(Path.Combine("nestedFolder", "ghost.dic"));
config.IncludePatterns.Clear();
config.IncludePatterns.Add("**.*");
var result = LargeFileFilter.FilterFiles(
bob.Repository,
config,
ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers());
Assert.IsTrue(string.IsNullOrEmpty(result));
var shortpath = fullDictionaryPathname.Replace(pathToRepo, "");
Assert.IsTrue(config.ExcludePatterns.Contains(shortpath));
Assert.IsFalse(config.IncludePatterns.Contains(shortpath));
shortpath = fullRandomPathname.Replace(pathToRepo, "");
Assert.IsFalse(config.ExcludePatterns.Contains(shortpath));
Assert.IsFalse(config.IncludePatterns.Contains(shortpath));
}
}
示例11: 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);
}
}
示例12: LaunchDialog_AutoWithMinimalUI
public void LaunchDialog_AutoWithMinimalUI()
{
using(var setup = new RepositorySetup("pedro"))
{
Application.EnableVisualStyles();
var dlg = new SyncDialog(setup.ProjectFolderConfig,
SyncUIDialogBehaviors.StartImmediatelyAndCloseWhenFinished,
SyncUIFeatures.Minimal);
dlg.ShowDialog();
}
}
示例13: Sync_HgrcInUseByOther_FailsGracefully
public void Sync_HgrcInUseByOther_FailsGracefully()
{
HgRunner.TimeoutSecondsOverrideForUnitTests = 1;
using (var setup = new RepositorySetup("bob"))
{
using (new StreamWriter(setup.ProjectFolder.Combine(".hg", "hgrc")))
{
var results = setup.CheckinAndPullAndMerge();
Assert.IsFalse(results.Succeeded);
}
}
}
示例14: SettingSychronizerAdjunctToNullEndsWithDoNothingDefaultInterfaceImplementation
public void SettingSychronizerAdjunctToNullEndsWithDoNothingDefaultInterfaceImplementation()
{
using (var bob = new RepositorySetup("bob", true))
{
var synchronizer = bob.CreateSynchronizer();
Assert.IsNotNull(synchronizer.SynchronizerAdjunct);
Assert.IsInstanceOf<DefaultSychronizerAdjunct>(synchronizer.SynchronizerAdjunct);
synchronizer.SynchronizerAdjunct = null;
Assert.IsNotNull(synchronizer.SynchronizerAdjunct);
Assert.IsInstanceOf<DefaultSychronizerAdjunct>(synchronizer.SynchronizerAdjunct);
}
}
示例15: 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);
}
}