Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions DnsClientX.Tests/ResolveFirst.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment on lines 60 to 61
Copy link

Copilot AI Jan 2, 2026

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.

Copilot uses AI. Check for mistakes.
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>
Expand Down Expand Up @@ -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
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assertions on lines 114-115 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 114 and "Expected A record but got {answer.Value.Type}" for line 115.

Copilot uses AI. Check for mistakes.
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}')");
}
}
}
9 changes: 5 additions & 4 deletions DnsClientX.Tests/ResolveSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,11 @@ public void ShouldWorkForFirstSyncA(DnsEndpoint endpoint) {
if (ShouldSkipEndpoint(endpoint)) return;
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);
Assert.True(answer.Value.Data.Length > 0);
Assert.True(answer != null, "Expected a non-null answer");
Assert.True(answer.Value.Type == DnsRecordType.A, $"Expected A record but got {answer.Value.Type}");
Assert.True(!string.IsNullOrWhiteSpace(answer.Value.Name), "Expected answer name to not be empty");
Assert.True(!string.IsNullOrWhiteSpace(answer.Value.Data), "Expected answer data 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>
Expand Down
Loading