Skip to content

Commit e8282e7

Browse files
authored
Move from FluentAssertions to AwesomeAssertions (#2547)
1 parent 51366ef commit e8282e7

File tree

13 files changed

+35
-32
lines changed

13 files changed

+35
-32
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<!-- external dependencies -->
2121
<PackageVersion Include="ApprovalTests" Version="7.0.0-beta.3" />
2222
<PackageVersion Include="BenchmarkDotNet" Version="0.13.1" />
23-
<PackageVersion Include="FluentAssertions" Version="5.10.3" />
23+
<PackageVersion Include="AwesomeAssertions" Version="8.0.2" />
2424
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
2525
<PackageVersion Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
2626
<PackageVersion Include="Newtonsoft.Json" Version="13.0.2" />

src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public async Task Generated_boolean_parameters_will_accept_zero_arguments()
2828

2929
await config.InvokeAsync($"{RootCommand.ExecutableName} --value");
3030

31-
_receivedValues.Should().BeEquivalentTo(true);
31+
_receivedValues.Should().BeEquivalentTo(new object[] { true });
3232
}
3333

3434
[Theory]
@@ -47,7 +47,7 @@ public async Task Generated_boolean_parameters_will_accept_one_argument(string c
4747

4848
await config.InvokeAsync(commandLine);
4949

50-
_receivedValues.Should().BeEquivalentTo(expected);
50+
_receivedValues.Should().BeEquivalentTo(new [] { expected });
5151
}
5252

5353
[Fact]
@@ -220,7 +220,7 @@ public async Task Method_parameters_on_the_invoked_member_method_are_bound_to_ma
220220

221221
await command.Parse("--value").InvokeAsync();
222222

223-
_receivedValues.Should().BeEquivalentTo(true);
223+
_receivedValues.Should().BeEquivalentTo(new [] { true });
224224
}
225225

226226
[Fact]
@@ -231,7 +231,7 @@ public async Task Method_with_multiple_parameters_with_default_values_are_resolv
231231

232232
await command.Parse("").InvokeAsync();
233233

234-
_receivedValues.Should().BeEquivalentTo(1, 2);
234+
_receivedValues.Should().BeEquivalentTo(new [] { 1, 2 });
235235
}
236236

237237
internal void Method_taking_bool(bool value = false)

src/System.CommandLine.DragonFruit.Tests/System.CommandLine.DragonFruit.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="FluentAssertions" />
15+
<PackageReference Include="AwesomeAssertions" />
1616
<PackageReference Include="Newtonsoft.Json" />
1717
</ItemGroup>
1818

src/System.CommandLine.Generator.Tests/System.CommandLine.Generator.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="FluentAssertions" />
18+
<PackageReference Include="AwesomeAssertions" />
1919
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" />
2020
</ItemGroup>
2121

src/System.CommandLine.Hosting.Tests/System.CommandLine.Hosting.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FluentAssertions" />
9+
<PackageReference Include="AwesomeAssertions" />
1010
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" />
1111
</ItemGroup>
1212

src/System.CommandLine.NamingConventionBinder.Tests/System.CommandLine.NamingConventionBinder.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<ItemGroup>
2121
<PackageReference Include="ApprovalTests" />
22-
<PackageReference Include="FluentAssertions" />
22+
<PackageReference Include="AwesomeAssertions" />
2323
<PackageReference Include="Newtonsoft.Json" />
2424
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" />
2525
</ItemGroup>

src/System.CommandLine.Suggest.Tests/GlobalToolsSuggestionRegistrationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public void Global_tools_can_be_found()
5050

5151
registrationPairs
5252
.Should()
53-
.BeEquivalentTo(
53+
.BeEquivalentTo( new [] {
5454
new Registration(
5555
Path.Combine(dotnetProfileDirectory, "tools", "dotnet-suggest")),
5656
new Registration(
57-
Path.Combine(dotnetProfileDirectory, "tools", "t-rex")));
57+
Path.Combine(dotnetProfileDirectory, "tools", "t-rex"))});
5858
}
5959
}
6060
}

src/System.CommandLine.Suggest.Tests/dotnet-suggest.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</ItemGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="FluentAssertions" />
13+
<PackageReference Include="AwesomeAssertions" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/System.CommandLine.Tests/Binding/TypeConversionTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ public void Values_can_be_correctly_converted_to_nullable_uint_without_the_parse
689689

690690
[Fact]
691691
public void Values_can_be_correctly_converted_to_array_of_int_without_the_parser_specifying_a_custom_converter()
692-
=> GetValue(new Option<int[]>("-x"), "-x 1 -x 2 -x 3").Should().BeEquivalentTo(1, 2, 3);
692+
=> GetValue(new Option<int[]>("-x"), "-x 1 -x 2 -x 3").Should().BeEquivalentTo(new[] { 1, 2, 3 });
693693

694694
[Theory]
695695
[InlineData(0, 100_000, typeof(string[]))]
@@ -734,11 +734,11 @@ public void Max_arity_greater_than_1_converts_to_enumerable_types(
734734

735735
[Fact]
736736
public void Values_can_be_correctly_converted_to_List_of_int_without_the_parser_specifying_a_custom_converter()
737-
=> GetValue(new Option<List<int>>("-x"), "-x 1 -x 2 -x 3").Should().BeEquivalentTo(1, 2, 3);
737+
=> GetValue(new Option<List<int>>("-x"), "-x 1 -x 2 -x 3").Should().BeEquivalentTo(new[] {1, 2, 3});
738738

739739
[Fact]
740740
public void Values_can_be_correctly_converted_to_IEnumerable_of_int_without_the_parser_specifying_a_custom_converter()
741-
=> GetValue(new Option<IEnumerable<int>>("-x"), "-x 1 -x 2 -x 3").Should().BeEquivalentTo(1, 2, 3);
741+
=> GetValue(new Option<IEnumerable<int>>("-x"), "-x 1 -x 2 -x 3").Should().BeEquivalentTo(new[] { 1, 2, 3 });
742742

743743
[Fact]
744744
public void Enum_values_can_be_correctly_converted_based_on_enum_value_name_without_the_parser_specifying_a_custom_converter()
@@ -826,6 +826,6 @@ public void Sequence_type_defaults_to_empty_when_not_specified(Type sequenceType
826826
}
827827

828828
private void AssertParsedValueIsEmpty<T>(Argument<T> argument) where T : IEnumerable
829-
=> GetValue(argument, "").Should().BeEmpty();
829+
=> GetValue(argument, "").Should().BeEquivalentTo(Enumerable.Empty<T>());
830830
}
831831
}

src/System.CommandLine.Tests/CompletionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ public void When_a_subcommand_has_been_specified_then_its_sibling_commands_will_
311311
var result = rootCommand.Parse("cherry ", simpleConfig);
312312

313313
result.GetCompletions()
314+
.Select(item => item.Label)
314315
.Should()
315316
.NotContain(new[]{"apple", "banana", "cherry"});
316317
}
@@ -381,6 +382,7 @@ public void When_a_subcommand_has_been_specified_then_its_sibling_options_with_a
381382

382383
parseResult
383384
.GetCompletions(commandLine.Length + 1)
385+
.Select(item => item.Label)
384386
.Should()
385387
.NotContain("--parent-option");
386388
}

src/System.CommandLine.Tests/ParserTests.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,12 +1030,12 @@ public void Options_can_have_the_same_alias_differentiated_only_by_prefix()
10301030
.Children
10311031
.Select(s => ((OptionResult)s).Option)
10321032
.Should()
1033-
.BeEquivalentTo(option1);
1033+
.BeEquivalentTo(new[] { option1 });
10341034
parser.Parse("--a").CommandResult
10351035
.Children
10361036
.Select(s => ((OptionResult)s).Option)
10371037
.Should()
1038-
.BeEquivalentTo(option2);
1038+
.BeEquivalentTo(new[] { option2 });
10391039
}
10401040

10411041
[Theory]
@@ -1398,10 +1398,10 @@ public void Command_argument_arity_can_be_a_fixed_value_greater_than_1()
13981398
.CommandResult
13991399
.Tokens
14001400
.Should()
1401-
.BeEquivalentTo(
1401+
.BeEquivalentTo(new [] {
14021402
new Token("1", TokenType.Argument, argument),
14031403
new Token("2", TokenType.Argument, argument),
1404-
new Token("3", TokenType.Argument, argument));
1404+
new Token("3", TokenType.Argument, argument)});
14051405
}
14061406

14071407
[Fact]
@@ -1420,20 +1420,20 @@ public void Command_argument_arity_can_be_a_range_with_a_lower_bound_greater_tha
14201420
.CommandResult
14211421
.Tokens
14221422
.Should()
1423-
.BeEquivalentTo(
1423+
.BeEquivalentTo(new [] {
14241424
new Token("1", TokenType.Argument, argument),
14251425
new Token("2", TokenType.Argument, argument),
1426-
new Token("3", TokenType.Argument, argument));
1426+
new Token("3", TokenType.Argument, argument)});
14271427
command.Parse("1 2 3 4 5")
14281428
.CommandResult
14291429
.Tokens
14301430
.Should()
1431-
.BeEquivalentTo(
1431+
.BeEquivalentTo(new [] {
14321432
new Token("1", TokenType.Argument, argument),
14331433
new Token("2", TokenType.Argument, argument),
14341434
new Token("3", TokenType.Argument, argument),
14351435
new Token("4", TokenType.Argument, argument),
1436-
new Token("5", TokenType.Argument, argument));
1436+
new Token("5", TokenType.Argument, argument)});
14371437
}
14381438

14391439
[Fact]
@@ -1489,10 +1489,10 @@ public void Option_argument_arity_can_be_a_fixed_value_greater_than_1()
14891489
.GetResult(option)
14901490
.Tokens
14911491
.Should()
1492-
.BeEquivalentTo(
1492+
.BeEquivalentTo(new [] {
14931493
new Token("1", TokenType.Argument, default),
14941494
new Token("2", TokenType.Argument, default),
1495-
new Token("3", TokenType.Argument, default));
1495+
new Token("3", TokenType.Argument, default)});
14961496
}
14971497

14981498
[Fact]
@@ -1509,20 +1509,20 @@ public void Option_argument_arity_can_be_a_range_with_a_lower_bound_greater_than
15091509
.GetResult(option)
15101510
.Tokens
15111511
.Should()
1512-
.BeEquivalentTo(
1512+
.BeEquivalentTo(new [] {
15131513
new Token("1", TokenType.Argument, default),
15141514
new Token("2", TokenType.Argument, default),
1515-
new Token("3", TokenType.Argument, default));
1515+
new Token("3", TokenType.Argument, default)});
15161516
command.Parse("-x 1 -x 2 -x 3 -x 4 -x 5")
15171517
.GetResult(option)
15181518
.Tokens
15191519
.Should()
1520-
.BeEquivalentTo(
1520+
.BeEquivalentTo(new [] {
15211521
new Token("1", TokenType.Argument, default),
15221522
new Token("2", TokenType.Argument, default),
15231523
new Token("3", TokenType.Argument, default),
15241524
new Token("4", TokenType.Argument, default),
1525-
new Token("5", TokenType.Argument, default));
1525+
new Token("5", TokenType.Argument, default)});
15261526
}
15271527

15281528
[Fact]

src/System.CommandLine.Tests/System.CommandLine.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="ApprovalTests" />
28-
<PackageReference Include="FluentAssertions" />
28+
<PackageReference Include="AwesomeAssertions" />
2929
<PackageReference Include="Newtonsoft.Json" />
3030
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" />
3131
</ItemGroup>

src/System.CommandLine.Tests/Utility/AssertionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation and contributors. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using System.Collections.Generic;
45
using System.Linq;
56
using FluentAssertions;
67
using FluentAssertions.Collections;
@@ -38,7 +39,7 @@ public static AndConstraint<GenericCollectionAssertions<T>> BeEquivalentSequence
3839
return new AndConstraint<GenericCollectionAssertions<T>>(assertions);
3940
}
4041

41-
public static AndConstraint<StringCollectionAssertions> BeEquivalentSequenceTo(
42+
public static AndConstraint<StringCollectionAssertions<IEnumerable<string>>> BeEquivalentSequenceTo(
4243
this StringCollectionAssertions assertions,
4344
params string[] expectedValues)
4445
{

0 commit comments

Comments
 (0)