-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Replace HttpListener Link Header Tests with WebListener #5806
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
Replace HttpListener Link Header Tests with WebListener #5806
Conversation
|
Let it be known that on this day of January 6th, 2018 the macOS CI build finished before Linux and Windows... |
|
@markekraus Maybe because macOS hasn't patched the Spectre bug yet, you can thank Intel for that 😛 (just kidding) |
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.
As far as I know, one of the last .Net Core SDK updates included the latest version of Roslyn, therefore it should be possible to inline the out parameter declarations as e.g. out StringValues maxLinksSV, etc.
Very minor but here and below is no space after the if statement (tip: just select everything and Ctrl+K+F auto-formats you all those things)
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'm not really a C# developer... so that inline trick is new to me. Good to know! I've changed all the instances of it.
For some reason.. the keyboard shortcuts for formatting are not working for me *scratches head. I had to right-click and chose format document. weird. Any way, formatting is fixed now.
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 know, C# is moving quite fast now and it is hard to keep up, you can have a read here or watch one of the videos from Kasey Uhlenhuth if you are interested but I mainly learn those tricks also from other people when pair programming or reviewing. Here are my personal favourites :
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 for pointing me in the right direction. Discards will come in handy too.
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.
should there be any links in this case?
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.
never mind
7f470d8 to
e31d601
Compare
| $result.Output.RelationLink["next"] | Should BeExactly "http://localhost:8080/PowerShell?test=linkheader&maxlinks=5&linknumber=2" | ||
| $result.Output.RelationLink["last"] | Should BeExactly "http://localhost:8080/PowerShell?test=linkheader&maxlinks=5&linknumber=5" | ||
|
|
||
| $result.Output.RelationLink.Count | Should BeExactly 5 |
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.
Why we use BeExactly in the whole file for Count?
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.
it was like that before I didn't change them. Does it really matter though?
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'd prefer Should Be because BeExactly is used for strings and my first thought was that here Count is a method in RelationLink which return a string.
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.
| linkNumber = 1; | ||
| } | ||
|
|
||
| string baseUri = Regex.Replace(UriHelper.GetDisplayUrl(Request), "\\?.*", String.Empty); |
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.
So simple? 👍
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.
Something wrong with it?
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, I expected a url parsing 😄
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.
heh. So far as I can tell, the only way to get the request url is GetDisplayUrl() which returns a string. I could use UriBuilder on that string.. BUT.. on macOS UriBuilder behaves differently with the query section resulting in invalid urls.. rather than mess with that, the regex works just fine :)
| var getController = new GetController(); | ||
| getController.ControllerContext = this.ControllerContext; | ||
| var result = getController.Index(); | ||
| var output = result.Value as Hashtable; |
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.
Never null?
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.
It will always return a HashTable unless some uncaught exception prevents it from even getting to this point.
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.
Closed.
|
@daxian-dbw ping |
PR Summary
reference #5464
closes #4639
PR Checklist
Note: Please mark anything not applicable to this PR
NA.[feature]if the change is significant or affectes feature testsWIP:to the beginning of the title and remove the prefix when the PR is ready.