Inheritance: ActivityDesignerViewModel
        public void ActivityDesignerViewModel_AddTitleBarHelpToggle_Added()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object);

            //------------Execute Test---------------------------
            viewModel.TestAddTitleBarHelpToggle();

            //------------Assert Results-------------------------
            Assert.AreEqual(1, viewModel.TitleBarToggles.Count);

            var toggle = viewModel.TitleBarToggles[0];

            Assert.AreEqual("pack://application:,,,/Dev2.Activities.Designers;component/Images/ServiceHelp-32.png", toggle.CollapseImageSourceUri);
            Assert.AreEqual("Close Help", toggle.CollapseToolTip);
            Assert.AreEqual("pack://application:,,,/Dev2.Activities.Designers;component/Images/ServiceHelp-32.png", toggle.ExpandImageSourceUri);
            Assert.AreEqual("Open Help", toggle.ExpandToolTip);
            Assert.AreEqual("HelpToggle", toggle.AutomationID);

            var binding = BindingOperations.GetBinding(viewModel, ActivityDesignerViewModel.ShowHelpProperty);
            Assert.IsNotNull(binding);
            Assert.AreEqual(toggle, binding.Source);
            Assert.AreEqual(ActivityDesignerToggle.IsCheckedProperty.Name, binding.Path.Path);
            Assert.AreEqual(BindingMode.TwoWay, binding.Mode);
        }
        public void ActivityDesignerViewModel_Constructor_EmptyModelItem_ViewModelConstructed()
        {
            //init
            var mockModel = new Mock<ModelItem>();

            //exe
            var vm = new TestActivityDesignerViewModel(mockModel.Object);

            //assert
            Assert.IsInstanceOfType(vm, typeof(ActivityDesignerViewModel), "Activity view model base cannot initialize");
        }
        public void ActivityDesignerViewModel_ShowHelp_SetToTrue_SetInitialFocusIsCalled()
        {
            var mockModel = new Mock<ModelItem>();
            var vm = new TestActivityDesignerViewModel(mockModel.Object);
            var wasCalled = false;

            vm.SetIntialFocusAction(() =>
            {
                wasCalled = true;
            });

            vm.ShowHelp = true;

            Assert.IsTrue(wasCalled);
        }
        public void ActivityDesignerViewModel_ShowItemHelpCommand_InvokesGivenAction()
        {
            //------------Setup for test--------------------------
            Type showExampleType = null;
            var mockModelItem = GenerateMockModelItem();

            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object, type =>
            {
                showExampleType = type;
            });

            //------------Execute Test---------------------------
            viewModel.ShowItemHelpCommand.Execute(null);

            //------------Assert Results-------------------------
            Assert.IsNotNull(showExampleType);
            Assert.AreEqual(mockModelItem.Object.ItemType, showExampleType);
        }
        public void ActivityDesignerViewModel_TitleBarTogglesVisibility_NotIsMouseOver_Collapsed()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { IsMouseOver = false };

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual(Visibility.Collapsed, viewModel.TitleBarTogglesVisibility);
        }
        public void ActivityDesignerViewModel_ZIndexPosition_NotIsMouseOver_Back()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { IsMouseOver = false };

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual(ZIndexPosition.Back, viewModel.ZIndexPosition);
        }
        public void ActivityDesignerViewModel_ZIndexPosition_IsSelected_Front()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { IsSelected = true };

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual(ZIndexPosition.Front, viewModel.ZIndexPosition);
        }
        public void ActivityDesignerViewModel_ConnectorVisibility_IsMouseOverAndSmallViewActive_Visible()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { IsMouseOver = true, ShowLarge = true };

            //------------Execute Test---------------------------
            viewModel.ShowLarge = false;

            //------------Assert Results-------------------------
            Assert.AreEqual(Visibility.Visible, viewModel.ConnectorVisibility);
        }
        public void ActivityDesignerViewModel_TitleBarTogglesVisibility_IsSelected_Visible()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { IsSelected = true };

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual(Visibility.Visible, viewModel.TitleBarTogglesVisibility);
        }
        public void ActivityDesignerViewModel_ConnectorVisibility_IsSelectedAndSmallViewNotActive_Collapsed()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { IsSelected = true, ShowLarge = true };

            //------------Execute Test---------------------------

            //------------Assert Results-------------------------
            Assert.AreEqual(Visibility.Collapsed, viewModel.ConnectorVisibility);
        }
        public void ActivityDesignerViewModel_Expand_LargeViewActive()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object);

            //------------Execute Test---------------------------
            viewModel.Expand();

            //------------Assert Results-------------------------
            Assert.IsTrue(viewModel.ShowLarge);
        }
        public void ActivityDesignerViewModel_RestoreFromPreviouslyViewedLargeView_LargeViewActive()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { PreviousView = ActivityDesignerViewModel.ShowLargeProperty.Name };

            //------------Execute Test---------------------------
            viewModel.Restore();

            //------------Assert Results-------------------------
            Assert.IsTrue(viewModel.ShowLarge);
        }
        public void ActivityDesignerViewModel_Collapse_SmallViewActive()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel = new TestActivityDesignerViewModel(mockModelItem.Object) { ShowLarge = true };

            //------------Execute Test---------------------------
            viewModel.Collapse();

            //------------Assert Results-------------------------
            Assert.IsTrue(viewModel.IsSmallViewActive);
        }