37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.IO;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
namespace Microsoft.Blazor.E2ETest.Infrastructure.ServerFixtures
|
|
{
|
|
public class AspNetSiteServerFixture : WebHostServerFixture
|
|
{
|
|
public delegate IWebHost BuildWebHost(string[] args);
|
|
|
|
public BuildWebHost BuildWebHostMethod { get; set; }
|
|
|
|
protected override IWebHost CreateWebHost()
|
|
{
|
|
if (BuildWebHostMethod == null)
|
|
{
|
|
throw new InvalidOperationException(
|
|
$"No value was provided for {nameof(BuildWebHostMethod)}");
|
|
}
|
|
|
|
var sampleSitePath = Path.Combine(
|
|
FindSolutionDir(),
|
|
"samples",
|
|
BuildWebHostMethod.Method.DeclaringType.Assembly.GetName().Name);
|
|
|
|
return BuildWebHostMethod(new[]
|
|
{
|
|
"--urls", "http://127.0.0.1:0",
|
|
"--contentroot", sampleSitePath
|
|
});
|
|
}
|
|
}
|
|
}
|