Beispiel #1
0
    protected void Init(Action <ConventionContextBuilder>?action = null)
    {
        var conventionContextBuilder = ConventionContextBuilder.Create()
                                       .ForTesting(DependencyContext.Load(GetType().Assembly), LoggerFactory)
                                       .WithLogger(Logger);

        action?.Invoke(conventionContextBuilder);
        var context = ConventionContext.From(conventionContextBuilder);

        Populate(new ServiceCollection().ApplyConventions(context));
    }
 protected HandleTestHostBase(ITestOutputHelper outputHelper, LogLevel logLevel = LogLevel.Information) : base(
         outputHelper,
         logLevel,
         "[{Timestamp:HH:mm:ss} {Level:w4}] {Message} <{SourceContext}>{NewLine}{Exception}"
         )
 {
     _context =
         ConventionContextBuilder.Create()
         .ForTesting(DependencyContext.Load(GetType().Assembly), LoggerFactory)
         .WithLogger(LoggerFactory.CreateLogger(nameof(AutoFakeTest)));
     ExcludeSourceContext(nameof(AutoFakeTest));
 }
Beispiel #3
0
    public Task InitializeAsync()
    {
        var conventionContextBuilder = ConventionContextBuilder.Create()
                                       .ForTesting(DependencyContext.Load(GetType().Assembly), LoggerFactory)
                                       .WithLogger(Logger);

        var context = ConventionContext.From(conventionContextBuilder);

        Populate(new ServiceCollection().ApplyConventions(context));

        return(Task.CompletedTask);
    }
 public NamedSchemaTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
 {
     _context = ConventionContext.From(
         ConventionContextBuilder.Create()
         .ForTesting(DependencyContext.Load(GetType().Assembly), LoggerFactory)
         .WithLogger(LoggerFactory.CreateLogger(nameof(AutoFakeTest)))
         .ConfigureServices(
             (_, collection) =>
     {
         collection.AddGraphQL();
         collection.AddGraphQL("Named");
     }
             )
         );
     ExcludeSourceContext(nameof(NamedSchemaTests));
 }
Beispiel #5
0
 protected HandleTestHostBase(ITestOutputHelper outputHelper, LogLevel logLevel = LogLevel.Information) : base(
         outputHelper,
         logLevel,
         "[{Timestamp:HH:mm:ss} {Level:w4}] {Message} <{SourceContext}>{NewLine}{Exception}"
         )
 {
     _hostBuilder =
         ConventionContext.From(
             ConventionContextBuilder.Create()
             .ForTesting(AppDomain.CurrentDomain, LoggerFactory)
             .WithLogger(Logger)
             );
     ExcludeSourceContext(nameof(WebAssemblyHostBuilder));
     ExcludeSourceContext(nameof(WebAssemblyHost));
     ExcludeSourceContext(nameof(DiagnosticSource));
     Populate(new ServiceCollection().ApplyConventions(_hostBuilder));
 }