public void HookupMlString() { MockData1 data1 = new MockData1(m_wsFrn, m_wsEng); data1.MlSimpleOne.VernacularDefaultWritingSystem = m_tsf.MakeString("foo", m_wsFrn); MockParaBox mockPara = new MockParaBox(); MlsHookup mlHook = new MlsHookup(data1, data1.MlSimpleOne, m_wsFrn, MockData1Props.MlSimpleOne(data1), mockPara); mlHook.ClientRunIndex = 7; data1.MlSimpleOne.SetVernacularDefaultWritingSystem("bar"); data1.RaiseMlSimpleOneChanged(m_wsFrn); Assert.AreEqual(7, mockPara.TheIndex, "Should have fired the event and passed the string index"); Assert.AreEqual("bar", mockPara.TheMlString.get_String(((MultiAccessor)data1.MlSimpleOne).VernWs).Text, "Should have informed para of new string"); mockPara.TheTsString = m_tsf.MakeString("foo", m_wsFrn); data1.MlSimpleOne.SetAnalysisDefaultWritingSystem("eng"); data1.RaiseMlSimpleOneChanged(m_wsEng); Assert.AreEqual("foo", mockPara.TheTsString.Text, "Should not have informed para of new string, since we are monitoring French and mocking English event"); mlHook.Dispose(); }
public void HookupTsString() { MockData1 data1 = new MockData1(m_wsFrn, m_wsEng); data1.SimpleTwo = m_tsf.MakeString("foo", m_wsFrn); MockParaBox mockPara = new MockParaBox(); var mlHook = new TssHookup(MockData1Props.SimpleTwo(data1), mockPara); mlHook.ClientRunIndex = 5; data1.SimpleTwo = m_tsf.MakeString("bar", m_wsFrn); data1.RaiseSimpleTwoChanged(); Assert.AreEqual(5, mockPara.TheIndex, "Should have fired the event and notified the correct index"); Assert.AreEqual("bar", mockPara.TheTsString.Text, "Should have informed para of new string"); mlHook.Dispose(); }
public void HookupSimpleString() { MockData1 data1 = new MockData1(m_wsFrn, m_wsEng); data1.SimpleThree = "foo"; MockParaBox mockPara = new MockParaBox(); var mlHook = new StringHookup(data1, () => data1.SimpleThree, hookup => data1.SimpleThreeChanged += hookup.StringPropChanged, hookup => data1.SimpleThreeChanged -= hookup.StringPropChanged, mockPara); mlHook.ClientRunIndex = 5; data1.SimpleThree = "bar"; data1.RaiseSimpleThreeChanged(); Assert.AreEqual(5, mockPara.TheIndex, "Should have fired the event and notified the correct index"); Assert.AreEqual("bar", mockPara.TheString, "Should have informed para of new string"); mlHook.Dispose(); }