Skip to content

Commit 6ec2767

Browse files
committed
Fixup test
1 parent b08ec9f commit 6ec2767

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Components/WebAssembly/WebAssembly.Authentication/test/WebAssemblyAuthenticationServiceCollectionExtensionsTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System;
5-
using System.Collections.Generic;
6-
using System.Net;
75
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
86
using Microsoft.Extensions.DependencyInjection;
97
using Microsoft.Extensions.DependencyInjection.Extensions;

src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Collections.Generic;
66
using System.IO;
77
using System.Linq;
8-
using System.Text;
8+
using System.Runtime.InteropServices;
99
using Microsoft.AspNetCore.Components.Routing;
1010
using Microsoft.AspNetCore.Components.WebAssembly.Services;
1111
using Microsoft.Extensions.Configuration;
@@ -67,6 +67,12 @@ private WebAssemblyHostBuilder()
6767

6868
private void InitializeEnvironment()
6969
{
70+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY")))
71+
{
72+
// The remainder of this method relies on the ability to make .NET WebAssembly-specific JSInterop calls.
73+
return;
74+
}
75+
7076
var applicationEnvironment = DefaultWebAssemblyJSRuntime.Instance.InvokeUnmarshalled<string>("Blazor._internal.getApplicationEnvironment");
7177
Services.AddSingleton<IWebAssemblyHostEnvironment>(new WebAssemblyHostEnvironment(applicationEnvironment));
7278

@@ -157,7 +163,7 @@ public WebAssemblyHost Build()
157163
return new WebAssemblyHost(services, scope, configuration, RootComponents.ToArray());
158164
}
159165

160-
private void InitializeDefaultServices()
166+
internal void InitializeDefaultServices()
161167
{
162168
Services.AddSingleton<IJSRuntime>(DefaultWebAssemblyJSRuntime.Instance);
163169
Services.AddSingleton<NavigationManager>(WebAssemblyNavigationManager.Instance);

0 commit comments

Comments
 (0)