Skip to content

Commit

Permalink
Merge pull request #93 from JanoPL/92-bug-exception-the-number-column…
Browse files Browse the repository at this point in the history
…s-in-the-row-5-does-not-match-the-values-3

92 bug exception the number columns in the row 5 does not match the values 3
  • Loading branch information
JanoPL authored May 20, 2024
2 parents b6c39fd + ec93fb8 commit de092b1
Show file tree
Hide file tree
Showing 85 changed files with 76,619 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<ItemGroup>
<PackageVersion Include="ConsoleTables" Version="2.6.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageVersion Include="xunit" Version="2.8.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="[2.4.2]" Condition="'$(TargetFramework)' == 'netcoreapp3.1'" />
<PackageVersion Include="xunit.runner.visualstudio" Version="[2.4.2]" Condition="'$(TargetFramework)' == 'net5.0'" />
Expand Down
16 changes: 15 additions & 1 deletion RoutesList.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestBasicBlazorServer", "te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "tests\UnitTests\UnitTests.csproj", "{01AEBB69-AE24-4BDB-8912-1B14622C26A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestBasicSiteRazor", "tests\TestSites\TestBasicSiteRazor\TestBasicSiteRazor.csproj", "{C77FC416-83A9-4B73-B80F-A012C955EEDF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestBasicSiteRazor", "tests\TestSites\TestBasicSiteRazor\TestBasicSiteRazor.csproj", "{C77FC416-83A9-4B73-B80F-A012C955EEDF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestSiteRazorPages", "tests\TestSites\TestSiteRazorPages\TestSiteRazorPages.csproj", "{EA8C1C54-37E6-4309-AB3C-38C75CE024E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoutesList.Integration.RazorPages", "tests\RoutesList.Integration.RazorPages\RoutesList.Integration.RazorPages.csproj", "{6F07D810-ED3D-46C4-BC56-40899A0AB27F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -79,6 +83,14 @@ Global
{C77FC416-83A9-4B73-B80F-A012C955EEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C77FC416-83A9-4B73-B80F-A012C955EEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C77FC416-83A9-4B73-B80F-A012C955EEDF}.Release|Any CPU.Build.0 = Release|Any CPU
{EA8C1C54-37E6-4309-AB3C-38C75CE024E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA8C1C54-37E6-4309-AB3C-38C75CE024E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA8C1C54-37E6-4309-AB3C-38C75CE024E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA8C1C54-37E6-4309-AB3C-38C75CE024E7}.Release|Any CPU.Build.0 = Release|Any CPU
{6F07D810-ED3D-46C4-BC56-40899A0AB27F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F07D810-ED3D-46C4-BC56-40899A0AB27F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F07D810-ED3D-46C4-BC56-40899A0AB27F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F07D810-ED3D-46C4-BC56-40899A0AB27F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -94,6 +106,8 @@ Global
{7E8ED101-D318-4DA3-BF36-425A6DD7CEF5} = {BB691CA0-5B87-4B21-80A2-CA63DD00F898}
{01AEBB69-AE24-4BDB-8912-1B14622C26A4} = {D2236F00-56A6-4BA8-91F9-7CD970A46F33}
{C77FC416-83A9-4B73-B80F-A012C955EEDF} = {BB691CA0-5B87-4B21-80A2-CA63DD00F898}
{EA8C1C54-37E6-4309-AB3C-38C75CE024E7} = {BB691CA0-5B87-4B21-80A2-CA63DD00F898}
{6F07D810-ED3D-46C4-BC56-40899A0AB27F} = {D2236F00-56A6-4BA8-91F9-7CD970A46F33}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87DFA115-5F76-4EB2-8EDE-48DE379CA43B}
Expand Down
21 changes: 14 additions & 7 deletions src/RoutesList.Build/Services/TableBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ConsoleTables;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using RoutesList.Build.Enums;
using RoutesList.Build.Extensions;
Expand Down Expand Up @@ -109,10 +111,10 @@ private async Task<string> GenerateTable(bool isJson, RoutesListOptions? options
ListRoutes = _routes.getRoutesInformation(_actionDescriptorCollectionProvider);

if (isJson) {
string serialize = String.Empty;
var serialize = new StringBuilder();

if (IsCompiledPageActionDescriptor()) {
serialize = JsonConvert.SerializeObject(
serialize.AppendLine(JsonConvert.SerializeObject(
ListRoutes.Select(x => {
return new {
x.RelativePath,
Expand All @@ -121,11 +123,11 @@ private async Task<string> GenerateTable(bool isJson, RoutesListOptions? options
x.Template,
};
})
);
));
}

if (IsControllerActionDescriptor()) {
serialize = JsonConvert.SerializeObject(
serialize.AppendLine(JsonConvert.SerializeObject(
ListRoutes.Select(x => {
return new {
x.Display_name,
Expand All @@ -135,10 +137,10 @@ private async Task<string> GenerateTable(bool isJson, RoutesListOptions? options
x.Method_name,
};
})
);
));
}

return await Task.FromResult(serialize);
return await Task.FromResult(serialize.ToString());
}

return await Task.FromResult("");
Expand Down Expand Up @@ -186,7 +188,12 @@ private void AddTableRow (ref ConsoleTable table, RoutesInformationModel route)
{
if (route.IsCompiledPageActionDescriptor) {
string linkString = $"<a href=/{route.ViewEnginePath}>{route.ViewEnginePath ?? route.Template ?? "/"} </a>";
table.AddRow(route.Display_name, linkString, route.RelativePath);

if (table.Columns.Count > 3) {
table.AddRow(null, linkString, route.Display_name, null, route.RelativePath);
} else {
table.AddRow(route.Display_name, linkString, route.RelativePath);
}
}

if (!route.IsCompiledPageActionDescriptor) {
Expand Down
107 changes: 107 additions & 0 deletions tests/RoutesList.Integration.Razor/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@
"RoutesList.Gen": "[1.1.2, )"
}
},
"testsiterazorpages": {
"type": "Project"
},
"web.application.factory": {
"type": "Project",
"dependencies": {
Expand Down Expand Up @@ -917,6 +920,9 @@
"RoutesList.Gen": "[1.1.2, )"
}
},
"testsiterazorpages": {
"type": "Project"
},
"web.application.factory": {
"type": "Project",
"dependencies": {
Expand Down Expand Up @@ -1310,6 +1316,43 @@
"resolved": "5.0.0",
"contentHash": "c5JVjuVAm4f7E9Vj+v09Z9s2ZsqFDjBpcsyS3M9xRo0bEdm/LVZSzLxxNvfvAwRiiE8nwe1h2G4OwiwlzFKXlA=="
},
"Serilog.Extensions.Hosting": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "db0OcbWeSCvYQkHWu6n0v40N4kKaTAXNjlM3BKvcbwvNzYphQFcBR+36eQ/7hMMwOkJvAyLC2a9/jNdUL5NjtQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.0",
"Microsoft.Extensions.Hosting.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging.Abstractions": "8.0.0",
"Serilog": "3.1.1",
"Serilog.Extensions.Logging": "8.0.0"
}
},
"Serilog.Extensions.Logging": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "YEAMWu1UnWgf1c1KP85l1SgXGfiVo0Rz6x08pCiPOIBt2Qe18tcZLvdBUuV5o1QHvrs8FAry9wTIhgBRtjIlEg==",
"dependencies": {
"Microsoft.Extensions.Logging": "8.0.0",
"Serilog": "3.1.1"
}
},
"Serilog.Formatting.Compact": {
"type": "Transitive",
"resolved": "2.0.0",
"contentHash": "ob6z3ikzFM3D1xalhFuBIK1IOWf+XrQq+H4KeH4VqBcPpNcmUgZlRQ2h3Q7wvthpdZBBoY86qZOI2LCXNaLlNA==",
"dependencies": {
"Serilog": "3.1.0"
}
},
"Serilog.Sinks.Debug": {
"type": "Transitive",
"resolved": "2.0.0",
"contentHash": "Y6g3OBJ4JzTyyw16fDqtFcQ41qQAydnEvEqmXjhwhgjsnG/FaJ8GUqF5ldsC/bVkK8KYmqrPhDO+tm4dF6xx4A==",
"dependencies": {
"Serilog": "2.10.0"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
"resolved": "8.0.0",
Expand Down Expand Up @@ -1403,6 +1446,17 @@
"RoutesList.Gen": "[1.1.2, )"
}
},
"testsiterazorpages": {
"type": "Project",
"dependencies": {
"RoutesList.Gen": "[1.1.2, )",
"Serilog": "[3.1.1, )",
"Serilog.AspNetCore": "[8.0.1, )",
"Serilog.Settings.Configuration": "[8.0.0, )",
"Serilog.Sinks.Console": "[5.0.1, )",
"Serilog.Sinks.File": "[5.0.0, )"
}
},
"web.application.factory": {
"type": "Project",
"dependencies": {
Expand Down Expand Up @@ -1433,6 +1487,59 @@
"requested": "[13.0.3, )",
"resolved": "13.0.3",
"contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ=="
},
"Serilog": {
"type": "CentralTransitive",
"requested": "[3.1.1, )",
"resolved": "3.1.1",
"contentHash": "P6G4/4Kt9bT635bhuwdXlJ2SCqqn2nhh4gqFqQueCOr9bK/e7W9ll/IoX1Ter948cV2Z/5+5v8pAfJYUISY03A=="
},
"Serilog.AspNetCore": {
"type": "CentralTransitive",
"requested": "[8.0.1, )",
"resolved": "8.0.1",
"contentHash": "B/X+wAfS7yWLVOTD83B+Ip9yl4MkhioaXj90JSoWi1Ayi8XHepEnsBdrkojg08eodCnmOKmShFUN2GgEc6c0CQ==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "8.0.0",
"Microsoft.Extensions.Logging": "8.0.0",
"Serilog": "3.1.1",
"Serilog.Extensions.Hosting": "8.0.0",
"Serilog.Extensions.Logging": "8.0.0",
"Serilog.Formatting.Compact": "2.0.0",
"Serilog.Settings.Configuration": "8.0.0",
"Serilog.Sinks.Console": "5.0.0",
"Serilog.Sinks.Debug": "2.0.0",
"Serilog.Sinks.File": "5.0.0"
}
},
"Serilog.Settings.Configuration": {
"type": "CentralTransitive",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "nR0iL5HwKj5v6ULo3/zpP8NMcq9E2pxYA6XKTSWCbugVs4YqPyvaqaKOY+OMpPivKp7zMEpax2UKHnDodbRB0Q==",
"dependencies": {
"Microsoft.Extensions.Configuration.Binder": "8.0.0",
"Microsoft.Extensions.DependencyModel": "8.0.0",
"Serilog": "3.1.1"
}
},
"Serilog.Sinks.Console": {
"type": "CentralTransitive",
"requested": "[5.0.1, )",
"resolved": "5.0.1",
"contentHash": "6Jt8jl9y2ey8VV7nVEUAyjjyxjAQuvd5+qj4XYAT9CwcsvR70HHULGBeD+K2WCALFXf7CFsNQT4lON6qXcu2AA==",
"dependencies": {
"Serilog": "3.1.1"
}
},
"Serilog.Sinks.File": {
"type": "CentralTransitive",
"requested": "[5.0.0, )",
"resolved": "5.0.0",
"contentHash": "uwV5hdhWPwUH1szhO8PJpFiahqXmzPzJT/sOijH/kFgUx+cyoDTMM8MHD0adw9+Iem6itoibbUXHYslzXsLEAg==",
"dependencies": {
"Serilog": "2.10.0"
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TestSites\TestSiteRazorPages\TestSiteRazorPages.csproj" />
<ProjectReference Include="..\Web.Application.Factory\Web.Application.Factory.csproj" />
</ItemGroup>

</Project>
31 changes: 31 additions & 0 deletions tests/RoutesList.Integration.RazorPages/WebApplicationTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Web.Application.Factory;

namespace RoutesList.Integration.RazorPages;

public class WebApplicationTest
{

private readonly CustomWebApplication<Program> _application;

public WebApplicationTest()
{
_application = new CustomWebApplication<Program>();
}

[Theory]
[InlineData("/", "text/html; charset=utf-8")]
[InlineData("/Privacy", "text/html; charset=utf-8")]
[InlineData("/routes", "text/html")]
[InlineData("/routes/json", "application/json; charset=utf-8")]
public async Task ResponseTest(string url, string contentType)
{
using var client = _application.CreateClient();
using var response = await client.GetAsync(url);

response.EnsureSuccessStatusCode();
Assert.Equal(
contentType,
response?.Content?.Headers?.ContentType?.ToString()
);
}
}
Loading

0 comments on commit de092b1

Please sign in to comment.