5 changed files with 111 additions and 40 deletions
@ -0,0 +1,74 @@ |
|||
// Copyright (c) The Perspex Project. All rights reserved.
|
|||
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|||
|
|||
using Perspex.Markup.Binding; |
|||
using Xunit; |
|||
|
|||
namespace Perspex.Markup.UnitTests.Binding |
|||
{ |
|||
public class ExpressionNodeBuilderTests_Errors |
|||
{ |
|||
[Fact] |
|||
public void Identifier_Cannot_Start_With_Digit() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("1Foo")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Identifier_Cannot_Start_With_Symbol() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.%Bar")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_End_With_Period() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar.")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_Have_Empty_Indexer() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar[]")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_Have_Extra_Comma_At_Start_Of_Indexer() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar[,3,4]")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_Have_Extra_Comma_In_Indexer() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar[3,,4]")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_Have_Extra_Comma_At_End_Of_Indexer() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar[3,4,]")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_Have_Digit_After_Indexer() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar[3,4]5")); |
|||
} |
|||
|
|||
[Fact] |
|||
public void Expression_Cannot_Have_Letter_After_Indexer() |
|||
{ |
|||
Assert.Throws<ExpressionParseException>( |
|||
() => ExpressionNodeBuilder.Build("Foo.Bar[3,4]A")); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue