chore: update test naming to follow the "I can" syntax
Some checks failed
default / dotnet-default-workflow (push) Has been cancelled

This commit is contained in:
Louis Seubert 2026-05-25 21:28:04 +02:00 committed by louis9902
commit e9b263097f
6 changed files with 27 additions and 27 deletions

View file

@ -48,7 +48,7 @@ internal sealed class CompileTimeRequestDispatchGeneratorTests
} }
[Test] [Test]
public async Task I_get_an_error_for_an_invalid_explicit_name() public async Task I_can_get_an_error_for_an_invalid_explicit_name()
{ {
var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options => var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options =>
{ {
@ -70,7 +70,7 @@ internal sealed class CompileTimeRequestDispatchGeneratorTests
} }
[Test] [Test]
public async Task I_get_an_error_when_the_assembly_name_cannot_be_sanitized_to_a_valid_identifier() public async Task I_can_get_an_error_when_the_assembly_name_cannot_be_sanitized_to_a_valid_identifier()
{ {
var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options => var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options =>
{ {
@ -91,7 +91,7 @@ internal sealed class CompileTimeRequestDispatchGeneratorTests
} }
[Test] [Test]
public async Task I_get_an_error_for_nested_handlers_and_they_are_ignored() public async Task I_can_get_an_error_for_nested_handlers_and_they_are_ignored()
{ {
var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options => var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options =>
{ {
@ -113,7 +113,7 @@ internal sealed class CompileTimeRequestDispatchGeneratorTests
} }
[Test] [Test]
public async Task I_still_generate_a_no_op_extension_when_no_handlers_exist() public async Task I_can_still_generate_a_no_op_extension_when_no_handlers_exist()
{ {
var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options => var result = Roslyn.SourceGenerator<CompileTimeRequestDispatchGenerator>(options =>
{ {

View file

@ -109,7 +109,7 @@ internal sealed class RequestDispatcherBuilderExtensionsTests
} }
[Test] [Test]
public async Task I_get_an_exception_when_adding_a_nested_request_handler() public async Task I_can_get_an_exception_when_adding_a_nested_request_handler()
{ {
var services = new ServiceCollection(); var services = new ServiceCollection();
var builder = services.AddRequestDispatcher(); var builder = services.AddRequestDispatcher();
@ -124,7 +124,7 @@ internal sealed class RequestDispatcherBuilderExtensionsTests
} }
[Test] [Test]
public async Task I_get_an_exception_when_adding_nested_request_handlers_with_a_lifetime() public async Task I_can_get_an_exception_when_adding_nested_request_handlers_with_a_lifetime()
{ {
var services = new ServiceCollection(); var services = new ServiceCollection();
var builder = services.AddRequestDispatcher(); var builder = services.AddRequestDispatcher();

View file

@ -47,7 +47,7 @@ internal sealed class SearchHandlerInAssemblyTests
} }
[Test] [Test]
public async Task I_get_an_exception_when_nested_handlers_are_present() public async Task I_can_get_an_exception_when_nested_handlers_are_present()
{ {
var assembly = Roslyn.Compile(options => options.AddFromEmbeddedSource("SearchNestedHandler.cs")); var assembly = Roslyn.Compile(options => options.AddFromEmbeddedSource("SearchNestedHandler.cs"));

View file

@ -13,7 +13,7 @@ internal sealed class PropertyPathTests
}; };
[Test] [Test]
public async Task I_serialize_property_paths_using_the_json_naming_policy() public async Task I_can_serialize_property_paths_using_the_json_naming_policy()
{ {
var problem = new Problem var problem = new Problem
{ {
@ -27,7 +27,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_serialize_indexed_property_paths_using_the_json_naming_policy() public async Task I_can_serialize_indexed_property_paths_using_the_json_naming_policy()
{ {
var problem = new Problem var problem = new Problem
{ {
@ -41,7 +41,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_serialize_paths_with_multiple_indexers_using_the_json_naming_policy() public async Task I_can_serialize_paths_with_multiple_indexers_using_the_json_naming_policy()
{ {
var problem = new Problem var problem = new Problem
{ {
@ -70,7 +70,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_treat_multiple_indexers_as_a_single_segment() public async Task I_can_treat_multiple_indexers_as_a_single_segment()
{ {
var propertyPath = (PropertyPath)"Matrix[1][2].Value"; var propertyPath = (PropertyPath)"Matrix[1][2].Value";
var segments = (IReadOnlyList<string>)propertyPath; var segments = (IReadOnlyList<string>)propertyPath;
@ -82,7 +82,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_do_not_split_dots_inside_brackets() public async Task I_can_avoid_splitting_dots_inside_brackets()
{ {
var propertyPath = (PropertyPath)"Items[foo.bar].Name"; var propertyPath = (PropertyPath)"Items[foo.bar].Name";
var segments = (IReadOnlyList<string>)propertyPath; var segments = (IReadOnlyList<string>)propertyPath;
@ -96,7 +96,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_expose_empty_segments_for_malformed_paths() public async Task I_can_expose_empty_segments_for_malformed_paths()
{ {
var propertyPath = (PropertyPath)"Address..Street"; var propertyPath = (PropertyPath)"Address..Street";
var segments = (IReadOnlyList<string>)propertyPath; var segments = (IReadOnlyList<string>)propertyPath;
@ -111,7 +111,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_treat_an_empty_path_as_having_no_segments() public async Task I_can_treat_an_empty_path_as_having_no_segments()
{ {
var propertyPath = (PropertyPath)""; var propertyPath = (PropertyPath)"";
@ -134,7 +134,7 @@ internal sealed class PropertyPathTests
} }
[Test] [Test]
public async Task I_see_it_throw_for_out_of_range_segment_access() public async Task I_can_see_it_throw_for_out_of_range_segment_access()
{ {
var propertyPath = (PropertyPath)"Name"; var propertyPath = (PropertyPath)"Name";

View file

@ -299,7 +299,7 @@ internal sealed class RuleBuilderExtensionsTests
} }
[Test] [Test]
public async Task I_see_it_throw_for_invalid_length_configuration() public async Task I_can_see_it_throw_for_invalid_length_configuration()
{ {
await Assert.That(() => new PropertyValidator<StringValueModel, string?>(model await Assert.That(() => new PropertyValidator<StringValueModel, string?>(model
=> model.Value, rule => rule.Length(5, 4))) => model.Value, rule => rule.Length(5, 4)))
@ -307,7 +307,7 @@ internal sealed class RuleBuilderExtensionsTests
} }
[Test] [Test]
public async Task I_see_it_throw_for_negative_min_length_configuration() public async Task I_can_see_it_throw_for_negative_min_length_configuration()
{ {
await Assert.That(() => new PropertyValidator<StringValueModel, string?>(model await Assert.That(() => new PropertyValidator<StringValueModel, string?>(model
=> model.Value, rule => rule.MinLength(-1))) => model.Value, rule => rule.MinLength(-1)))
@ -315,7 +315,7 @@ internal sealed class RuleBuilderExtensionsTests
} }
[Test] [Test]
public async Task I_see_it_throw_for_invalid_between_configuration() public async Task I_can_see_it_throw_for_invalid_between_configuration()
{ {
await Assert.That(() => new PropertyValidator<IntValueModel, int>(model await Assert.That(() => new PropertyValidator<IntValueModel, int>(model
=> model.Value, rule => rule.Between(10, 0))) => model.Value, rule => rule.Between(10, 0)))

View file

@ -30,7 +30,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_validate_all_rules_on_every_call() public async Task I_can_validate_all_rules_on_every_call()
{ {
var validator = CreatePersonValidator(); var validator = CreatePersonValidator();
@ -78,7 +78,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_skip_null_nested_values_for_composed_validators() public async Task I_can_skip_null_nested_values_for_composed_validators()
{ {
var validator = new PropertyValidator<PersonWithAddress, Address?>( var validator = new PropertyValidator<PersonWithAddress, Address?>(
person => person.Address, person => person.Address,
@ -192,7 +192,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_see_it_throw_for_non_member_expressions() public async Task I_can_see_it_throw_for_non_member_expressions()
{ {
await Assert.That(() => new PropertyValidator<Person, int>( await Assert.That(() => new PropertyValidator<Person, int>(
person => person.Name!.Trim().Length, person => person.Name!.Trim().Length,
@ -201,7 +201,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_aggregate_all_failures_in_rule_order() public async Task I_can_aggregate_all_failures_in_rule_order()
{ {
var validator = new OrderedFailuresValidator(); var validator = new OrderedFailuresValidator();
@ -214,7 +214,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_apply_default_problem_metadata() public async Task I_can_apply_default_problem_metadata()
{ {
var validator = new PropertyValidator<StringValueModel, string?>( var validator = new PropertyValidator<StringValueModel, string?>(
model => model.Value, model => model.Value,
@ -232,7 +232,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_skip_null_collections_for_collection_validators() public async Task I_can_skip_null_collections_for_collection_validators()
{ {
var validator = new CollectionValidator<NullableTeam, Member>( var validator = new CollectionValidator<NullableTeam, Member>(
team => team.Members!, team => team.Members!,
@ -245,7 +245,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_skip_empty_collections_for_collection_validators() public async Task I_can_skip_empty_collections_for_collection_validators()
{ {
var validator = new CollectionValidator<Team, Member>( var validator = new CollectionValidator<Team, Member>(
team => team.Members, team => team.Members,
@ -296,7 +296,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_see_it_throw_for_type_mismatch() public async Task I_can_see_it_throw_for_type_mismatch()
{ {
var validator = CreatePersonValidator(); var validator = CreatePersonValidator();
var context = new ValidationContext<object>(new object()); var context = new ValidationContext<object>(new object());
@ -305,7 +305,7 @@ internal sealed class ValidatorTests
} }
[Test] [Test]
public async Task I_see_it_throw_when_a_context_resolved_validator_cannot_be_resolved() public async Task I_can_see_it_throw_when_a_context_resolved_validator_cannot_be_resolved()
{ {
var validator = new PropertyValidator<PersonWithAddress, Address?>( var validator = new PropertyValidator<PersonWithAddress, Address?>(
person => person.Address, person => person.Address,