Relocate test project: test/yavscTests -> src/Yavsc.Org.Tests
Move the integration test project from the top-level test/ directory into src/ alongside the projects it tests. Rename the project (and folder) to Yavsc.Org.Tests to match .NET conventions and reflect that it tests the Org runtime primarily. Path changes: - test/yavscTests/yavscTests.csproj -> src/Yavsc.Org.Tests/Yavsc.Org.Tests.csproj - All .cs / .json / .resx files moved to their new location - PostItViewModelTests moved out to the dedicated src/PostIt.Tests project (it was unrelated to Org testing) Build adjustments: - <ProjectReference> paths shortened (..\..\src\X -> ..\X) - PostIt project reference removed (covered by its own test project) - <OutputType>exe added (required by xunit.v3) - xunit.v3.common and xunit.v3.extensibility.core added to package versions Solution + sln: - yavsc.sln Project Name updated to 'Yavsc.Org.Tests' and path updated - GUID preserved so existing build configs stay valid Static web assets: - The CopyStaticWebAssetsManifest target was hard-coding the destination filename to 'testhost.staticwebassets.endpoints.json', which worked when the assembly was named 'yavscTests'. Now that the assembly name is 'Yavsc.Org.Tests', ASP.NET Core's MapStaticAssets() looks for 'Yavsc.Org.Tests.staticwebassets.endpoints.json' (entry-assembly-based resolution). Use $(MSBuildProjectName) so the copy target stays correct under any future rename.
This commit is contained in:
parent
ad19ccbcfa
commit
22b397ce7e
18 changed files with 16 additions and 22 deletions
40
src/Yavsc.Org.Tests/DumpHtml.cs
Normal file
40
src/Yavsc.Org.Tests/DumpHtml.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using yavscTests.ServerFixtures;
|
||||
|
||||
namespace Yavsc.Tests
|
||||
{
|
||||
[Collection("Yavsc Server")]
|
||||
public class DumpHtml : IClassFixture<WebServerFixture>
|
||||
{
|
||||
readonly WebServerFixture _server;
|
||||
public DumpHtml(WebServerFixture server) { _server = server; }
|
||||
|
||||
// FIXME [Fact]
|
||||
[Trait("debug", "html")]
|
||||
public void DumpHomePageHtml()
|
||||
{
|
||||
var settings = _server.SiteSettings;
|
||||
var handler = new HttpClientHandler
|
||||
{
|
||||
ServerCertificateCustomValidationCallback = (_, _, _, _) => true,
|
||||
};
|
||||
var httpsUrl = _server.Addresses.FirstOrDefault(u => u.StartsWith("https:"))
|
||||
?? _server.Addresses.FirstOrDefault() ?? "";
|
||||
// var httpsUrl = "https://localhost:5001" ;
|
||||
using var client = new HttpClient(handler) { BaseAddress = new Uri(httpsUrl) };
|
||||
|
||||
var paths = new[] { "/Home/About", "/css/site.css", "/lib/bootstrap.quartz.min.css", "/nonexistent" };
|
||||
var sb = new System.Text.StringBuilder();
|
||||
sb.AppendLine($"BaseAddress = {httpsUrl}");
|
||||
foreach (var p in paths)
|
||||
{
|
||||
var r = client.GetAsync(p).GetAwaiter().GetResult();
|
||||
var b = r.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
||||
sb.AppendLine($"GET {p} => {r.StatusCode} len={b.Length} ct={r.Content.Headers.ContentType}");
|
||||
if (b.Length > 0 && b.Length < 500)
|
||||
sb.AppendLine($" body: {b.Substring(0, Math.Min(300, b.Length))}");
|
||||
}
|
||||
|
||||
Assert.Fail(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue