Skip to content

Commit

Permalink
[Tests] LogLevel fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyBP committed Mar 15, 2022
1 parent 925522a commit c38ea87
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Apizr/Tests/Apizr.Tests/Apis/IReqResService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//[assembly:Log]
namespace Apizr.Tests.Apis
{
[WebApi("https://reqres.in/api"), Log(HttpMessageParts.None, TODO)]
[WebApi("https://reqres.in/api"), Log(HttpMessageParts.None)]
public interface IReqResService
{
[Get("/users")]
Expand All @@ -29,7 +29,7 @@ public interface IReqResService
[Get("/users")]
Task<UserList> GetUsersAsync([Priority] int priority);

[Get("/users"), Log(HttpMessageParts.RequestBody, HttpTracerMode.ErrorsAndExceptionsOnly, TODO)]
[Get("/users"), Log(HttpMessageParts.RequestBody, HttpTracerMode.ErrorsAndExceptionsOnly, LogLevel.Warning)]
Task<UserList> GetUsersAsync([Priority] int priority, [Context] Context context);

[Get("/users")]
Expand Down
4 changes: 2 additions & 2 deletions Apizr/Tests/Apizr.Tests/ApizrExtendedRegistryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ public void Calling_WithLogging_Should_Set_LoggingSettings()
var services = new ServiceCollection();
services.AddPolicyRegistry(_policyRegistry);
services.AddApizr(registry => registry
.AddFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, (LogLevel[]) LogLevel.Warning)));
.AddFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, LogLevel.Warning)));

var serviceProvider = services.BuildServiceProvider();
var fixture = serviceProvider.GetRequiredService<IApizrManager<IReqResService>>();

fixture.Options.HttpTracerMode.Should().Be(HttpTracerMode.ExceptionsOnly);
fixture.Options.TrafficVerbosity.Should().Be(HttpMessageParts.RequestCookies);
fixture.Options.LogLevels.Should().Be(LogLevel.Warning);
fixture.Options.LogLevels.Should().AllBeEquivalentTo(LogLevel.Warning);
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions Apizr/Tests/Apizr.Tests/ApizrExtendedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ public void Calling_WithLogging_Should_Set_LoggingSettings()
{
var services = new ServiceCollection();
services.AddPolicyRegistry(_policyRegistry);
services.AddApizrFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, (LogLevel[]) LogLevel.Warning));
services.AddApizrFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, LogLevel.Warning));

var serviceProvider = services.BuildServiceProvider();
var fixture = serviceProvider.GetRequiredService<IApizrManager<IReqResService>>();

fixture.Options.HttpTracerMode.Should().Be(HttpTracerMode.ExceptionsOnly);
fixture.Options.TrafficVerbosity.Should().Be(HttpMessageParts.RequestCookies);
fixture.Options.LogLevels.Should().Be(LogLevel.Warning);
fixture.Options.LogLevels.Should().AllBeEquivalentTo(LogLevel.Warning);
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions Apizr/Tests/Apizr.Tests/ApizrRegistryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ public async Task Calling_WithAuthenticationHandler_ProperOption_Should_Authenti
public void Calling_WithLogging_Should_Set_LoggingSettings()
{
var apizrRegistry = Apizr.Create(registry => registry
.AddFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, (LogLevel[]) LogLevel.Warning)));
.AddFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, LogLevel.Warning)));

var reqResManager = apizrRegistry.GetFor<IReqResService>();

reqResManager.Options.HttpTracerMode.Should().Be(HttpTracerMode.ExceptionsOnly);
reqResManager.Options.TrafficVerbosity.Should().Be(HttpMessageParts.RequestCookies);
reqResManager.Options.LogLevels.Should().Be(LogLevel.Warning);
reqResManager.Options.LogLevels.Should().AllBeEquivalentTo(LogLevel.Warning);
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions Apizr/Tests/Apizr.Tests/ApizrTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ public async Task Calling_WithAuthenticationHandler_ProperOption_Should_Authenti
[Fact]
public void Calling_WithLogging_Should_Set_LoggingSettings()
{
var reqResManager = Apizr.CreateFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, (LogLevel[]) LogLevel.Warning));
var reqResManager = Apizr.CreateFor<IReqResService>(options => options.WithLogging((HttpTracerMode) HttpTracerMode.ExceptionsOnly, (HttpMessageParts) HttpMessageParts.RequestCookies, LogLevel.Warning));

reqResManager.Options.HttpTracerMode.Should().Be(HttpTracerMode.ExceptionsOnly);
reqResManager.Options.TrafficVerbosity.Should().Be(HttpMessageParts.RequestCookies);
reqResManager.Options.LogLevels.Should().Be(LogLevel.Warning);
reqResManager.Options.LogLevels.Should().AllBeEquivalentTo(LogLevel.Warning);
}

[Fact]
Expand Down

0 comments on commit c38ea87

Please sign in to comment.