Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom assertions and remove unused usings
- Loading branch information
Showing
5 changed files
with
65 additions
and
9 deletions.
There are no files selected for viewing
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
32 changes: 32 additions & 0 deletions
32
src/FluentSQL.Tests/Compilation/Parser/Assertions/FromNodeAssertions.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,32 @@ | ||
using FluentAssertions; | ||
using FluentAssertions.Execution; | ||
using FluentAssertions.Primitives; | ||
|
||
using FluentSQL.Compilation.Parser; | ||
|
||
namespace FluentSQL.Tests.Compilation.Parser.Assertions | ||
{ | ||
public class FromNodeAssertions : ReferenceTypeAssertions<FromNode, FromNodeAssertions> | ||
{ | ||
public FromNodeAssertions(FromNode instance) | ||
{ | ||
Subject = instance; | ||
} | ||
|
||
protected override string Identifier | ||
{ | ||
get { return "FromNode"; } | ||
} | ||
|
||
public AndConstraint<FromNodeAssertions> HaveAlias(string alias, string because = "", params object[] becauseArgs) | ||
{ | ||
Execute.Assertion | ||
.BecauseOf(because, becauseArgs) | ||
.Given(() => Subject.Alias) | ||
.ForCondition(x => x == alias) | ||
.FailWith("Expected {context:FromNode} to have alias {0}, but it had {1}", x => alias, x => x); | ||
|
||
return new AndConstraint<FromNodeAssertions>(this); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/FluentSQL.Tests/Compilation/Parser/Extensions/FromNodeExtensions.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,13 @@ | ||
using FluentSQL.Compilation.Parser; | ||
using FluentSQL.Tests.Compilation.Parser.Assertions; | ||
|
||
namespace FluentSQL.Tests.Compilation.Parser.Extensions | ||
{ | ||
public static class FromNodeExtensions | ||
{ | ||
public static FromNodeAssertions Should(this FromNode instance) | ||
{ | ||
return new FromNodeAssertions(instance); | ||
} | ||
} | ||
} |
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
2 changes: 0 additions & 2 deletions
2
src/FluentSQL/Querying/Statements/Extensions/JoinExtensions.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