/// <summary> /// OnRequestClose event handler for Viewpoint View Model /// </summary> /// <param name="sender">Viewpoint View Model</param> /// <param name="e">Routed Event</param> private void ViewpointViewModelRequestClose(object sender, System.EventArgs e) { ViewpointViewModel viewpointViewModel = sender as ViewpointViewModel; Assert.AreEqual(viewpointViewModel.Name, "NameBeforeEvent"); viewpointViewModel.Name = "NameAfterEvent"; }
public void ViewpointNameChangeCommandTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); ICommand actual = target.ViewpointNameChangeCommand; Assert.IsNotNull(actual); }
public void CurrentPerspectiveTest() { Perspective expected = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(expected); target.CurrentPerspective = expected; Perspective actual = target.CurrentPerspective; Assert.AreEqual(expected, actual); }
public void IsButtonEnabledTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); bool expected = false; target.IsButtonEnabled = expected; bool actual = target.IsButtonEnabled; Assert.AreEqual(expected, actual); }
public void ViewpointViewModelViewpointNameChangeHandlerConstructorTest() { ViewpointViewModel viewpointViewModel = new ViewpointViewModel(ViewpointViewModelTest.GetPerspectiveInstance()); ViewpointViewModel_Accessor.ViewpointNameChangeHandler target = new ViewpointViewModel_Accessor.ViewpointNameChangeHandler(viewpointViewModel); Assert.IsNotNull(viewpointViewModel); Assert.IsNotNull(target); Assert.IsNotNull(target.parent); }
public void IsSkyGetFalseTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); bool expected = false; bool actual = target.IsSky; Assert.AreEqual(expected, actual); }
/// <summary> /// Viewpoint view model property changed event. /// </summary> /// <param name="sender">Viewpoint View Model</param> /// <param name="e">Routed Event</param> private void ViewpointViewModelPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { ViewpointViewModel viewpointViewModel = sender as ViewpointViewModel; Assert.AreEqual(viewpointViewModel.Name, "NameBeforeEvent"); // Remove this event handler. Otherwise, this method will be called recursively. viewpointViewModel.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(ViewpointViewModelPropertyChanged); viewpointViewModel.Name = "NameAfterEvent"; }
public void OnRequestCloseTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); target.Name = "NameBeforeEvent"; target.RequestClose += new System.EventHandler(ViewpointViewModelRequestClose); target.OnRequestClose(); Assert.AreEqual(target.Name, "NameAfterEvent"); }
public void ViewpointViewModelConstructorTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); Assert.IsNotNull(target); Assert.IsNotNull(target.CurrentPerspective); Assert.IsNotNull(target.ViewpointNameChangeCommand); Assert.IsNotNull(target.ViewpointNameTextChangeCommand); }
public void CurrentPerspectiveTest() { Perspective expected = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(expected); target.CurrentPerspective = expected; Perspective actual = target.CurrentPerspective; Assert.AreEqual(expected, actual); }
public void IsSkyGetTrueTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); target.CurrentPerspective.HasRADec = true; bool expected = true; bool actual = target.IsSky; Assert.AreEqual(expected, actual); }
public void IsNotSkySetTrueTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); bool expected = true; target.IsNotSky = true; bool actual = target.IsNotSky; Assert.AreEqual(expected, actual); }
public void IsButtonEnabledTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); bool expected = false; target.IsButtonEnabled = expected; bool actual = target.IsButtonEnabled; Assert.AreEqual(expected, actual); }
public void NameTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); string expected = "ViewpointViewModelName"; target.Name = expected; string actual = target.Name; Assert.AreEqual(expected, actual); }
public void ExecuteEmptyViewpointNameTest() { ViewpointViewModel viewpointViewModel = new ViewpointViewModel(ViewpointViewModelTest.GetPerspectiveInstance()); viewpointViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ViewpointViewModelPropertyChanged); ViewpointViewModel_Accessor.ViewpointNameTextChangeHandler target = new ViewpointViewModel_Accessor.ViewpointNameTextChangeHandler(viewpointViewModel); viewpointViewModel.Name = "NameBeforeEvent"; string viewpointName = string.Empty; target.Execute(viewpointName); Assert.AreEqual(viewpointViewModel.Name, "NameAfterEvent"); }
public void ExecuteValidViewpointNameTest() { ViewpointViewModel viewpointViewModel = new ViewpointViewModel(ViewpointViewModelTest.GetPerspectiveInstance()); viewpointViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ViewpointViewModelPropertyChanged); ViewpointViewModel_Accessor.ViewpointNameChangeHandler target = new ViewpointViewModel_Accessor.ViewpointNameChangeHandler(viewpointViewModel); viewpointViewModel.Name = "NameBeforeEvent"; // This will be used to set the ViewpointViewModel name. string viewpointName = "NameAfterEvent"; target.Execute(viewpointName); Assert.AreEqual(viewpointViewModel.Name, "NameAfterEvent"); }
public void ExecuteEmptyViewpointNameTest() { ViewpointViewModel viewpointViewModel = new ViewpointViewModel(ViewpointViewModelTest.GetPerspectiveInstance()); viewpointViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ViewpointViewModelPropertyChanged); ViewpointViewModel_Accessor.ViewpointNameChangeHandler target = new ViewpointViewModel_Accessor.ViewpointNameChangeHandler(viewpointViewModel); viewpointViewModel.Name = "NameBeforeEvent"; string viewpointName = string.Empty; target.Execute(viewpointName); Assert.AreEqual(viewpointViewModel.Name, "NameAfterEvent"); }
public void ExecuteValidViewpointNameTest() { ViewpointViewModel viewpointViewModel = new ViewpointViewModel(ViewpointViewModelTest.GetPerspectiveInstance()); viewpointViewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ViewpointViewModelPropertyChanged); ViewpointViewModel_Accessor.ViewpointNameTextChangeHandler target = new ViewpointViewModel_Accessor.ViewpointNameTextChangeHandler(viewpointViewModel); viewpointViewModel.Name = "NameBeforeEvent"; // This will be used to set the ViewpointViewModel name. string viewpointName = "NameAfterEvent"; target.Execute(viewpointName); Assert.AreEqual(viewpointViewModel.Name, "NameAfterEvent"); }
public void ViewpointViewModelConstructorTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); Assert.IsNotNull(target); Assert.IsNotNull(target.CurrentPerspective); Assert.IsNotNull(target.ViewpointNameChangeCommand); Assert.IsNotNull(target.ViewpointNameTextChangeCommand); }
public void NameTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); string expected = "ViewpointViewModelName"; target.Name = expected; string actual = target.Name; Assert.AreEqual(expected, actual); }
public void IsSkyGetTrueTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); target.CurrentPerspective.HasRADec = true; bool expected = true; bool actual = target.IsSky; Assert.AreEqual(expected, actual); }
public void ViewpointViewModel_ViewpointNameTextChangeHandlerConstructorTest() { ViewpointViewModel viewpointViewModel = new ViewpointViewModel(ViewpointViewModelTest.GetPerspectiveInstance()); ViewpointViewModel_Accessor.ViewpointNameTextChangeHandler target = new ViewpointViewModel_Accessor.ViewpointNameTextChangeHandler(viewpointViewModel); Assert.IsNotNull(viewpointViewModel); Assert.IsNotNull(target); Assert.IsNotNull(target.parent); }
public void ViewpointNameTextChangeCommandTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); ICommand actual = target.ViewpointNameTextChangeCommand; Assert.IsNotNull(actual); }
private void OnCaptureViewpointButtonClick(object sender, RibbonControlEventArgs e) { try { Utility.IsWWTInstalled(); WWTManager.IsValidMachine(Common.Globals.TargetMachine.MachineIP.ToString(), false); Perspective perspective = WWTManager.GetCameraView(); if (perspective != null) { var dialog = new CaptureViewpoint(); System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(dialog); helper.Owner = (IntPtr)ThisAddIn.ExcelApplication.Hwnd; perspective.Name = Resources.DefaultViewpointText; var viewModel = new ViewpointViewModel(perspective); viewModel.IsButtonEnabled = true; viewModel.RequestClose += new EventHandler(dialog.OnRequestClose); dialog.DataContext = viewModel; dialog.ShowDialog(); // WPF dialog does not have dialog result if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { if (!string.IsNullOrWhiteSpace(perspective.Name)) { // Fire it only when valid value set this.GetViewpointClicked.OnFire(perspective, new EventArgs()); } } viewModel.RequestClose -= new EventHandler(dialog.OnRequestClose); dialog.Close(); } } catch (CustomException ex) { Ribbon.ShowError(ex.HasCustomMessage ? ex.Message : Resources.LayerOperationError); } catch (Exception exception) { Logger.LogException(exception); Ribbon.ShowError(Resources.DefaultErrorMessage); } }
public void OnRequestCloseTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); target.Name = "NameBeforeEvent"; target.RequestClose += new System.EventHandler(ViewpointViewModelRequestClose); target.OnRequestClose(); Assert.AreEqual(target.Name, "NameAfterEvent"); }
public void IsNotSkyGetFalseTest() { Perspective perspective = GetPerspectiveInstance(); ViewpointViewModel target = new ViewpointViewModel(perspective); bool expected = true; bool actual = target.IsNotSky; Assert.AreEqual(expected, actual); }