public void Load_With_Valid_Model_Sets_Expected_Workspace_Model() { var sut = CreateSut(); var actualWorkspaceViewModel = sut.Load(WorkspaceModelFactory.Create()); Assert.That(actualWorkspaceViewModel.WorkspaceModel, Is.Not.Null); }
public void InitializeWithRawExpressionParsesExpectedAggregateVariableSubscriptOnLeft() { var sut = new ExpressionConstraintModel(WorkspaceModelFactory.Create().Model, new ConstraintExpressionModel("$xx[1] > 1")); var leftVariableReference = (AggregateVariableReferenceNode)sut.Expression.Node.InnerExpression.LeftExpression.InnerExpression; Assert.That(leftVariableReference.SubscriptStatement.Subscript, Is.EqualTo(1)); }
public void Load_With_Valid_Model_Returns_Expected_Constraints() { var sut = CreateSut(); var actualWorkspaceViewModel = sut.Load(WorkspaceModelFactory.Create()); Assert.That(actualWorkspaceViewModel.ModelEditor.Constraints.Count, Is.EqualTo(1)); }
public void InitializeWithRawExpressionParsesExpectedAggregateVariableNameOnRight() { var sut = new ExpressionConstraintModel(WorkspaceModelFactory.Create().Model, new ConstraintExpressionModel("$x[1] > $x[2]")); var rightVariableReference = (AggregateVariableReferenceNode)sut.Expression.Node.InnerExpression.RightExpression.InnerExpression; Assert.That(rightVariableReference.VariableName, Is.EqualTo("x")); }
public void Initialize_With_Raw_Expression_Parses_Expected_Variable_Name_On_Right() { var sut = new ExpressionConstraintModel(WorkspaceModelFactory.Create().Model, new ConstraintExpressionModel("$y = $x")); var rightVariableReference = (SingletonVariableReferenceNode)sut.Expression.Node.InnerExpression.RightExpression.InnerExpression; Assert.That(rightVariableReference.VariableName, Is.EqualTo("x")); }
public void Initialize_With_Raw_Expression_Parses_Expected_Literal_On_Right() { var sut = new ExpressionConstraintModel(WorkspaceModelFactory.Create().Model, new ConstraintExpressionModel("$y <= 44")); var rightLiteral = (IntegerLiteralNode)sut.Expression.Node.InnerExpression.RightExpression.InnerExpression; Assert.That(rightLiteral.Value, Is.EqualTo(44)); }
public void Initialize_With_Character_Range_Parses_Expected_Lower_Band() { var sut = new SharedDomainModel(WorkspaceModelFactory.Create().Model, new ModelName("A domain"), new SharedDomainExpressionModel(" 'a'..'z' ")); var rangeExpressionNode = (RangeDomainExpressionNode)sut.Expression.Node.Inner; Assert.That(rangeExpressionNode.RightExpression, Is.InstanceOf <BandExpressionNode>()); }
public void Initialize_With_List_Expression_Parses_Expected_Inner() { var sut = new SharedDomainModel(WorkspaceModelFactory.Create().Model, new ModelName("A domain"), new SharedDomainExpressionModel("\"rita\", \"sue\", \"bob\"")); var rangeExpressionNode = (ListDomainExpressionNode)sut.Expression.Node.Inner; Assert.That(rangeExpressionNode.Items.Values, Is.All.Not.Null); Assert.That(rangeExpressionNode.Items.Values, Is.All.InstanceOf <ItemNameNode>()); Assert.That(rangeExpressionNode.Items.Values, Has.Count.EqualTo(3)); }
private static VariableModel CreatedDeletedVariable() { var x = WorkspaceModelFactory.Create(); return(x.Model.GetVariableByName("x")); }
private DisplayModel CreateDisplayModel() { return(new DisplayModel(WorkspaceModelFactory.Create().Model)); }
public void CreateWorkspaceWithBlankNameReturnsModelWithBlankName() { var sut = WorkspaceModelFactory.Create(); Assert.That(sut.Model.Name.Text, Is.Empty); }
public void Initialize_With_Raw_Expression_Parses_Expected_Operator() { var sut = new ExpressionConstraintModel(WorkspaceModelFactory.Create().Model, new ConstraintExpressionModel(" $a1 > 999 ")); Assert.That(sut.Expression.OperatorType, Is.EqualTo(OperatorType.Greater)); }