本文整理汇总了C#中TestEnvironment.OpenProject方法的典型用法代码示例。如果您正苦于以下问题:C# TestEnvironment.OpenProject方法的具体用法?C# TestEnvironment.OpenProject怎么用?C# TestEnvironment.OpenProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnvironment
的用法示例。
在下文中一共展示了TestEnvironment.OpenProject方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TaskAreas_EditMeaning_MeaningUpdated
public void TaskAreas_EditMeaning_MeaningUpdated()
{
using (var env = new TestEnvironment())
{
var project = new CogProject(env.SpanFactory)
{
Meanings = {new Meaning("gloss1", "cat1"), new Meaning("gloss2", "cat2")}
};
env.OpenProject(project);
var commonTasks = (TaskAreaItemsViewModel) env.MeaningsViewModel.TaskAreas[0];
var renameVariety = (TaskAreaCommandViewModel) commonTasks.Items[1];
env.MeaningsViewModel.SelectedMeaning = env.MeaningsViewModel.Meanings.First(v => v.Gloss == "gloss2");
env.DialogService.ShowModalDialog(env.MeaningsViewModel, Arg.Do<EditMeaningViewModel>(vm => vm.Gloss = "gloss3")).Returns(true);
renameVariety.Command.Execute(null);
Assert.That(env.MeaningsViewModel.SelectedMeaning.Gloss, Is.EqualTo("gloss3"));
Assert.That(env.MeaningsViewModel.Meanings.Select(v => v.Gloss), Is.EqualTo(new[] {"gloss1", "gloss3"}));
Assert.That(project.Meanings.Contains("gloss2"), Is.False);
}
}
示例2: SetupFindCommandTests
private static void SetupFindCommandTests(TestEnvironment env)
{
AddVarietyData(env);
AddComparisonData(env);
env.OpenProject();
env.OpenFindDialog();
}
示例3: Varieties_SwapSelectedVarieties_AreVarietiesInOrderEqualsTrue
public void Varieties_SwapSelectedVarieties_AreVarietiesInOrderEqualsTrue()
{
using (var env = new TestEnvironment())
{
AddVarietyData(env);
AddComparisonData(env);
env.OpenProject();
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndCompared));
Assert.That(env.VarietyPairs.SelectedVarietyPair, Is.Not.Null);
Assert.That(env.VarietyPairs.SelectedVarietyPair.AreVarietiesInOrder, Is.True);
VarietyViewModel temp = env.VarietyPairs.SelectedVariety2;
env.VarietyPairs.SelectedVariety2 = env.VarietyPairs.SelectedVariety1;
env.VarietyPairs.SelectedVariety1 = temp;
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndCompared));
Assert.That(env.VarietyPairs.SelectedVarietyPair, Is.Not.Null);
Assert.That(env.VarietyPairs.SelectedVarietyPair.AreVarietiesInOrder, Is.False);
}
}
示例4: Varieties_RemoveSelectedVarieties_SelectedVarietiesUpdated
public void Varieties_RemoveSelectedVarieties_SelectedVarietiesUpdated()
{
using (var env = new TestEnvironment())
{
AddVarietyData(env);
env.OpenProject();
env.VarietyPairs.VarietiesView1 = new ListCollectionView(env.VarietyPairs.Varieties);
env.VarietyPairs.VarietiesView2 = new ListCollectionView(env.VarietyPairs.Varieties);
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndNotCompared));
Assert.That(env.VarietyPairs.SelectedVariety1, Is.EqualTo(env.VarietyPairs.VarietiesView1.Cast<VarietyViewModel>().First()));
Assert.That(env.VarietyPairs.SelectedVariety2, Is.EqualTo(env.VarietyPairs.VarietiesView2.Cast<VarietyViewModel>().ElementAt(1)));
env.Project.Varieties.RemoveRangeAt(0, 2);
Messenger.Default.Send(new DomainModelChangedMessage(true));
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.NotSelected));
Assert.That(env.VarietyPairs.SelectedVariety1, Is.EqualTo(env.VarietyPairs.VarietiesView1.Cast<VarietyViewModel>().First()));
Assert.That(env.VarietyPairs.SelectedVariety2, Is.EqualTo(env.VarietyPairs.VarietiesView2.Cast<VarietyViewModel>().First()));
}
}
示例5: Varieties_PerformComparison_VarietyPairStateUpdated
public void Varieties_PerformComparison_VarietyPairStateUpdated()
{
using (var env = new TestEnvironment())
{
AddVarietyData(env);
env.OpenProject();
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndNotCompared));
Assert.That(env.VarietyPairs.SelectedVariety1, Is.EqualTo(env.VarietyPairs.VarietiesView1.Cast<VarietyViewModel>().First()));
Assert.That(env.VarietyPairs.SelectedVariety2, Is.EqualTo(env.VarietyPairs.VarietiesView2.Cast<VarietyViewModel>().ElementAt(1)));
Assert.That(env.VarietyPairs.SelectedVarietyPair, Is.Null);
Messenger.Default.Send(new PerformingComparisonMessage());
AddComparisonData(env);
Messenger.Default.Send(new ComparisonPerformedMessage());
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndCompared));
Assert.That(env.VarietyPairs.SelectedVarietyPair, Is.Not.Null);
Assert.That(env.VarietyPairs.SelectedVarietyPair.AreVarietiesInOrder, Is.True);
}
}
示例6: Varieties_ChangeDomainModel_VarietyPairStateUpdated
public void Varieties_ChangeDomainModel_VarietyPairStateUpdated()
{
using (var env = new TestEnvironment())
{
AddVarietyData(env);
AddComparisonData(env);
env.OpenProject();
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndCompared));
Messenger.Default.Send(new DomainModelChangedMessage(true));
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndNotCompared));
}
}
示例7: Varieties_AddDataToEmptyProject_VarietyPairSelected
public void Varieties_AddDataToEmptyProject_VarietyPairSelected()
{
using (var env = new TestEnvironment())
{
env.OpenProject();
Assert.That(env.VarietyPairs.Varieties, Is.Empty);
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.NotSelected));
Assert.That(env.VarietyPairs.SelectedVariety1, Is.Null);
Assert.That(env.VarietyPairs.SelectedVariety2, Is.Null);
Assert.That(env.VarietyPairs.SelectedVarietyPair, Is.Null);
AddVarietyData(env);
Messenger.Default.Send(new DomainModelChangedMessage(true));
Assert.That(env.VarietyPairs.VarietyPairState, Is.EqualTo(VarietyPairState.SelectedAndNotCompared));
Assert.That(env.VarietyPairs.SelectedVariety1, Is.EqualTo(env.VarietyPairs.VarietiesView1.Cast<VarietyViewModel>().First()));
Assert.That(env.VarietyPairs.SelectedVariety2, Is.EqualTo(env.VarietyPairs.VarietiesView2.Cast<VarietyViewModel>().ElementAt(1)));
Assert.That(env.VarietyPairs.SelectedVarietyPair, Is.Null);
}
}
示例8: TaskAreas_ChangeSorting_WordPairOrderingUpdated
public void TaskAreas_ChangeSorting_WordPairOrderingUpdated()
{
using (var env = new TestEnvironment())
{
env.Project.Meanings.AddRange(new[] {new Meaning("gloss1", "cat1"), new Meaning("gloss2", "cat2"), new Meaning("gloss3", "cat3"), new Meaning("gloss4", "cat4")});
env.Project.Varieties.AddRange(new[] {new Variety("variety1"), new Variety("variety2"), new Variety("variety3")});
env.Project.Varieties[0].Words.AddRange(new[] {new Word("hɛ.loʊ", env.Project.Meanings[0]), new Word("gʊd", env.Project.Meanings[1]), new Word("bæd", env.Project.Meanings[2]), new Word("wɜrd", env.Project.Meanings[3])});
env.Project.Varieties[1].Words.AddRange(new[] {new Word("hɛlp", env.Project.Meanings[0]), new Word("gu.gəl", env.Project.Meanings[1]), new Word("gu.fi", env.Project.Meanings[2]), new Word("kɑr", env.Project.Meanings[3])});
env.AnalysisService.SegmentAll();
var varietyPairGenerator = new VarietyPairGenerator();
varietyPairGenerator.Process(env.Project);
var wordPairGenerator = new SimpleWordPairGenerator(env.SegmentPool, env.Project, 0.3, ComponentIdentifiers.PrimaryWordAligner);
foreach (VarietyPair vp in env.Project.VarietyPairs)
{
wordPairGenerator.Process(vp);
vp.SoundChangeFrequencyDistribution = new ConditionalFrequencyDistribution<SoundContext, Ngram<Segment>>();
vp.SoundChangeProbabilityDistribution = new ConditionalProbabilityDistribution<SoundContext, Ngram<Segment>>(vp.SoundChangeFrequencyDistribution, (sc, fd) => new MaxLikelihoodProbabilityDistribution<Ngram<Segment>>(fd));
}
int i = 0;
foreach (WordPair wp in env.Project.VarietyPairs[0].WordPairs)
{
wp.PhoneticSimilarityScore = (1.0 / env.Project.VarietyPairs[0].WordPairs.Count) * (i + 1);
wp.AreCognatePredicted = wp.Meaning.Gloss.IsOneOf("gloss1", "gloss3");
i++;
}
env.OpenProject();
env.SetupWordPairsViews();
WordPairViewModel[] cognatesArray = env.Cognates.WordPairsView.Cast<WordPairViewModel>().ToArray();
WordPairViewModel[] noncognatesArray = env.Noncognates.WordPairsView.Cast<WordPairViewModel>().ToArray();
Assert.That(cognatesArray.Select(wp => wp.Meaning.Gloss), Is.EqualTo(new[] {"gloss3", "gloss1"}));
Assert.That(noncognatesArray.Select(wp => wp.Meaning.Gloss), Is.EqualTo(new[] {"gloss4", "gloss2"}));
var commonTasks = (TaskAreaItemsViewModel) env.VarietyPairs.TaskAreas[0];
var sortWordsByItems = (TaskAreaItemsViewModel) commonTasks.Items[2];
var sortWordsByGroup = (TaskAreaCommandGroupViewModel) sortWordsByItems.Items[0];
// default sorting is by similarity, change to gloss
sortWordsByGroup.SelectedCommand = sortWordsByGroup.Commands[1];
sortWordsByGroup.SelectedCommand.Command.Execute(null);
cognatesArray = env.Cognates.WordPairsView.Cast<WordPairViewModel>().ToArray();
noncognatesArray = env.Noncognates.WordPairsView.Cast<WordPairViewModel>().ToArray();
Assert.That(cognatesArray.Select(wp => wp.Meaning.Gloss), Is.EqualTo(new[] {"gloss1", "gloss3"}));
Assert.That(noncognatesArray.Select(wp => wp.Meaning.Gloss), Is.EqualTo(new[] {"gloss2", "gloss4"}));
}
}
示例9: SetupProjectWithWords
private CogProject SetupProjectWithWords(TestEnvironment env)
{
var project = new CogProject(env.SpanFactory)
{
Meanings = {new Meaning("gloss1", "cat1"), new Meaning("gloss2", "cat2"), new Meaning("gloss3", "cat3")},
Varieties = {new Variety("variety1"), new Variety("variety2")}
};
project.Varieties[0].Words.AddRange(new[] {new Word("hello", project.Meanings[0]), new Word("good", project.Meanings[1]), new Word("bad", project.Meanings[2])});
project.Varieties[1].Words.AddRange(new[] {new Word("help", project.Meanings[0]), new Word("google", project.Meanings[1]), new Word("goofy", project.Meanings[2])});
env.OpenProject(project);
return project;
}
示例10: Varieties_ExistingVarieties_VarietiesSorted
public void Varieties_ExistingVarieties_VarietiesSorted()
{
using (var env = new TestEnvironment())
{
Assert.That(env.VarietiesViewModel.IsVarietySelected, Is.False);
Assert.That(env.VarietiesViewModel.SelectedVariety, Is.Null);
var project = new CogProject(env.SpanFactory)
{
Varieties = {new Variety("French"), new Variety("English"), new Variety("Spanish")}
};
env.OpenProject(project);
env.VarietiesViewModel.VarietiesView = new ListCollectionView(env.VarietiesViewModel.Varieties);
VarietiesVarietyViewModel[] varietiesViewArray = env.VarietiesViewModel.VarietiesView.Cast<VarietiesVarietyViewModel>().ToArray();
Assert.That(env.VarietiesViewModel.IsVarietySelected, Is.True);
Assert.That(env.VarietiesViewModel.SelectedVariety, Is.EqualTo(varietiesViewArray[0]));
// should be sorted
Assert.That(varietiesViewArray.Select(v => v.Name), Is.EqualTo(new[] {"English", "French", "Spanish"}));
}
}
示例11: Varieties_AddVariety_NewVarietySelected
public void Varieties_AddVariety_NewVarietySelected()
{
using (var env = new TestEnvironment())
{
var project = new CogProject(env.SpanFactory);
env.OpenProject(project);
Assert.That(env.VarietiesViewModel.Varieties, Is.Empty);
Assert.That(env.VarietiesViewModel.IsVarietySelected, Is.False);
Assert.That(env.VarietiesViewModel.SelectedVariety, Is.Null);
project.Varieties.Add(new Variety("variety1"));
Assert.That(env.VarietiesViewModel.Varieties.Count, Is.EqualTo(1));
Assert.That(env.VarietiesViewModel.Varieties[0].Name, Is.EqualTo("variety1"));
Assert.That(env.VarietiesViewModel.IsVarietySelected, Is.True);
Assert.That(env.VarietiesViewModel.SelectedVariety, Is.EqualTo(env.VarietiesViewModel.VarietiesView.Cast<VarietiesVarietyViewModel>().First()));
}
}