Skip to content

Commit

Permalink
Merge pull request #4192 from devlead/feature/gh-4191
Browse files Browse the repository at this point in the history
GH4191: Update xunit to 2.5.0
  • Loading branch information
devlead authored Jul 8, 2023
2 parents 4a319eb + fce3bf5 commit 6a334f3
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 77 deletions.
4 changes: 2 additions & 2 deletions src/Cake.Common.Tests/Cake.Common.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<!-- Global packages -->
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
8 changes: 4 additions & 4 deletions src/Cake.Common.Tests/Unit/ReleaseNotesParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Should_Parse_Release_Note_Text()
var result = parser.Parse(content);

// Then
Assert.Equal(1, result[0].Notes.Count);
Assert.Single(result[0].Notes);
Assert.Equal("Line 1", result[0].Notes[0]);
}

Expand All @@ -94,7 +94,7 @@ public void Should_Remove_Bullets_From_Release_Note_Text()
var result = parser.Parse(content);

// Then
Assert.Equal(1, result[0].Notes.Count);
Assert.Single(result[0].Notes);
Assert.Equal("Line 1", result[0].Notes[0]);
}

Expand Down Expand Up @@ -143,7 +143,7 @@ public void Should_Remove_Empty_Lines_From_Release_Note_Text()
var result = parser.Parse(content);

// Then
Assert.Equal(1, result[0].Notes.Count);
Assert.Single(result[0].Notes);
Assert.Equal("Line 1", result[0].Notes[0]);
}

Expand Down Expand Up @@ -239,7 +239,7 @@ public void Should_Parse_Release_Note_Text()
var result = parser.Parse(content);

// Then
Assert.Equal(1, result[0].Notes.Count);
Assert.Single(result[0].Notes);
Assert.Equal("Line 1", result[0].Notes[0]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ public void Should_Set_WarningsAsError()

// Then
Assert.True(settings.WarningsAsError);
Assert.Equal(0, settings.WarningsAsErrorCodes.Count);
Assert.Empty(settings.WarningsAsErrorCodes);
}

[Fact]
Expand All @@ -959,7 +959,7 @@ public void Should_Add_Codes()

// Then
Assert.True(settings.WarningsAsError);
Assert.Equal(1, settings.WarningsAsErrorCodes.Count);
Assert.Single(settings.WarningsAsErrorCodes);
Assert.Equal("12345", settings.WarningsAsErrorCodes.First());
}

Expand Down Expand Up @@ -989,7 +989,7 @@ public void Should_Add_Codes()
settings.WithWarningsAsMessage("12345");

// Then
Assert.Equal(1, settings.WarningsAsMessageCodes.Count);
Assert.Single(settings.WarningsAsMessageCodes);
Assert.Equal("12345", settings.WarningsAsMessageCodes.First());
}

Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Core.Tests/Cake.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<!-- Global packages -->
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions src/Cake.Core.Tests/Unit/Graph/CakeGraphTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void Should_Add_Node_To_Graph()
graph.Add("start");

// Then
Assert.Equal(1, graph.Nodes.Count);
Assert.Single(graph.Nodes);
}

[Fact]
Expand Down Expand Up @@ -110,7 +110,7 @@ public void Should_Not_Create_Edge_Between_Connected_Nodes_If_An_Edge_Already_Ex
graph.Connect("start", "end");

// Then
Assert.Equal(1, graph.Edges.Count);
Assert.Single(graph.Edges);
}

[Fact]
Expand All @@ -124,7 +124,7 @@ public void Should_Not_Create_Edge_Between_Connected_Nodes_If_An_Edge_Already_Ex
graph.Connect("START", "END");

// Then
Assert.Equal(1, graph.Edges.Count);
Assert.Single(graph.Edges);
}

[Fact]
Expand Down
34 changes: 17 additions & 17 deletions src/Cake.Core.Tests/Unit/Scripting/Analysis/ScriptAnalyzerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void Should_Return_Error_If_Script_Was_Not_Found()

// Then
Assert.False(result.Succeeded);
Assert.Equal(1, result.Errors.Count);
Assert.Single(result.Errors);
Assert.Equal("Could not find script '/Working/notfound.cake'.", result.Errors[0].Message);
}

Expand Down Expand Up @@ -115,7 +115,7 @@ public void Should_Return_Single_Assembly_Reference_Found_In_Source(string sourc
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.References.Count);
Assert.Single(result.Script.References);
Assert.Equal("hello.dll", result.Script.References.ElementAt(0));
}

Expand All @@ -132,7 +132,7 @@ public void Should_Return_Single_Assembly_Reference_With_Space_In_File_Name_Foun
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.References.Count);
Assert.Single(result.Script.References);
Assert.Equal("hello world.dll", result.Script.References.ElementAt(0));
}

Expand Down Expand Up @@ -165,7 +165,7 @@ public void Should_Process_Using_Directives()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Namespaces.Count);
Assert.Single(result.Script.Namespaces);
Assert.Equal("Cake.Core", result.Script.Namespaces.ElementAt(0));
}

Expand All @@ -180,7 +180,7 @@ public void Should_Process_Using_Alias_Directives()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.UsingAliases.Count);
Assert.Single(result.Script.UsingAliases);
Assert.Equal("using Core = Cake.Core;", result.Script.UsingAliases.ElementAt(0));
}

Expand All @@ -195,8 +195,8 @@ public void Should_Keep_Using_Block()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(0, result.Script.UsingAliases.Count);
Assert.Equal(0, result.Script.Namespaces.Count);
Assert.Empty(result.Script.UsingAliases);
Assert.Empty(result.Script.Namespaces);
Assert.Equal(4, result.Lines.Count);
Assert.Equal(result.Lines[0], "#line 1 \"/Working/script.cake\"");
Assert.Equal(result.Lines[1], "using(new Temp())");
Expand Down Expand Up @@ -232,7 +232,7 @@ public void Should_Process_Addin_Directive_Without_Source()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Addins.Count);
Assert.Single(result.Script.Addins);
Assert.Equal("nuget:?package=Hello.World", result.Script.Addins.ElementAt(0).OriginalString);
}

Expand All @@ -247,7 +247,7 @@ public void Should_Process_Addin_Directive_Using_Uri()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Addins.Count);
Assert.Single(result.Script.Addins);
Assert.Equal("npm:?package=node", result.Script.Addins.ElementAt(0).OriginalString);
}

Expand All @@ -262,7 +262,7 @@ public void Should_Process_Addin_Directive_With_Source()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Addins.Count);
Assert.Single(result.Script.Addins);
Assert.Equal("nuget:http://source/?package=Hello.World", result.Script.Addins.ElementAt(0).OriginalString);
}

Expand All @@ -277,7 +277,7 @@ public void Should_Process_Tool_Directive_Without_Source()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Tools.Count);
Assert.Single(result.Script.Tools);
Assert.Equal("nuget:?package=Hello.World", result.Script.Tools.ElementAt(0).OriginalString);
}

Expand All @@ -292,7 +292,7 @@ public void Should_Process_Tool_Directive_With_Source()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Tools.Count);
Assert.Single(result.Script.Tools);
Assert.Equal("nuget:http://source/?package=Hello.World", result.Script.Tools.ElementAt(0).OriginalString);
}

Expand All @@ -307,7 +307,7 @@ public void Should_Process_Tool_Directive_Using_Uri()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Tools.Count);
Assert.Single(result.Script.Tools);
Assert.Equal("npm:?package=node", result.Script.Tools.ElementAt(0).OriginalString);
}

Expand Down Expand Up @@ -343,7 +343,7 @@ public void Should_Log_Error_Location()
Assert.Equal("#line 1 \"/Working/script.cake\"", result.Lines[0]);
Assert.Equal("// #load \"local:?pat\"", result.Lines[1]);
Assert.False(result.Succeeded);
Assert.Equal(1, result.Errors.Count);
Assert.Single(result.Errors);
Assert.Equal("/Working/script.cake", result.Errors[0].File.FullPath);
Assert.Equal(1, result.Errors[0].Line);
Assert.Equal("Query string for #load is missing parameter 'path'.", result.Errors[0].Message);
Expand All @@ -364,7 +364,7 @@ public void Should_Log_Error_Location_In_Loaded_Script()
// Then
Assert.Equal(6, result.Lines.Count);
Assert.False(result.Succeeded);
Assert.Equal(1, result.Errors.Count);
Assert.Single(result.Errors);
Assert.Equal("/Working/script2.cake", result.Errors[0].File.FullPath);
Assert.Equal(2, result.Errors[0].Line);
Assert.Equal("Query string for #load contains more than one parameter 'path'.", result.Errors[0].Message);
Expand All @@ -381,7 +381,7 @@ public void Should_Process_Using_Static_Directives()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.UsingStaticDirectives.Count);
Assert.Single(result.Script.UsingStaticDirectives);
Assert.Equal("using static System.Math;", result.Script.UsingStaticDirectives.ElementAt(0));
}

Expand All @@ -396,7 +396,7 @@ public void Should_Process_Define_Directives()
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Defines.Count);
Assert.Single(result.Script.Defines);
Assert.Equal("#define FOO", result.Script.Defines.ElementAt(0));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Should_Process_Single_Script_Reference_Found_In_Source(string source
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("/Working/utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand All @@ -44,7 +44,7 @@ public void Should_Process_Single_Script_Reference_With_Spaces_In_File_Name_Foun
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("/Working/test/my utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand All @@ -63,7 +63,7 @@ public void Should_Process_Single_Script_Reference_With_Any_Extension_Found_In_S
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal($"/Working/{filename}", result.Script.Includes[0].Path.FullPath);
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public void Should_Process_Environment_Variable_Found_In_Source(string source)
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("/Working/test/utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand All @@ -123,7 +123,7 @@ public void Should_Process_Multiple_Environment_Variable_Found_In_Source(string
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("/Working/test/scripts/utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand Down Expand Up @@ -151,7 +151,7 @@ public void Should_Ignore_Globber_Matches_With_Invalid_Extensions(string source)
var result = fixture.Analyze("/Working/bootstrap.cake");

// Then
Assert.Equal(0, result.Script.Includes.Count);
Assert.Empty(result.Script.Includes);
}

[Theory]
Expand Down Expand Up @@ -232,7 +232,7 @@ public void Should_Process_AbsolutePath_Script_Reference_Found_In_Source(string
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("/utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand All @@ -251,7 +251,7 @@ public void Should_Process_RelativePath_Script_Reference_Found_In_Source(string
var result = fixture.Analyze("/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("/Working/test/utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand All @@ -270,7 +270,7 @@ public void Should_Process_WindowsAbsolutePath_Script_Reference_Found_In_Source(
var result = fixture.Analyze("C:/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("C:/utils.cake", result.Script.Includes[0].Path.FullPath);
}

Expand All @@ -289,7 +289,7 @@ public void Should_Process_WindowsRelativePath_Script_Reference_Found_In_Source(
var result = fixture.Analyze("C:/Working/script.cake");

// Then
Assert.Equal(1, result.Script.Includes.Count);
Assert.Single(result.Script.Includes);
Assert.Equal("C:/Working/test/utils.cake", result.Script.Includes[0].Path.FullPath);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Core.Tests/Unit/Scripting/ScriptAliasTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void Should_Not_Throw_If_Method_Is_Null()
var result = new ScriptAlias(method, ScriptAliasType.Method, null);

// Then
Assert.Equal(0, result.Namespaces.Count);
Assert.Empty(result.Namespaces);
}
}
}
Expand Down
Loading

0 comments on commit 6a334f3

Please sign in to comment.