Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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");
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
        public void ActivityDesignerViewModel_ConnectorVisibility_IsMouseOverAndSmallViewNotActive_Collapsed()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel     = new TestActivityDesignerViewModel(mockModelItem.Object)
            {
                IsMouseOver = true, ShowLarge = true
            };

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

            //------------Assert Results-------------------------
            Assert.AreEqual(Visibility.Collapsed, viewModel.ConnectorVisibility);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        public void ActivityDesignerViewModel_ThumbVisibility_IsSelectedAndSmallViewNotActive_Visible()
        {
            //------------Setup for test--------------------------
            var mockModelItem = GenerateMockModelItem();
            var viewModel     = new TestActivityDesignerViewModel(mockModelItem.Object)
            {
                IsSelected = true, ShowLarge = true
            };

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

            //------------Assert Results-------------------------
            Assert.AreEqual(Visibility.Visible, viewModel.ThumbVisibility);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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.IsFalse(viewModel.ShowLarge);
        }
Ejemplo n.º 13
0
        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);
        }