Skip to content

Commit dd3189f

Browse files
committed
Add BlazorWasmHosted test
1 parent b5dbc69 commit dd3189f

File tree

20 files changed

+161
-0
lines changed

20 files changed

+161
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
while (true)
5+
{
6+
Console.WriteLine(".");
7+
await Task.Delay(1000);
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"profiles": {
3+
"http": {
4+
"commandName": "Project",
5+
"dotnetRunMessages": "true",
6+
"launchBrowser": true,
7+
"applicationUrl": "http://localhost:5000",
8+
"environmentVariables": {
9+
"ASPNETCORE_ENVIRONMENT": "Development"
10+
}
11+
}
12+
}
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<ProjectReference Include="..\blazorwasm\blazorwasm.csproj" />
9+
</ItemGroup>
10+
</Project>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="true">
2+
<Found Context="routeData">
3+
<RouteView RouteData="@routeData"/>
4+
</Found>
5+
<NotFound>
6+
<p>Sorry, there's nothing at this address.</p>
7+
</NotFound>
8+
</Router>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.publish { }
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@page "/"
2+
3+
<h1>Hello, world!</h1>
4+
5+
Welcome to your new app.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
3+
namespace standalone
4+
{
5+
public class Program
6+
{
7+
public static void Main(string[] args)
8+
{
9+
GC.KeepAlive(typeof(System.Text.Json.JsonSerializer));
10+
GC.KeepAlive(typeof(RazorClassLibrary.Class1));
11+
#if REFERENCE_classlibrarywithsatelliteassemblies
12+
GC.KeepAlive(typeof(classlibrarywithsatelliteassemblies.Class1));
13+
#endif
14+
}
15+
}
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@using Microsoft.AspNetCore.Components.Routing
2+
@using standalone
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(CurrentTargetFramework)</TargetFramework>
5+
<ServiceWorkerAssetsManifest>custom-service-worker-assets.js</ServiceWorkerAssetsManifest>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(MicrosoftAspNetCoreAppRefPackageVersion)" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="$(MicrosoftAspNetCoreAppRefPackageVersion)" PrivateAssets="all" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\razorclasslibrary\RazorClassLibrary.csproj" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<!-- These assets should be treated as static web assets for publish purposes -->
19+
<Content Include="..\LinkBaseToWebRoot\**\*.js">
20+
<LinkBase>wwwroot\</LinkBase>
21+
</Content>
22+
23+
<!-- This asset should be ignored as a static web assets as it defines CopyToPublishDirectory="Never" -->
24+
<Content Update="wwwroot\css\app.css" CopyToPublishDirectory="Never" />
25+
26+
<!-- This asset should be treated as a static web asset and copied into the right location defined by its link attribute. -->
27+
<Content Include="LinkToWebRoot\css\app.css" Link="wwwroot\css\app.css" />
28+
29+
<!-- The content from my-prod-service-worker.js should be published under the name my-service-worker.js -->
30+
<ServiceWorker Include="wwwroot\serviceworkers\my-service-worker.js" PublishedContent="wwwroot\serviceworkers\my-prod-service-worker.js" />
31+
</ItemGroup>
32+
33+
<!-- Enabling compression increases build time. We want to avoid this for tests so we
34+
disable it here. This doesn't affect any test assertions. -->
35+
<PropertyGroup>
36+
<_BlazorBrotliCompressionLevel>NoCompression</_BlazorBrotliCompressionLevel>
37+
</PropertyGroup>
38+
39+
</Project>
Binary file not shown.

0 commit comments

Comments
 (0)