File tree 5 files changed +39
-13
lines changed
5 files changed +39
-13
lines changed Original file line number Diff line number Diff line change 3
3
using FluentAssertions ;
4
4
using JsonApiDotNetCore . Configuration ;
5
5
using JsonApiDotNetCore . Serialization . Objects ;
6
- using Microsoft . AspNetCore . Mvc . Testing ;
7
6
using Microsoft . Extensions . DependencyInjection ;
8
7
using MultiDbContextExample . Models ;
9
8
using TestBuildingBlocks ;
10
9
using Xunit ;
11
10
12
11
namespace MultiDbContextTests ;
13
12
14
- public sealed class ResourceTests : IntegrationTest , IClassFixture < WebApplicationFactory < ResourceA > >
13
+ public sealed class ResourceTests : IntegrationTest , IClassFixture < NotLoggingWebApplicationFactory < ResourceA > >
15
14
{
16
- private readonly WebApplicationFactory < ResourceA > _factory ;
15
+ private readonly NotLoggingWebApplicationFactory < ResourceA > _factory ;
17
16
18
17
protected override JsonSerializerOptions SerializerOptions
19
18
{
@@ -24,7 +23,7 @@ protected override JsonSerializerOptions SerializerOptions
24
23
}
25
24
}
26
25
27
- public ResourceTests ( WebApplicationFactory < ResourceA > factory )
26
+ public ResourceTests ( NotLoggingWebApplicationFactory < ResourceA > factory )
28
27
{
29
28
_factory = factory ;
30
29
}
Original file line number Diff line number Diff line change 3
3
using FluentAssertions ;
4
4
using JsonApiDotNetCore . Configuration ;
5
5
using JsonApiDotNetCore . Serialization . Objects ;
6
- using Microsoft . AspNetCore . Mvc . Testing ;
7
6
using Microsoft . Extensions . DependencyInjection ;
8
7
using NoEntityFrameworkExample . Models ;
9
8
using TestBuildingBlocks ;
10
9
using Xunit ;
11
10
12
11
namespace NoEntityFrameworkTests ;
13
12
14
- public sealed class PersonTests : IntegrationTest , IClassFixture < WebApplicationFactory < Person > >
13
+ public sealed class PersonTests : IntegrationTest , IClassFixture < NotLoggingWebApplicationFactory < Person > >
15
14
{
16
- private readonly WebApplicationFactory < Person > _factory ;
15
+ private readonly NotLoggingWebApplicationFactory < Person > _factory ;
17
16
18
17
protected override JsonSerializerOptions SerializerOptions
19
18
{
@@ -24,7 +23,7 @@ protected override JsonSerializerOptions SerializerOptions
24
23
}
25
24
}
26
25
27
- public PersonTests ( WebApplicationFactory < Person > factory )
26
+ public PersonTests ( NotLoggingWebApplicationFactory < Person > factory )
28
27
{
29
28
_factory = factory ;
30
29
}
Original file line number Diff line number Diff line change 3
3
using FluentAssertions ;
4
4
using JsonApiDotNetCore . Configuration ;
5
5
using JsonApiDotNetCore . Serialization . Objects ;
6
- using Microsoft . AspNetCore . Mvc . Testing ;
7
6
using Microsoft . Extensions . DependencyInjection ;
8
7
using NoEntityFrameworkExample . Models ;
9
8
using TestBuildingBlocks ;
10
9
using Xunit ;
11
10
12
11
namespace NoEntityFrameworkTests ;
13
12
14
- public sealed class TodoItemTests : IntegrationTest , IClassFixture < WebApplicationFactory < TodoItem > >
13
+ public sealed class TodoItemTests : IntegrationTest , IClassFixture < NotLoggingWebApplicationFactory < TodoItem > >
15
14
{
16
- private readonly WebApplicationFactory < TodoItem > _factory ;
15
+ private readonly NotLoggingWebApplicationFactory < TodoItem > _factory ;
17
16
18
17
protected override JsonSerializerOptions SerializerOptions
19
18
{
@@ -24,7 +23,7 @@ protected override JsonSerializerOptions SerializerOptions
24
23
}
25
24
}
26
25
27
- public TodoItemTests ( WebApplicationFactory < TodoItem > factory )
26
+ public TodoItemTests ( NotLoggingWebApplicationFactory < TodoItem > factory )
28
27
{
29
28
_factory = factory ;
30
29
}
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 2
2
"Logging" : {
3
3
"LogLevel" : {
4
4
"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" ,
5
7
"Microsoft.Hosting.Lifetime" : " Warning" ,
6
8
"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"
8
13
}
9
14
}
10
15
}
You can’t perform that action at this time.
0 commit comments