diff --git a/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj b/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
index c12d1e5..ad9d60c 100644
--- a/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
+++ b/src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj
@@ -10,7 +10,7 @@
net10.0
enable
- enable
+ disable
false
true
diff --git a/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs b/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs
index 2596e9b..60f1d62 100644
--- a/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs
+++ b/src/ElectronNET.IntegrationTests/Tests/IpcMainTests.cs
@@ -15,10 +15,21 @@ namespace ElectronNET.IntegrationTests.Tests
[Fact(Timeout = 20000)]
public async Task Ipc_On_receives_message_from_renderer()
{
+ object received = null;
+
var tcs = new TaskCompletionSource();
- await Electron.IpcMain.On("ipc-on-test", obj => tcs.TrySetResult(obj?.ToString() ?? string.Empty));
+ await Electron.IpcMain.On("ipc-on-test", obj =>
+ {
+ received = obj;
+ tcs.TrySetResult(obj as string);
+ });
+
await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.send('ipc-on-test','payload123')");
+
var result = await tcs.Task.WaitAsync(TimeSpan.FromSeconds(5));
+
+ received.Should().BeOfType();
+ received.Should().Be("payload123");
result.Should().Be("payload123");
}
@@ -46,12 +57,18 @@ namespace ElectronNET.IntegrationTests.Tests
[Fact(Timeout = 20000)]
public async Task Ipc_OnSync_returns_value()
{
+ object received = null;
+
Electron.IpcMain.OnSync("ipc-sync-test", (obj) =>
{
- obj.Should().NotBeNull();
+ received = obj;
return "pong";
});
var ret = await this.fx.MainWindow.WebContents.ExecuteJavaScriptAsync("require('electron').ipcRenderer.sendSync('ipc-sync-test','ping')");
+
+ received.Should().BeOfType();
+ received.Should().Be("ping");
+
ret.Should().Be("pong");
}