diff --git a/CSharp/DP.Domain/DP.Domain.csproj b/CSharp/DP.Domain/DP.Domain.csproj index 9f5c4f4..7b97f26 100644 --- a/CSharp/DP.Domain/DP.Domain.csproj +++ b/CSharp/DP.Domain/DP.Domain.csproj @@ -1,7 +1,8 @@ - netstandard2.0 + net8.0 + $(NoWarn);SYSLIB0011 diff --git a/CSharp/DP.UnitTest/DP.UnitTest.csproj b/CSharp/DP.UnitTest/DP.UnitTest.csproj index 7660851..faa2867 100644 --- a/CSharp/DP.UnitTest/DP.UnitTest.csproj +++ b/CSharp/DP.UnitTest/DP.UnitTest.csproj @@ -1,18 +1,18 @@ - netcoreapp2.0 + net8.0 false + true - - - - - - + + + + all + diff --git a/CSharp/DP.UnitTest/Utility/XunitTraceListener.cs b/CSharp/DP.UnitTest/Utility/XunitTraceListener.cs index 251dba3..4c5e8de 100644 --- a/CSharp/DP.UnitTest/Utility/XunitTraceListener.cs +++ b/CSharp/DP.UnitTest/Utility/XunitTraceListener.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics; using Xunit.Abstractions; @@ -15,11 +16,25 @@ public XunitTraceListener(ITestOutputHelper output) } public override void Write(string message) { - this._output.WriteLine(message); + try + { + this._output.WriteLine(message); + } + catch (InvalidOperationException) + { + // Ignore if there is no active test + } } public override void WriteLine(string message) - { - this._output.WriteLine(message); + { + try + { + this._output.WriteLine(message); + } + catch (InvalidOperationException) + { + // Ignore if there is no active test + } } } } \ No newline at end of file diff --git a/CSharp/DP.Website/DP.Website.csproj b/CSharp/DP.Website/DP.Website.csproj index be6f02a..d1e4d6e 100644 --- a/CSharp/DP.Website/DP.Website.csproj +++ b/CSharp/DP.Website/DP.Website.csproj @@ -1,15 +1,7 @@ - netcoreapp2.0 + net8.0 - - - - - - - - diff --git a/CSharp/DP.Website/Startup.cs b/CSharp/DP.Website/Startup.cs index 743f2a2..6f6d655 100644 --- a/CSharp/DP.Website/Startup.cs +++ b/CSharp/DP.Website/Startup.cs @@ -6,14 +6,17 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace DP.Website { public class Startup { - public Startup(IConfiguration configuration) + private readonly IWebHostEnvironment _env; + + public Startup(IWebHostEnvironment env) { - Configuration = configuration; + _env = env; } public IConfiguration Configuration { get; } @@ -21,13 +24,16 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc(); + services.AddControllersWithViews(options => + { + options.EnableEndpointRouting = false; + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) + public void Configure(IApplicationBuilder app) { - if (env.IsDevelopment()) + if (_env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } diff --git a/CSharp/DP.Website/Views/Home/Builder.cshtml b/CSharp/DP.Website/Views/Home/Builder.cshtml index 2901303..a997428 100644 --- a/CSharp/DP.Website/Views/Home/Builder.cshtml +++ b/CSharp/DP.Website/Views/Home/Builder.cshtml @@ -6,7 +6,7 @@ { for (int i = 0; i < Model.Parents.Count(); i++) { - @Html.Partial("_ParentPartial", Model.Parents.ToList()[i]) + } } @@ -17,7 +17,7 @@ { for (int i = 0; i < Model.Children.Count(); i++) { - @Html.Partial("_ChildPartial", Model.Children.ToList()[i]) + } } @@ -27,7 +27,7 @@ { for (int i = 0; i < Model.Pets.Count(); i++) { - @Html.Partial("_PetPartial", Model.Pets.ToList()[i]) + } } \ No newline at end of file diff --git a/CSharp/DP.Website/Views/Home/State.cshtml b/CSharp/DP.Website/Views/Home/State.cshtml index 2901303..a997428 100644 --- a/CSharp/DP.Website/Views/Home/State.cshtml +++ b/CSharp/DP.Website/Views/Home/State.cshtml @@ -6,7 +6,7 @@ { for (int i = 0; i < Model.Parents.Count(); i++) { - @Html.Partial("_ParentPartial", Model.Parents.ToList()[i]) + } } @@ -17,7 +17,7 @@ { for (int i = 0; i < Model.Children.Count(); i++) { - @Html.Partial("_ChildPartial", Model.Children.ToList()[i]) + } } @@ -27,7 +27,7 @@ { for (int i = 0; i < Model.Pets.Count(); i++) { - @Html.Partial("_PetPartial", Model.Pets.ToList()[i]) + } } \ No newline at end of file