public void RunBeforeAnyTests() { // NLog var config = new LoggingConfiguration(); var logconsole = new ConsoleTarget("logconsole"); config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); LogManager.Configuration = config; // set config when nlog used from LogManager.GetCurrentClassLogger() NLogBuilder.ConfigureNLog(config); // set config when nlog used from asp net core // Database var factory = new DbContextFactory(); Dependencies.DbContext = factory.Build() as DbContext; // Backend api StartupConfig var startupConfig = new StartupConfig { IsTest = true, ConfigureTestServices = services => { services.AddScoped <IGraphQlDbContextFactory, DbContextFactory>(); } }; // Backend api service var basePathUrl = "https://*****:*****@NcRfUjXn2r4u7x!A%D*G-KaPdSgVkYp3s6v8y/B?E(H+MbQeThWmZq4t7w!z$C&F"; var jwtTokenService = new JwtTokenService(); var bearer = jwtTokenService.Generate(jwtToken, secretKey); var url = new UriBuilder(basePathUrl) { Path = "graphql/surveillance" }.ToString(); var client = new ApiClient(url, bearer, new HttpClientHandler { UseProxy = false }); Dependencies.ApiClient = client; }