-
-
Notifications
You must be signed in to change notification settings - Fork 2
test: ✨ Improve assertions in ResolveFirst and ResolveSync tests
#481
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
Changes from 1 commit
66315c7
d8debb2
0fbfcc1
c0794db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,8 +58,9 @@ public async Task ShouldWorkForA(DnsEndpoint endpoint) { | |
| using var Client = new ClientX(endpoint); | ||
| var answer = await Client.ResolveFirst("evotec.pl", DnsRecordType.A, cancellationToken: CancellationToken.None); | ||
| Assert.True(answer != null); | ||
| Assert.True(answer.Value.Name == "evotec.pl"); | ||
| Assert.True(answer.Value.Type == DnsRecordType.A); | ||
| Assert.True(!string.IsNullOrWhiteSpace(answer.Value.Name), "Expected answer name to not be empty"); | ||
| Assert.True(System.Net.IPAddress.TryParse(answer.Value.Data, out var ipAddress) && ipAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork, $"Expected A record data to be an IPv4 address but got '{answer.Value.Data}' (name '{answer.Value.Name}', original '{answer.Value.OriginalName}')"); | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -111,8 +112,9 @@ public void ShouldWorkForA_Sync(DnsEndpoint endpoint) { | |
| using var Client = new ClientX(endpoint); | ||
| var answer = Client.ResolveFirstSync("evotec.pl", DnsRecordType.A, cancellationToken: CancellationToken.None); | ||
| Assert.True(answer != null); | ||
| Assert.True(answer.Value.Name == "evotec.pl"); | ||
| Assert.True(answer.Value.Type == DnsRecordType.A); | ||
|
Comment on lines
114
to
115
|
||
| Assert.True(!string.IsNullOrWhiteSpace(answer.Value.Name), "Expected answer name to not be empty"); | ||
| Assert.True(System.Net.IPAddress.TryParse(answer.Value.Data, out var ipAddress) && ipAddress.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork, $"Expected A record data to be an IPv4 address but got '{answer.Value.Data}' (name '{answer.Value.Name}', original '{answer.Value.OriginalName}')"); | ||
| } | ||
| } | ||
| } | ||
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.
The assertions on lines 60-61 lack descriptive messages while the new assertions below them have descriptive messages. For consistency with the improvements in this PR, consider adding descriptive messages to these assertions as well, such as "Expected a non-null answer" for line 60 and "Expected A record but got {answer.Value.Type}" for line 61.