2
// RazorExplicitExpressionParsingTests.cs
5
// Piotr Dowgiallo <sparekd@gmail.com>
7
// Copyright (c) 2012 Piotr Dowgiallo
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
using System.Collections.Generic;
31
using NUnit.Framework;
32
using MonoDevelop.AspNet.Mvc.StateEngine;
34
namespace UnitTests.MonoDevelop.AspNet.Mvc.StateEngine
36
public class RazorExplicitExpressionsParsingTests : RazorParsingTests
39
public void EmptyExplicitExpression ()
41
parser.Parse ("@($)$", () => {
42
parser.AssertStateIs<RazorExpressionState> ();
43
parser.AssertPath ("//@( )");
44
parser.AssertNodeIs<RazorExplicitExpression> ();
46
parser.AssertStateIs<RazorFreeState> ();
47
parser.AssertPath ("/");
52
public void ExplicitExpression ()
54
parser.Parse ("@(Model.Foo$)$", () => {
55
parser.AssertStateIs<RazorExpressionState> ();
56
parser.AssertPath ("//@( )");
57
parser.AssertNodeIs<RazorExplicitExpression> ();
59
parser.AssertStateIs<RazorFreeState> ();
60
parser.AssertPath ("/");
65
public void ExplicitExpressionWithNestedBrackets ()
67
parser.Parse ("@(Foo.Bar(a, b)$)$", () => {
68
parser.AssertStateIs<RazorExpressionState> ();
69
parser.AssertPath ("//@( )");
70
parser.AssertNodeIs<RazorExplicitExpression> ();
72
parser.AssertStateIs<RazorFreeState> ();
73
parser.AssertPath ("/");
78
public void ExplicitExpressionInHtml ()
80
parser.Parse ("<p>@(FooBar$)</p>", () => {
81
parser.AssertStateIs<RazorExpressionState> ();
82
parser.AssertNodeIs<RazorExplicitExpression> ();
83
parser.AssertPath ("//p/@( )");
88
public void ExplicitExpressionInText ()
90
parser.Parse ("Lorem ipsum@(FooBar$)lorem", () => {
91
parser.AssertStateIs<RazorExpressionState> ();
92
parser.AssertNodeIs<RazorExplicitExpression> ();
93
parser.AssertPath ("//@( )");