/// ------------------------------------------------------------------------------------ private static void ClickPeopleTab() { var peopleTabTester = new ControlTester("PeopleViewTab", "ProjectWindow"); peopleTabTester.Click(); Assert.IsTrue((bool)peopleTabTester["Selected"]); }
/// ------------------------------------------------------------------------------------ private static void ClickSessionTab() { var sessionTabTester = new ControlTester("SessionsViewTab", "ProjectWindow"); sessionTabTester.Click(); Assert.IsTrue((bool)sessionTabTester["Selected"]); }
private void ClickStarOfLexemeForm() { ControlTester t = new ControlTester(GetNameOfLexicalFormAnnotationControl(), _window); t.Click(); GetEditControl(Field.FieldNames.EntryLexicalForm.ToString()); }
public void OpenViewForData_SelectDifferentDefaultViewAndClickOkInOpenedDialog_ReturnTrueViewAddedToViewHostAndDefaultViewTypesUpdated() { // Setup TestView view = null; var mocks = new MockRepository(); var dialogParent = mocks.Stub <IWin32Window>(); var viewHost = mocks.StrictMock <IViewHost>(); viewHost.Stub(vh => vh.ViewClosed += null).IgnoreArguments(); viewHost.Stub(vh => vh.ViewClosed -= null).IgnoreArguments(); viewHost.Stub(vh => vh.DocumentViews).Return(new IView[0]); viewHost.Expect(vm => vm.AddDocumentView(Arg <TestView> .Is.NotNull, Arg <string> .Is.Anything, Arg <string> .Is.Null, Arg <FontFamily> .Is.Null)) .WhenCalled(invocation => { view = invocation.Arguments[0] as TestView; }); mocks.ReplayAll(); var data = new object(); var viewInfos = new ViewInfo[] { new ViewInfo <object, TestViewDerivative>(), new ViewInfo <object, TestView>() }; using (var documentViewController = new DocumentViewController(viewHost, viewInfos, dialogParent)) { documentViewController.DefaultViewTypes[typeof(object)] = typeof(TestViewDerivative); DialogBoxHandler = (name, wnd) => { var buttonOk = new ControlTester("buttonOk"); var listBox = new ListBoxTester("listBox"); var checkBox = new CheckBoxTester("checkBoxDefault"); listBox.SetSelected(0, true); checkBox.Check(); buttonOk.Click(); }; // Call bool result = documentViewController.OpenViewForData(data, true); // Assert Assert.IsTrue(result); Assert.AreEqual(data, view.Data); Assert.IsEmpty(view.Text); Assert.IsTrue(documentViewController.DefaultViewTypes.ContainsKey(typeof(object))); Assert.AreEqual(documentViewController.DefaultViewTypes[typeof(object)], typeof(TestView)); } mocks.VerifyAll(); }
public void OpenViewForData_ClickOkInOpenedDialog_ReturnTrueAndViewAddedToViewHost() { // Setup TestView view = null; var mocks = new MockRepository(); var dialogParent = mocks.Stub <IWin32Window>(); var viewHost = mocks.StrictMock <IViewHost>(); viewHost.Stub(vh => vh.ViewClosed += null).IgnoreArguments(); viewHost.Stub(vh => vh.ViewClosed -= null).IgnoreArguments(); viewHost.Stub(vh => vh.DocumentViews).Return(new IView[0]); viewHost.Expect(vm => vm.AddDocumentView(Arg <TestView> .Is.NotNull, Arg <string> .Is.Anything, Arg <string> .Is.Null, Arg <FontFamily> .Is.Null)) .WhenCalled(invocation => { view = invocation.Arguments[0] as TestView; }); mocks.ReplayAll(); var data = new object(); var viewInfos = new ViewInfo[] { new ViewInfo <object, TestViewDerivative>(), new ViewInfo <object, TestView>() }; using (var documentViewController = new DocumentViewController(viewHost, viewInfos, dialogParent)) { DialogBoxHandler = (name, wnd) => { var buttonOk = new ControlTester("buttonOk"); buttonOk.Click(); }; // Call bool result = documentViewController.OpenViewForData(data); // Assert Assert.IsTrue(result); Assert.AreEqual(data, view.Data); Assert.IsEmpty(view.Text); } mocks.VerifyAll(); }
public void OpenViewForData_ClickCancelInOpenedDialog_ReturnFalseAndNoViewAddedToViewHost() { // Setup var mocks = new MockRepository(); var dialogParent = mocks.Stub <IWin32Window>(); var viewHost = mocks.StrictMock <IViewHost>(); viewHost.Stub(vh => vh.ViewClosed += null).IgnoreArguments(); viewHost.Stub(vh => vh.ViewClosed -= null).IgnoreArguments(); viewHost.Stub(vh => vh.DocumentViews).Return(new IView[0]); mocks.ReplayAll(); var data = new object(); var viewInfos = new ViewInfo[] { new ViewInfo <object, TestViewDerivative>(), new ViewInfo <object, TestView>() }; using (var documentViewController = new DocumentViewController(viewHost, viewInfos, dialogParent)) { DialogBoxHandler = (name, wnd) => { var buttonCancel = new ControlTester("buttonCancel"); buttonCancel.Click(); }; // Call bool result = documentViewController.OpenViewForData(data); // Assert Assert.IsFalse(result); } mocks.VerifyAll(); }