本文整理汇总了C#中LibChorus.TestUtilities.RepositorySetup类的典型用法代码示例。如果您正苦于以下问题:C# RepositorySetup类的具体用法?C# RepositorySetup怎么用?C# RepositorySetup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RepositorySetup类属于LibChorus.TestUtilities命名空间,在下文中一共展示了RepositorySetup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:regnrand,项目名称:chorus,代码行数:27,代码来源:IncludeExcludeTests.cs
示例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);
}
}
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:31,代码来源:FieldWorksImportSettingsTypeHandlerTests.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: 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");
}
}
开发者ID:regnrand,项目名称:chorus,代码行数:30,代码来源:IncludeExcludeTests.cs
示例7: GetTip_BeforeAnySyncing_EmptyString
public void GetTip_BeforeAnySyncing_EmptyString()
{
using (var setup = new RepositorySetup("Dan"))
{
Assert.IsNull(setup.Repository.GetTip());
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:7,代码来源:HistoryTests.cs
示例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()));
}
}
开发者ID:JohnThomson,项目名称:testBloom,代码行数:7,代码来源:MergingTests.cs
示例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);
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:32,代码来源:LdmlFileHandlerTests.cs
示例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));
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:33,代码来源:LargeFileFilterTests.cs
示例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);
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:11,代码来源:CommitCopTests.cs
示例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();
}
}
开发者ID:sillsdev,项目名称:chack,代码行数:12,代码来源:SyncDialogTests.cs
示例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);
}
}
}
开发者ID:sillsdev,项目名称:chack,代码行数:12,代码来源:Synchronizer.BadSituationTests.cs
示例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);
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:13,代码来源:SychronizerAdjunctTests.cs
示例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);
}
}
开发者ID:regnrand,项目名称:chorus,代码行数:13,代码来源:CommitCopTests.cs
示例16: EnsureTheseExtensionAreEnabled_noExistingExtensions_AddsThem
public void EnsureTheseExtensionAreEnabled_noExistingExtensions_AddsThem()
{
using (new MercurialIniForTests())
using (var setup = new RepositorySetup("Dan"))
{
setup.EnsureNoHgrcExists();
var extensions = new Dictionary<string, string>();
extensions.Add("a","");
extensions.Add("b", "");
setup.Repository.EnsureTheseExtensionsAndFormatSet(extensions);
Assert.AreEqual("a", setup.Repository.GetEnabledExtension().First());
Assert.AreEqual("b", setup.Repository.GetEnabledExtension().ToArray()[1]);
}
}
开发者ID:sillsdev,项目名称:chack,代码行数:14,代码来源:HgSettingsTests.cs
示例17: IncludeAllButExcludeOne_FileNotAdded
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");
}
}
开发者ID:regnrand,项目名称:chorus,代码行数:14,代码来源:IncludeExcludeTests.cs
示例18: ShowIt
public void ShowIt()
{
var setup = new RepositorySetup("pedro");
{
var c = new Chorus.UI.Misc.ReadinessPanel();
c.ProjectFolderPath = setup.ProjectFolder.Path;
var f = new Form();
f.Width = c.Width + 20;
f.Height = c.Height + 20;
c.Dock = DockStyle.Fill;
f.Controls.Add(c);
Application.Run(f);
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:14,代码来源:ReadinessPanelTests.cs
示例19: LaunchDialog_BogusTarget_AdmitsError
public void LaunchDialog_BogusTarget_AdmitsError()
{
using(var setup = new RepositorySetup("pedro"))
{
Application.EnableVisualStyles();
using (var dlg = new SyncDialog(setup.ProjectFolderConfig,
SyncUIDialogBehaviors.StartImmediatelyAndCloseWhenFinished,
SyncUIFeatures.Minimal))
{
dlg.SyncOptions.RepositorySourcesToTry.Add(RepositoryAddress.Create("bogus", @"z:/"));
dlg.ShowDialog();
Assert.IsTrue(dlg.FinalStatus.WarningEncountered);
}
}
}
开发者ID:sillsdev,项目名称:chack,代码行数:15,代码来源:SyncDialogTests.cs
示例20: 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
注:本文中的LibChorus.TestUtilities.RepositorySetup类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论