SIL.FieldWorks.XWorks.MacroListenerTests.GetValidMockSelection(ILexEntry)

Here are the examples of the csharp api class SIL.FieldWorks.XWorks.MacroListenerTests.GetValidMockSelection(ILexEntry) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

1. Example

Project: FieldWorks
Source File: MacroListenerTests.cs
[Test]
		public void DoMacro_NormalPathSucceeds()
		{
			var ml = MakeMacroListenerWithCache();
			SetupF4Implementation(ml);
			var entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create();
			m_actionHandler.EndUndoTask(); // running macro wants to make a new one.
			var sel = GetValidMockSelection(entry);
			using (var command = GetF4CommandObject())
			{
				ml.DoMacro(command, sel);

				Assert.That(entry.Restrictions.AnalysisDefaultWritingSystem.Text, Is.EqualTo("test succeeded"));
				Assert.That(m_actionHandler.GetUndoText(), Is.EqualTo("Undo F4test"));
			}
		}

2. Example

Project: FieldWorks
Source File: MacroListenerTests.cs
[Test]
		public void DoDisplayMacro_WithSafeToDo_ResultDependsOnMacro()
		{
			var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false);
			var ml = MakeMacroListenerWithCache();
			var macro = SetupF4Implementation(ml);
			var entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create();
			var sel = GetValidMockSelection(entry);
			using (var command = GetF4CommandObject())
			{
				ml.DoDisplayMacro(command, props, sel);
				Assert.That(props.Visible, Is.True);
				Assert.That(props.Enabled, Is.True);
				Assert.That(props.Text, Is.EqualTo("F4test"));

				props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false);
				macro.BeEnabled = false;
				ml.DoDisplayMacro(command, props, sel);
				Assert.That(props.Visible, Is.True);
				Assert.That(props.Enabled, Is.False); // can't do it if the macro says no good.
				Assert.That(props.Text, Is.EqualTo("F4test"));
			}
		}