예제 #1
0
        public void StringRepresentation_Exception()
        {
            MathModelExpression mme = new MathModelExpression();

            Assert.ThrowsException <MathModelSyntaxException>(() => mme.Text = "s _t = 4*t");
            Assert.ThrowsException <MathModelSyntaxException>(() => mme.Text = "s_t = 4*t = 4");
        }
예제 #2
0
        public void toString()
        {
            string stringExpression = name + "=" + assignment;
            MathModelExpression mme = new MathModelExpression(stringExpression);

            Assert.AreEqual(stringExpression, mme.ToString());
        }
예제 #3
0
        public void StringRepresentation_SetAndUpdate()
        {
            string validStringExpression = name + " " + "=" + assignment + comment;
            MathModelExpression mme      = new MathModelExpression();

            mme.Text = validStringExpression;

            Assert.AreEqual(name, mme.Name, "Name should be extracted correctly.");
            Assert.AreEqual(assignment, mme.Assignment, "Assignment expression should be extracted correctly.");
            Assert.AreEqual(comment.Substring(2), mme.Note, "Comment should be set without the comment indicator '//'.");
        }