File tree Expand file tree Collapse file tree 5 files changed +39
-13
lines changed Expand file tree Collapse file tree 5 files changed +39
-13
lines changed Original file line number Diff line number Diff line change 33using FluentAssertions ;
44using JsonApiDotNetCore . Configuration ;
55using JsonApiDotNetCore . Serialization . Objects ;
6- using Microsoft . AspNetCore . Mvc . Testing ;
76using Microsoft . Extensions . DependencyInjection ;
87using MultiDbContextExample . Models ;
98using TestBuildingBlocks ;
109using Xunit ;
1110
1211namespace MultiDbContextTests ;
1312
14- public sealed class ResourceTests : IntegrationTest , IClassFixture < WebApplicationFactory < ResourceA > >
13+ public sealed class ResourceTests : IntegrationTest , IClassFixture < NotLoggingWebApplicationFactory < ResourceA > >
1514{
16- private readonly WebApplicationFactory < ResourceA > _factory ;
15+ private readonly NotLoggingWebApplicationFactory < ResourceA > _factory ;
1716
1817 protected override JsonSerializerOptions SerializerOptions
1918 {
@@ -24,7 +23,7 @@ protected override JsonSerializerOptions SerializerOptions
2423 }
2524 }
2625
27- public ResourceTests ( WebApplicationFactory < ResourceA > factory )
26+ public ResourceTests ( NotLoggingWebApplicationFactory < ResourceA > factory )
2827 {
2928 _factory = factory ;
3029 }
Original file line number Diff line number Diff line change 33using FluentAssertions ;
44using JsonApiDotNetCore . Configuration ;
55using JsonApiDotNetCore . Serialization . Objects ;
6- using Microsoft . AspNetCore . Mvc . Testing ;
76using Microsoft . Extensions . DependencyInjection ;
87using NoEntityFrameworkExample . Models ;
98using TestBuildingBlocks ;
109using Xunit ;
1110
1211namespace NoEntityFrameworkTests ;
1312
14- public sealed class PersonTests : IntegrationTest , IClassFixture < WebApplicationFactory < Person > >
13+ public sealed class PersonTests : IntegrationTest , IClassFixture < NotLoggingWebApplicationFactory < Person > >
1514{
16- private readonly WebApplicationFactory < Person > _factory ;
15+ private readonly NotLoggingWebApplicationFactory < Person > _factory ;
1716
1817 protected override JsonSerializerOptions SerializerOptions
1918 {
@@ -24,7 +23,7 @@ protected override JsonSerializerOptions SerializerOptions
2423 }
2524 }
2625
27- public PersonTests ( WebApplicationFactory < Person > factory )
26+ public PersonTests ( NotLoggingWebApplicationFactory < Person > factory )
2827 {
2928 _factory = factory ;
3029 }
Original file line number Diff line number Diff line change 33using FluentAssertions ;
44using JsonApiDotNetCore . Configuration ;
55using JsonApiDotNetCore . Serialization . Objects ;
6- using Microsoft . AspNetCore . Mvc . Testing ;
76using Microsoft . Extensions . DependencyInjection ;
87using NoEntityFrameworkExample . Models ;
98using TestBuildingBlocks ;
109using Xunit ;
1110
1211namespace NoEntityFrameworkTests ;
1312
14- public sealed class TodoItemTests : IntegrationTest , IClassFixture < WebApplicationFactory < TodoItem > >
13+ public sealed class TodoItemTests : IntegrationTest , IClassFixture < NotLoggingWebApplicationFactory < TodoItem > >
1514{
16- private readonly WebApplicationFactory < TodoItem > _factory ;
15+ private readonly NotLoggingWebApplicationFactory < TodoItem > _factory ;
1716
1817 protected override JsonSerializerOptions SerializerOptions
1918 {
@@ -24,7 +23,7 @@ protected override JsonSerializerOptions SerializerOptions
2423 }
2524 }
2625
27- public TodoItemTests ( WebApplicationFactory < TodoItem > factory )
26+ public TodoItemTests ( NotLoggingWebApplicationFactory < TodoItem > factory )
2827 {
2928 _factory = factory ;
3029 }
Original file line number Diff line number Diff line change 1+ using System . Diagnostics ;
2+ using JetBrains . Annotations ;
3+ using Microsoft . AspNetCore . Hosting ;
4+ using Microsoft . AspNetCore . Mvc . Testing ;
5+ using Microsoft . Extensions . Logging ;
6+
7+ namespace TestBuildingBlocks ;
8+
9+ [ UsedImplicitly ( ImplicitUseKindFlags . InstantiatedNoFixedConstructorSignature ) ]
10+ public sealed class NotLoggingWebApplicationFactory < TEntryPoint > : WebApplicationFactory < TEntryPoint >
11+ where TEntryPoint : class
12+ {
13+ protected override void ConfigureWebHost ( IWebHostBuilder builder )
14+ {
15+ DisableLogging ( builder ) ;
16+ }
17+
18+ [ Conditional ( "RELEASE" ) ]
19+ private static void DisableLogging ( IWebHostBuilder builder )
20+ {
21+ // Disable logging to keep the output from C/I build clean. Errors are expected to occur while testing failure handling.
22+ builder . ConfigureLogging ( loggingBuilder => loggingBuilder . AddFilter ( _ => false ) ) ;
23+ }
24+ }
Original file line number Diff line number Diff line change 22 "Logging" : {
33 "LogLevel" : {
44 "Default" : " Warning" ,
5+ // Disable logging to keep the output from C/I build clean. Errors are expected to occur while testing failure handling.
6+ "Microsoft.AspNetCore.Hosting.Diagnostics" : " None" ,
57 "Microsoft.Hosting.Lifetime" : " Warning" ,
68 "Microsoft.EntityFrameworkCore" : " Warning" ,
7- "JsonApiDotNetCore" : " Warning"
9+ "Microsoft.EntityFrameworkCore.Model.Validation" : " Critical" ,
10+ "Microsoft.EntityFrameworkCore.Update" : " Critical" ,
11+ "Microsoft.EntityFrameworkCore.Database.Command" : " Critical" ,
12+ "JsonApiDotNetCore" : " Critical"
813 }
914 }
1015}
You can’t perform that action at this time.
0 commit comments