Skip to content

Avoid configuring DI for ILogger<T> in tests #99

Open
@deansheather

Description

@deansheather

In some test code we are creating a host application builder and instantiating serilog to do app logging.

var builder = Host.CreateApplicationBuilder();
builder.Services.AddSerilog();
_logger = (ILogger<MutagenController>)builder.Build().Services.GetService(typeof(ILogger<MutagenController>))!;

We should probably just write an implementation for ILogger and ILogger<out T> that log to the test output. It can use serilog under the hood if that makes it easier.

IDK where we'd put it, though. Maybe we should add add a Test.Utils project or something

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions