-
Notifications
You must be signed in to change notification settings - Fork 555
[Tests] Add missing tests for NWPath. #4765
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
Conversation
| connection.SetStateChangeHandler (ConnectionStateHandler); | ||
| connection.SetQueue (DispatchQueue.MainQueue); | ||
| connection.Start (); | ||
| connectedEvent.WaitOne (500); |
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.
Maybe add an Assert that the WaitOne succeeded (otherwise random timeouts here will be hard to diagnose).
| i.Dispose (); | ||
| interfaces = new List<NWInterface> (); | ||
| path.EnumerateInterfaces (EnumerateInterfacesHandler); | ||
| Assert.AreNotEqual (0, interfaces.Count, "We should have at least on interface."); |
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.
one typo.
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.
Assert.That (interfaces.Count, Is.GreaterThan (0), "interfaces.Count"); explains it better
spouliot
left a comment
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 curious about the all false properties before approving :)
|
|
||
| void ConnectionStateHandler (NWConnectionState state, NWError error) | ||
| { | ||
| var errno = (SslStatus)(error != null ? error.ErrorCode : 0); |
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.
^ where is errno used ?
| [Test] | ||
| public void HasDnsPropertyTest () | ||
| { | ||
| Assert.False (path.HasDns); |
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 are those all false ?
| i.Dispose (); | ||
| interfaces = new List<NWInterface> (); | ||
| path.EnumerateInterfaces (EnumerateInterfacesHandler); | ||
| Assert.AreNotEqual (0, interfaces.Count, "We should have at least on interface."); |
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.
Assert.That (interfaces.Count, Is.GreaterThan (0), "interfaces.Count"); explains it better
| if (path != null) | ||
| path.Dispose (); | ||
| foreach (var i in interfaces) | ||
| i.Dispose (); |
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.
you could call Dispose on connectedEvent
|
Build success |
1. Address comments of conn issues. 2. Use a unique conn for all unit tests, is expensive and we do not care in this class. 3. Modify the teardown to clean interfaces etc.. in the cancel event from the connection. 4. Move the cb execution to a diff queue to avoid been blocked. 5. Ensure tests do work on device (sim has diff results).
|
Build success |
No description provided.