-
Notifications
You must be signed in to change notification settings - Fork 463
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
Adding public API test coverage for Aspire.Hosting.Valkey #5054
base: main
Are you sure you want to change the base?
Adding public API test coverage for Aspire.Hosting.Valkey #5054
Conversation
@dotnet-policy-service agree |
…-methods#aspire-hosting-valkey
#region ValkeyBuilderExtensions | ||
|
||
[Fact] | ||
public void AddValkeyContainerShouldThrowsWhenBuilderIsNull() |
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.
nit: ShouldThrows
-> ShouldThrow
|
||
var action = () => builder.AddValkey(name); | ||
|
||
Assert.Multiple(() => |
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.
Based on this comment. Assert.Multyple is not necessary.
You should just leave it here:
var exception = Assert.Throws(action);
Assert.Equal(nameof(builder), exception.ParamName);
Same for the code below
…-methods#aspire-hosting-valkey
…-methods#aspire-hosting-valkey
…-methods#aspire-hosting-valkey
[Fact] | ||
public void AddValkeyContainerShouldThrowWhenNameIsNull() | ||
{ | ||
IDistributedApplicationBuilder builder = new DistributedApplicationBuilder([]); |
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.
Use TestDistributedApplicationBuilder.Create();
{ | ||
string name = null!; | ||
|
||
var action = () => new ValkeyResource(name); |
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.
Add a static check in the class
private static string ThrowIfNull([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
=> argument ?? throw new ArgumentNullException(paramName);
|
||
public class ValkeyPublicApiTests | ||
{ | ||
#region ValkeyBuilderExtensions |
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.
Remove Addrees pls.
Initial issues #2649
Issues Check List: Validate arguments of public methods
Microsoft Reviewers: Open in CodeFlow