Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
360 additions
and
144 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/FluentSQL.Tests/Compilation/Parser/PropertyParserTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using FluentAssertions; | ||
|
||
using FluentSQL.Compilation.Parser; | ||
using FluentSQL.Compilation.Parser.Nodes; | ||
using FluentSQL.Databases; | ||
using FluentSQL.Querying; | ||
using FluentSQL.Querying.Statements.Extensions; | ||
using FluentSQL.Tests.Compilation.Parser.Extensions; | ||
using FluentSQL.Tests.Databases.Builders; | ||
using FluentSQL.Tests.Examples; | ||
|
||
using Xunit; | ||
|
||
namespace FluentSQL.Tests.Compilation.Parser | ||
{ | ||
public class PropertyParserTests | ||
{ | ||
public class When_parsing_a_property : Specification<QueryParser> | ||
{ | ||
protected override QueryParser EstablishContext() | ||
{ | ||
Database database = new DatabaseBuilder().Build(); | ||
Customer customer = null; | ||
|
||
QueryContext = | ||
database | ||
.Query<string>() | ||
.From(() => customer) | ||
.Select(() => customer.Id) | ||
.QueryContext; | ||
|
||
return new QueryParser(); | ||
} | ||
|
||
protected override void Because(QueryParser sut) | ||
{ | ||
Node = sut.Parse(QueryContext); | ||
} | ||
|
||
[Fact] | ||
public void It_should_have_a_select_node() | ||
{ | ||
Node.Should().ContainSingle<SelectNode>(); | ||
} | ||
|
||
[Fact] | ||
public void It_should_have_a_table_node() | ||
{ | ||
Node.Should().ContainSingle<TableNode>().Which.Name.Should().Be(nameof(Customer)); | ||
} | ||
|
||
[Fact] | ||
public void It_should_have_a_column_node() | ||
{ | ||
Node.Should().ContainSingle<ColumnNode>().Which.Name.Should().Be(nameof(Customer.Id)); | ||
} | ||
|
||
private QueryContext<NoParameters, string> QueryContext { get; set; } | ||
private AstNode Node { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.