Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Services/DefaultNetworkMonitorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public DefaultNetowrkMonitorService(IJSRuntime jsRuntime)
/// <summary>
/// <inheritdoc/>
/// </summary>
public async Task<NetworkMonitorState> GetNetworkMonitorState(CancellationToken token = default)
public async Task<NetworkMonitorState?> GetNetworkMonitorState(CancellationToken token = default)
{
_module ??= await LoadModule();
return await _module.InvokeAsync<NetworkMonitorState?>("getNetworkInfo", token) ?? new();
return await _module.InvokeAsync<NetworkMonitorState?>("getNetworkInfo", token);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Services/INetworkMonitorService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface INetworkMonitorService
/// <param name="token">A cancellation token that can be used to cancel the operation.</param>
/// <returns>A task representing the asynchronous operation. The task result contains the current <see
/// cref="NetworkMonitorState"/>.</returns>
Task<NetworkMonitorState> GetNetworkMonitorState(CancellationToken token = default);
Task<NetworkMonitorState?> GetNetworkMonitorState(CancellationToken token = default);

/// <summary>
/// Registers a callback to be invoked when the network monitor state changes.
Expand Down
1 change: 1 addition & 0 deletions test/UnitTest/Services/DefaultNetworkMonitorServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public async Task GetNetworkMonitorState_Ok()
});
var service = Context.Services.GetRequiredService<INetworkMonitorService>();
var state = await service.GetNetworkMonitorState(CancellationToken.None);
Assert.NotNull(state);
Assert.Equal("4g", state.NetworkType);
Assert.Equal(10, state.Downlink);
Assert.Equal(100, state.RTT);
Expand Down
2 changes: 1 addition & 1 deletion test/UnitTest/Services/TcpSocketFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ public async Task DelimiterDataPackageHandler_Ok()
var ex = Assert.Throws<ArgumentNullException>(() => new DelimiterDataPackageHandler(string.Empty));
Assert.NotNull(ex);

ex = Assert.Throws<ArgumentNullException>(() => new DelimiterDataPackageHandler((byte[])null!));
ex = Assert.Throws<ArgumentNullException>(() => new DelimiterDataPackageHandler(null!));
Assert.NotNull(ex);
}

Expand Down
Loading