core-admin icon indicating copy to clipboard operation
core-admin copied to clipboard

Add .NET 8 support; Fix tests

Open iwedaz opened this issue 2 years ago • 3 comments

It is huge PR, but it is hard to split it in small pieces. The main goal of that PR is add .net 8 TFM and restore integration test functionality.

What have been done:

  • update dependencies to the latest version;
  • add net8.0 TFM and adjust references in others projects;
  • rewrite DotNetEd.CoreAdmin.IntegrationTestApp Program.cs to top-level statement;
  • add fixture (TestAppFixture) that can initialize database and seed data properly;
  • use that fixture in integration test;
  • fix integration test to use scoped lifetime area for getting IntegrationTestDbContext;
  • update github action to use .net 8.

iwedaz avatar Dec 31 '23 15:12 iwedaz

Hi and thank you for the PR! Not sure about tests/DotNetEd.CoreAdmin.IntegrationTestApp/Program.cs and the top-level statement. @edandersen is not a big fan. Me neither. For the rest, it seems good to me. I ping @edandersen to see if he has time to approve the rest of the PR.

gaetandezeiraud avatar Jan 29 '24 12:01 gaetandezeiraud

This is great, thanks. I'll get to merging it soon.

edandersen avatar Jan 29 '24 12:01 edandersen

.NET 6 build target integration tests fail. I think .NET 7 and 8 are okay.

[xUnit.net 00:00:12.90]     DotNetEd.CoreAdmin.IntegrationTests.SecurityTests.ReturnsUnauthorizedWhenInProductionCustomAuthMethodFails [FAIL]
  Failed DotNetEd.CoreAdmin.IntegrationTests.CrudTests.DeleteHappyPath [1 ms]
  Error Message:
   System.InvalidOperationException : Unable to build IHost
  Stack Trace:
     at Microsoft.Extensions.Hosting.HostFactoryResolver.HostingListener.CreateHost()
   at Microsoft.Extensions.Hosting.HostFactoryResolver.<>c__DisplayClass8_0.<ResolveHostFactory>b__0(String[] args)
   at Microsoft.AspNetCore.Mvc.Testing.DeferredHostBuilder.Build()
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.CreateHost(IHostBuilder builder)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.ConfigureHostBuilder(IHostBuilder hostBuilder)
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.EnsureServer()
   at Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactory`1.get_Services()
   at DotNetEd.CoreAdmin.IntegrationTests.TestAppFixture.InitializeAsync() in D:\a\core-admin\core-admin\tests\DotNetEd.CoreAdmin.IntegrationTests\TestAppFixture.cs:line 22

edandersen avatar Jan 29 '24 12:01 edandersen

Thanks for taking a look at this but I've now released 3.0.0 with .NET 8 support. Cheers!

edandersen avatar Mar 11 '24 06:03 edandersen