Пример #1
0
 public void PropertiesTests()
 {
     var diagramViewModel = Mock.Create<IDiagramViewModel>();
     var constantExpressionMock = Mock.Create<ConstantExpression>();
     var vm = new ConstantExpressionNode(diagramViewModel, constantExpressionMock);
     
     TestsHelper.TestPublicDeclaredPropertiesGetSet(vm, true);
 }
Пример #2
0
        public void EditConstantValueCommand_WhenExecuted_ShowsPupup()
        {
            var diagramViewModel = Mock.Create<IDiagramViewModel>();
            var popupFactoryMock = Mock.Create<PopupFactory>(Behavior.Loose);
            var popupBuilderMock = Mock.Create<PopupBuilder>(Behavior.CallOriginal);
            Mock.Arrange(() => popupFactoryMock.Popup()).Returns(popupBuilderMock);

            Action onOk = null;
            Mock.Arrange(() => popupBuilderMock.SetCustomViewModel(Arg.IsAny<INotificationViewModel>())).Returns(popupBuilderMock);
            Mock.Arrange(() => popupBuilderMock.SetCaption(Arg.AnyString)).Returns(popupBuilderMock);
            Mock.Arrange(() => popupBuilderMock.SetPosition(Arg.IsAny<PopupPosition>())).Returns(popupBuilderMock);
            Mock.Arrange(() => popupBuilderMock.SetIsModal(Arg.AnyBool)).Returns(popupBuilderMock);
            Mock.Arrange(() => popupBuilderMock.Show(Arg.IsAny<Action>(), Arg.IsAny<Func<bool>>())).DoInstead<Action, Func<bool>>((ok, cancel) => { onOk = ok; });

            Mock.Arrange(() => diagramViewModel.ThePopupFactory).Returns(popupFactoryMock);
            var constantExpressionMock = Mock.Create<ConstantExpression>();
            var vm = new ConstantExpressionNode(diagramViewModel, constantExpressionMock);

            //Act
            vm.EditConstantValueCommand.Execute(null);

            //Assert
            Assert.IsNotNull(onOk);
            
        }
Пример #3
0
 /// <summary>
 /// Adds the field node.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="diagramViewModel">The diagram view model.</param>
 private static void AddFieldNode(ConstantExpression item, IDiagramViewModel diagramViewModel)
 {
     var dfl = new ConstantExpressionNode(diagramViewModel, item);
     diagramViewModel.Items.Add(new NodeViewModel<ConstantExpressionNode, ExpressionConnection>(dfl, diagramViewModel));
 }