/// <summary> /// Set up some common data /// </summary> public override void TestSetup() { base.TestSetup(); m_wfiFactory = Cache.ServiceLocator.GetInstance<IWfiWordformFactory>(); m_progress = new ProgressBarWrapper(new ProgressBar()); }
/// <summary/> public override void TestTearDown() { m_progress.ProgressBar.Dispose(); m_progress = null; base.TestTearDown(); }
public void ConvertLexEntryTypes() { var variantEntryTypes = Cache.LangProject.LexDbOA.VariantEntryTypesOA; Assert.That(variantEntryTypes, Is.Not.Null); Assert.That(variantEntryTypes, Is.EqualTo(Cache.LangProject.LexDbOA.VariantEntryTypesOA), "should not make a new one each time!"); Assert.That(variantEntryTypes.PossibilitiesOS.Count, Is.EqualTo(6)); var leitFactory = Cache.ServiceLocator.GetInstance<ILexEntryInflTypeFactory>(); var lexEntryInflType1 = variantEntryTypes.PossibilitiesOS[3] as ILexEntryInflType; var lexEntryInflType2 = variantEntryTypes.PossibilitiesOS[4] as ILexEntryInflType; var lexEntryInflType1Sub1 = leitFactory.Create(); lexEntryInflType1.SubPossibilitiesOS.Insert(0, lexEntryInflType1Sub1); var leFactory = Cache.ServiceLocator.GetInstance<ILexEntryFactory>(); var lerFactory = Cache.ServiceLocator.GetInstance<ILexEntryRefFactory>(); var entry1 = leFactory.Create(); var ler1 = lerFactory.Create(); entry1.EntryRefsOS.Add(ler1); ler1.VariantEntryTypesRS.Add(lexEntryInflType1); ler1.VariantEntryTypesRS.Add(lexEntryInflType2); var entry2 = leFactory.Create(); var ler2 = lerFactory.Create(); entry2.EntryRefsOS.Add(ler2); ler2.VariantEntryTypesRS.Add(lexEntryInflType1); using (var progressBar = new ProgressBar()) { IProgress progressBarWrapper = new ProgressBarWrapper(progressBar); var itemsToChange = new List<ILexEntryType>(); itemsToChange.Add(lexEntryInflType1); itemsToChange.Add(lexEntryInflType1Sub1); Cache.LangProject.LexDbOA.ConvertLexEntryTypes(progressBarWrapper, itemsToChange); var let1 = ler1.VariantEntryTypesRS[0]; Assert.AreEqual(LexEntryTypeTags.kClassId, let1.ClassID, "first lex entry type of first entry should be variant"); let1 = ler1.VariantEntryTypesRS[1]; Assert.AreEqual(LexEntryInflTypeTags.kClassId, let1.ClassID, "second lex entry type of first entry should be irregularly inflected form"); let1 = ler2.VariantEntryTypesRS[0]; Assert.AreEqual(LexEntryTypeTags.kClassId, let1.ClassID, "first lex entry type of second entry should be variant"); variantEntryTypes = Cache.LangProject.LexDbOA.VariantEntryTypesOA; Assert.That(variantEntryTypes, Is.Not.Null); Assert.That(variantEntryTypes, Is.EqualTo(Cache.LangProject.LexDbOA.VariantEntryTypesOA), "should not make a new one each time!"); Assert.That(variantEntryTypes.PossibilitiesOS.Count, Is.EqualTo(6)); var lexEntryType1 = variantEntryTypes.PossibilitiesOS[3] as ILexEntryType; Assert.AreEqual(LexEntryTypeTags.kClassId, lexEntryType1.ClassID, "third type should be variant"); var lexEntryType1Sub1 = lexEntryType1.SubPossibilitiesOS[0] as ILexEntryType; Assert.AreEqual(LexEntryTypeTags.kClassId, lexEntryType1Sub1.ClassID, "third's first type should be variant"); } }