Esempio n. 1
0
        protected TestBase()
        {
            Config = new ConfigurationBuilder()
                     .AddJsonFile(SETTINGS_FILE_NAME)
                     .Build();

            IWebHostBuilder builder = new WebHostBuilder()
                                      .UseStartup <TestStartup>()
                                      .UseConfiguration(Config)
                                      .UseEnvironment("Test");

            var server = new TestServer(builder);

            Client = server.CreateClient();

            Client.DefaultRequestHeaders.Clear();

            Client.DefaultRequestHeaders.Accept.Add(
                new System.Net.Http.Headers
                .MediaTypeWithQualityHeaderValue("application/json"));

            Client.DefaultRequestHeaders.Authorization =
                new System.Net.Http.Headers
                .AuthenticationHeaderValue("Bearer", "Bearer a dummy token");

            StagingContext = server.Host.Services
                             .GetService(typeof(TFTIContext)) as TFTIContext;

            var connectionResolver = server.Host.Services
                                     .GetService(typeof(IConnectionResolver)) as IConnectionResolver;

            _tftiConnection = connectionResolver
                              .Resolve(TFTIRepository.CONNECTION_NAME) as MockConnection;
        }
Esempio n. 2
0
 /// <summary>
 ///     Constructor to set the Kalandear database context.
 /// </summary>
 /// <param name="context"></param>
 public TFTIRepository(TFTIContext context)
 {
     _context = context;
 }