Skip to content

Commit

Permalink
Fix the Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
moattarwork committed Jan 31, 2024
1 parent 6b732d4 commit 9d5cb4b
Showing 1 changed file with 17 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

using System.Net.Http;
using Serilog.AspNetCore;
using Microsoft.Extensions.Hosting;

namespace LittleBlocks.Sample.WebAPI.IntegrationTests.Helpers;

Expand Down Expand Up @@ -55,21 +55,24 @@ public string LogDirectoryPath
return Path.Combine(path, logsDirectory);
}
}

protected override IWebHostBuilder CreateWebHostBuilder()
protected override IHostBuilder CreateHostBuilder()
{
var hostBuilder = WebHost.CreateDefaultBuilder()
.ConfigureAppConfiguration((context, builder) =>
var hostBuilder = Host.CreateDefaultBuilder()
.ConfigureWebHostDefaults(webHostBuilder =>
{
var env = context.HostingEnvironment;
env.EnvironmentName = _options.Environment;

var configOptions = new ConfigurationOptions(env.ContentRootPath, env.EnvironmentName,
env.ApplicationName, new string[] { });
builder.ConfigureBuilder(configOptions);
})
.UseStartup<TStartup>()
.ConfigureServices(_options.ConfigureServices);
webHostBuilder.ConfigureAppConfiguration((context, builder) =>
{
var env = context.HostingEnvironment;
env.EnvironmentName = _options.Environment;

var configOptions = new ConfigurationOptions(env.ContentRootPath, env.EnvironmentName,
env.ApplicationName, new string[] { });
builder.ConfigureBuilder(configOptions);
})
.UseStartup<TStartup>()
.ConfigureServices(_options.ConfigureServices);
});

if (_options.EnableLoggingToFile)
hostBuilder.UseSerilog((context, configuration) =>
Expand Down

0 comments on commit 9d5cb4b

Please sign in to comment.