/// <summary> /// Set the properties of the HC passed in to those indicated by the dialog. /// </summary> public void GetResults(HomographConfiguration hc) { hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, !m_radioHide.Checked); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, !m_radioHide.Checked && m_chkShowHomographNumInDict.Checked); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef, !m_radioHide.Checked && m_chkShowHomographNumInReversal.Checked); hc.HomographNumberBefore = m_radioBefore.Checked; hc.ShowSenseNumberRef = !m_radioHide.Checked && m_chkShowSenseNumInDict.Checked; hc.ShowSenseNumberReversal = !m_radioHide.Checked && m_chkShowSenseNumInReversal.Checked; }
public void PersistData() { var hc = new HomographConfiguration(); Assert.That(hc.PersistData, Is.EqualTo("")); hc.HomographNumberBefore = true; hc.ShowSenseNumberRef = false; Assert.That(hc.PersistData, Is.EqualTo("before snRef ")); var hc2 = new HomographConfiguration(); hc2.PersistData = hc.PersistData; Assert.That(hc2.ShowSenseNumberRef, Is.False); Assert.That(hc2.HomographNumberBefore, Is.True); Assert.That(hc2.ShowSenseNumberReversal, Is.True); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, false); hc2.PersistData = hc.PersistData; Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.False); Assert.That(hc2.HomographNumberBefore, Is.False); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.Main, true); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, false); hc2.PersistData = hc.PersistData; Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True); Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.False); Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.True); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef, false); hc2.PersistData = hc.PersistData; Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True); Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.False); Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.False); hc.SetShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef, true); hc2.PersistData = hc.PersistData; Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.Main), Is.True); Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.DictionaryCrossRef), Is.True); Assert.That(hc2.ShowHomographNumber(HomographConfiguration.HeadwordVariant.ReversalCrossRef), Is.False); hc.ShowSenseNumberRef = true; hc.ShowSenseNumberReversal = false; hc2.PersistData = hc.PersistData; Assert.That(hc2.ShowSenseNumberRef, Is.True); Assert.That(hc2.ShowSenseNumberReversal, Is.False); }