예제 #1
0
        public void Format_WithoutColon_ReadsWholeExpression()
        {
            //arrange
            var expr = new FormatExpression("{foo}");

            //assert
            Assert.That(expr.Expression, Is.EqualTo("foo"));
        }
예제 #2
0
        public void Format_WithColon_ParsesoutFormat()
        {
            //arrange
            var expr = new FormatExpression("{foo:#.##}");

            //assert
            Assert.That(expr.Format, Is.EqualTo("#.##"));
        }
예제 #3
0
        public void Format_WithExpressionReturningNull_DoesNotThrowException()
        {
            //arrange
            var expr = new FormatExpression("{foo}");

            //assert
            Assert.That(expr.Eval(new {foo = (object) null}), Is.Empty);
        }
예제 #4
0
        public void Eval_WithNamedExpression_EvalsPropertyOfExpression()
        {
            //arrange
            var expr = new FormatExpression("{foo}");

            //act
            var result = expr.Eval(new {foo = 123});

            //assert
            Assert.That(result, Is.EqualTo("123"));
        }