Exemple #1
0
        public void CommentsMgrAdding_EventHandler_Does_Nothing_For_Now()
        {
            //Arrange
            var wkSpce = new WorkSpace();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => wkSpce._utilitiesMgr_Adding(null, null));
        }
Exemple #2
0
        public void ElementsMgrModifying_EventHandler_Does_Nothing_For_Now()
        {
            //Arrange
            var wkSpce = new WorkSpace();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => wkSpce._elementsMgr_Modifying(null, null));
        }
Exemple #3
0
        public void WorkMode_GetsWorkspaceMode()
        {
            var wkSpce = new WorkSpace();
            // just to ensure it is implemented
            Common.WorkSpace.WorkSpaceMode actualMode = wkSpce.WorkMode;

            Assert.Equal(actualMode, wkSpce.WorkMode);
        }
Exemple #4
0
        public void VerifyWorkSpaceModeChangedEvent()
        {
            var wkSpce = new WorkSpace();
            var helper = new HelperForWorkSpaces();
            wkSpce.WorkModeChanged += new WorkSpaceModeChangeEventHandler<IWorkSpace, WorkSpaceModeChangeEventArgs>(helper.WorkModeChanged_DummyHandler);

            WorkSpaceMode priorMode = WorkSpaceMode.Normal;
            WorkSpaceMode newMode = WorkSpaceMode.Execution;

            var ea = new WorkSpaceModeChangeEventArgs(priorMode, newMode);

            wkSpce.OnWorkModeChanged(ea);

            Assert.Equal(1, helper.WorkModeChanged_TimesHandled);
        }
Exemple #5
0
        public void VerifyWorkSpaceExecModeChangedEvent()
        {
            var wkSpce = new WorkSpace();
            var helper = new HelperForWorkSpaces();
            wkSpce.ExecModeChanged+=new WorkSpaceExecModeChangeEventHandler<IWorkSpace,WorkSpaceExecModeChangeEventArgs>(helper.ExecModeChanged_DummyHandler);
            ExecutionModes priorMode = ExecutionModes.Single;
            ExecutionModes newMode = ExecutionModes.Cascade;

            WorkSpaceExecModeChangeEventArgs ea = new WorkSpaceExecModeChangeEventArgs(priorMode, newMode);

            wkSpce.OnExecModeChanged(ea);

            Assert.Equal(1, helper.ExecModeChanged_TimesHandled);
        }
Exemple #6
0
        public void VarMgr_VariableSelected_EventHandler_Does_Nothing_For_Now()
        {
            //Arrange
            var wkSpce = new WorkSpace();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => wkSpce._varMgr_VariableSelected(null, null));
        }
Exemple #7
0
        public void VarMgr_IdentifyVarDependents_EventHandler_Does_Nothing_For_Now()
        {
            //Arrange
            var wkSpce = new WorkSpace();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => wkSpce._varMgr_IdentifyVarDependents(null, null));
        }
Exemple #8
0
        public void element_SelectionChangedEventHandlerDoesNothingIfSender_Is_Null()
        {
            var wkSpce = new WorkSpace();
            var mockElMgr = new Mock<IElements>();
            var mockEl = new Mock<IElement>();

            var ea = new SelectionEventArgs(true, SelectionSource.Code);
            mockElMgr.Setup(m => m[new Guid()]).Returns(mockEl.Object);

            wkSpce.ElementsMgr = mockElMgr.Object;
            wkSpce.element_SelectionChanged(null, ea);
            mockElMgr.Verify(m => m[new Guid()], Times.Never());
        }
Exemple #9
0
        public void Reset()
        {
            var wkSpce = new WorkSpace();

            var mockEls = new Mock<IElements>();

            var mockEl0 = new Mock<IElement>();
            var mockElMgr = new Mock<IElements>();

            var roots = new List<IElement>();
            roots.Add(mockEl0.Object);

            mockElMgr.Setup(m => m.GetRoots(false)).Returns(roots);
            mockEl0.Setup(m => m.Reset());

            wkSpce.ElementsMgr = mockElMgr.Object;
            wkSpce.Reset();

            mockEl0.VerifyAll();
        }
Exemple #10
0
        public void PipeStatusChanging_EventHandler()
        {
            //Arrange
            var wkSpce = new WorkSpace();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => wkSpce.pipe_StatusChanging(null, null));
        }
Exemple #11
0
        public void ExecMode_GetsExecutionMode()
        {
            var wkSpce = new WorkSpace();
            // just to ensure it is implemented
            Common.ExecutionModes actualMode = wkSpce.ExecMode;

            Assert.Equal(actualMode, wkSpce.ExecMode);
        }
Exemple #12
0
        public void ExecMode_GetsAndSetsExecutionMode()
        {
            var wkSpce = new WorkSpace();
            Common.ExecutionModes newMode = ExecutionModes.Cascade;
            wkSpce.ExecMode = newMode;
            Common.ExecutionModes actualMode = wkSpce.ExecMode;

            Assert.Equal(newMode, actualMode);
        }
Exemple #13
0
        public void element_SelectionChangedEventHandlerSetsIsSelectedOnEachElementSelected()
        {
            var wkSpce = new WorkSpace();
            var mockElMgr = new Mock<IElements>();
            var mockEl = new Mock<IElement>();

            var ea = new SelectionEventArgs(true, SelectionSource.Code);
            mockElMgr.Setup(m => m[new Guid()]).Returns(mockEl.Object);
            mockEl.Setup(m => m.SetIsSelected(ea.IsSelected, ea.Source, ea.Origin));

            wkSpce.ElementsMgr = mockElMgr.Object;
            wkSpce.element_SelectionChanged(mockEl.Object, ea);
            mockElMgr.Verify(m => m[new Guid()], Times.Exactly(1));
        }
Exemple #14
0
        public void WorkMode_SetterUpdatesWorkspaceMode()
        {
            var wkSpce = new WorkSpace();
            Common.WorkSpace.WorkSpaceMode currentMode = wkSpce.WorkMode;
            Common.WorkSpace.WorkSpaceMode newMode = WorkSpaceMode.Execution;
            wkSpce.WorkMode = newMode;
            Common.WorkSpace.WorkSpaceMode actualMode = wkSpce.WorkMode;

            Assert.Equal(newMode, actualMode);
        }
Exemple #15
0
        public void SettingsMgr_SettingsChanged_EventHandler_Does_Nothing_For_Now()
        {
            //Arrange
            var wkSpce = new WorkSpace();

            //Act, Assert
            var ex = Assert.Throws<NotImplementedException>(() => wkSpce._settingsMgr_SettingsChanged(null, null));
        }
Exemple #16
0
        public void _elementsMgr_AddedEventHandlerFiresElementInstancesAddedEventWhenElementsAreSuccessfullyAdded()
        {
            var wkSpce = new WorkSpace();
            // verify the event handler fires the event by catching it with a helper event handler.
            var mockElMgr = new Mock<IElements>();
            var mockEl = new Mock<IElement>();

            var helper = new HelperForWorkSpaces();
            wkSpce.ElementInstancesAdded += new InstanceAddedEventHandler<IWorkSpace, ElementInstancesAddedEventArgs>(helper.ElementInstancesAdded_DummyHandler);

            var ea = new ElementCollectionEventArgs(CollectionEventArgs.CollectionAction.Add, mockEl.Object);

            wkSpce.ElementsMgr = mockElMgr.Object;
            wkSpce._elementsMgr_Added(mockElMgr.Object, ea);
            Assert.Equal(1, helper.ElementInstancesAdded_TimesHandled);
        }
Exemple #17
0
        public void VariableChangedEventHandlerForwardsTheVarChangeInfoToAllElementsWhenAVariableIsModified()
        {
            var wkSpce = new WorkSpace();
            var args = new VariableChangeEventArgs("Var A", Activity.Modify);

            var mockEl = new Mock<IElement>();
            var mockVarMgr = new Mock<IVarMgr>();
            var elMgr = new Common.WorkSpace.Elements();
            wkSpce.ElementsMgr = elMgr;

            elMgr.Add(mockEl.Object);               //  need elements in the elMgr to update
            wkSpce._varMgr_VariableChanged(mockVarMgr.Object, args);
            mockEl.Verify(m => m.UpdateVariableDependencies(null, args.Activity), Times.AtMostOnce());
        }
Exemple #18
0
        public void element_RequestVariableValuesEventHandlerCallsUpdateVariableDependencyValues()
        {
            var wkSpce = new WorkSpace();
            var mockVarMgr = new Mock<IVarMgr>();
            var mockVarA = new Mock<IVariable>();
            var element = new ElementCallDummy();

            string[] varNames = { "Var A"};
            var ea = new RequestVariableValuesEventArgs(varNames);
            mockVarMgr.Setup(m => m["Var A"]).Returns(mockVarA.Object);

            wkSpce.VarMgr = mockVarMgr.Object;
            wkSpce.element_RequestVariableValues(element, ea);
            Assert.Equal(1, element.UpdateVariableDependencyValues_TimesCalled);
        }
Exemple #19
0
        public void element_RequestVariableValuesEventHandlerDoesNothingIfSender_Is_Null()
        {
            var wkSpce = new WorkSpace();
            var mockVarMgr = new Mock<IVarMgr>();
            var mockVarA = new Mock<IVariable>();

            string[] varNames = { "Var A" };
            var ea = new RequestVariableValuesEventArgs(varNames);
            mockVarMgr.Setup(m => m["Var A"]).Returns(mockVarA.Object);

            wkSpce.VarMgr = mockVarMgr.Object;
            wkSpce.element_RequestVariableValues(null, ea);
            mockVarMgr.Verify(m => m["Var A"], Times.Never());
        }