-
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
Update tests' target framework #140
Update tests' target framework #140
Conversation
Update the unit tests to target netcoreapp2.1. Update to the latest .NET Core test SDK. Update to the latest version of xunit.
Fix code analyzer warnings generated by upgrade to xunit.
Update the Target Framework Moniker for the integration tests to 2.1 and update the test SDK as well, as they should have been done as part of 2a1d6c7 but got missed.
As an unintended side-effect of the runtime upgrade, some of the tests in I wasn't sure the best way to fix these, so for now they're still broken. Will fix once there's a recommended approach. |
You can go ahead and change the strings in the I'm going to let @grokys give you the final approval on this pull request as he is more savvy about .net core changes than I am. It is probably fine, but I'll let him make the call. |
Hmm - on closer inspection, I don't think that's going to be particularly maintainable. For example, this is the actual string for one of the expressions now (from "data => Convert(Select(data.get_Item(\"data\").get_Item(\"licenses\"), x => new <>f__AnonymousType2`2(Body = x.get_Item(\"body\").ToObject(), Items = Convert(Select(x.get_Item(\"items\"), i => new <>f__AnonymousType3`2(Key = i.get_Item(\"key\").ToObject(), Description = i.get_Item(\"description\").ToObject())).ToDictionary(d => d.Key, d => d.Description), IDictionary`2))).ToList(), IEnumerable`1)" |
So far all I can think of is asserting against the literal expected to be produced by the compiled query like this: [Fact]
public void Licence_Conditions_Nested_Selects()
{
var expression = new Query()
.Licenses
.Select(x => new
{
x.Body,
Items = x.Conditions.Select(i => i.Description).ToList(),
});
var actualQuery = expression.Compile().ToString();
var expectedQuery = @"
query {
licenses {
body
items: conditions {
description
}
}
}
";
Assert.Equal(expectedQuery.Trim(), actualQuery);
} |
Sorry, I was not paying enough attention to what you were saying. These tests are tricky, I pushed the fix to them. |
So to explain the tests I just fixed, when we process a query we have to generate two things.
The All that said, just like you mentioned, there are tests that test the query we generate. Like this one...
|
Ah, that makes now. I’d circled slightly around near that and almost stumbled across the fix myself, as VS was warning my about a redundant |
Yep, it would definitely be redundant for someone to actually write that in code. |
Remove NuGet package references that snuck in from #131.
Some references snuck in when I extracted this from #131 - fixed now. |
Good catch. |
Hi @martincostello - what was the reasoning behind updating the unit tests' framework? |
@grokys Two reasons:
|
@martincostello ok, thanks for explaining - they sound like good enough reasons to me! |
# Conflicts: # Octokit.GraphQL.IntegrationTests/Queries/IssueTests.cs
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.
Thanks a lot @martincostello - looks good to me.
Update the tests to target
netcoreapp2.1
as well as update the .NET Core test SDK and xunit NuGet package references.The xunit upgrade creates some code analysis warnings as xunit now ships with code analyzers, so they have also been fixed.
Originally part of #131.