-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix DateTimeOffset as Variable #222
Conversation
Codecov Report
@@ Coverage Diff @@
## master #222 +/- ##
==========================================
+ Coverage 78.83% 78.84% +0.01%
==========================================
Files 73 73
Lines 2447 2449 +2
Branches 357 358 +1
==========================================
+ Hits 1929 1931 +2
Misses 441 441
Partials 77 77
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[IntegrationTest] | ||
public async Task DateTime_Filter_Works() | ||
{ | ||
var query = new GraphQL.Query() | ||
.Viewer.ContributionsCollection(from: Variable.Var("start")) | ||
.Select(c => c.User.Name); | ||
|
||
var vars = new Dictionary<string, object> | ||
{ | ||
{ "start", new DateTimeOffset(2000, 1, 2, 3, 4, 5, default) } | ||
}; | ||
|
||
var response = await Connection.Run(query.Compile(), vars); | ||
|
||
// no server error | ||
Assert.NotNull(response); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any better location for this?
[Fact] | ||
public void DateTimeOffsetVariable() | ||
{ | ||
var expected = @"query($start: DateTime) { | ||
user(login: ""grokys"") { | ||
contributionsCollection(from: $start) { | ||
latestRestrictedContributionDate | ||
} | ||
} | ||
}"; | ||
|
||
var expression = new Query() | ||
.User("grokys") | ||
.ContributionsCollection(@from: Variable.Var("start")) | ||
.Select(c => c.LatestRestrictedContributionDate); | ||
|
||
var query = expression.Compile(); | ||
|
||
Assert.Equal(expected, query.ToString(), ignoreLineEndingDifferences: true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could put this into Core like in #214, but I need a DateTimeOffset parameter for this
@jcansdale Looks good to me, either this pull request or #226 can be merged to add support for DateTimeOffset as variable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.