public void TestProperties() { var obj = new DestinationFieldsExpressionNode( Mock.Create<IDiagramViewModel>(Behavior.Loose), Mock.Create<DestinationFieldList>(Behavior.Loose)); TestsHelper.TestPublicPropertiesGetSet(obj); }
public void PropertiesTests() { var diagramViewModel = Mock.Create<IDiagramViewModel>(); var constantExpressionMock = Mock.Create<DestinationFieldList>(); var vm = new DestinationFieldsExpressionNode(diagramViewModel, constantExpressionMock); TestsHelper.TestPublicDeclaredPropertiesGetSet(vm, true); }
public void Constructor_FillConnectorsIn() { //Mock DestinationFieldsExpressionNode var nodeMock = Mock.Create<DestinationFieldsExpressionNode>(Constructor.Mocked, Behavior.Loose); //Arrange Mock.NonPublic.Arrange(nodeMock, "ExpandSubconnectors", ArgExpr.IsAny<ExpressionConnectorViewModel>(), false, true).IgnoreInstance().DoNothing(); Mock.NonPublic.Arrange(nodeMock, "ConnectorsInCollectionChanged", ArgExpr.IsAny<object>(), ArgExpr.IsAny<NotifyCollectionChangedEventArgs>()) .IgnoreInstance().DoNothing(); var expressionObjectMock = Mock.Create<DestinationFieldList>(); var field1 = new DestinationField(new Connection()); var field2 = new DestinationField(new Connection()); expressionObjectMock.Fields.Add(field1); expressionObjectMock.Fields.Add(field2); var vmMock = Mock.Create<IDiagramViewModel>(); Mock.Arrange(() => new ExpressionConnector(ConnectorType.In, Arg.IsAny<IExpressionField>())). DoInstead<ConnectorType, IExpressionField>((connectorType, expressionField) => { if (expressionField != field1 && expressionField != field2) { Assert.Fail(); } }) .MustBeCalled(); //Act var result = new DestinationFieldsExpressionNode(vmMock, expressionObjectMock); //Assert Assert.AreEqual(2, result.ConnectorsIn.Count); Mock.NonPublic.Assert(result, "ExpandSubconnectors", Occurs.Exactly(2), ArgExpr.IsAny<ExpressionConnectorViewModel>(), false, true); }
public void Constructor_WhenExpressionObjectNull_GenerateException() { var node = new DestinationFieldsExpressionNode( Mock.Create<IDiagramViewModel>(Behavior.Loose), null); }
/// <summary> /// Adds the field node. /// </summary> /// <param name="item">The item.</param> /// <param name="diagramViewModel">The diagram view model.</param> private static void AddFieldNode(DestinationFieldList item, IDiagramViewModel diagramViewModel) { var dfl = new DestinationFieldsExpressionNode(diagramViewModel, item); diagramViewModel.Items.Add(new NodeViewModel<DestinationFieldsExpressionNode, ExpressionConnection>(dfl, diagramViewModel)); }