File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
src/ElectronNET.IntegrationTests Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1010 <PropertyGroup >
1111 <TargetFramework >net10.0</TargetFramework >
1212 <ImplicitUsings >enable</ImplicitUsings >
13- <Nullable >enable </Nullable >
13+ <Nullable >disable </Nullable >
1414 <IsPackable >false</IsPackable >
1515 <CopyLocalLockFileAssemblies >true</CopyLocalLockFileAssemblies > <!-- https://github.com/Tyrrrz/GitHubActionsTestLogger/issues/5 -->
1616 </PropertyGroup >
Original file line number Diff line number Diff line change @@ -15,10 +15,21 @@ public IpcMainTests(ElectronFixture fx)
1515 [ Fact ( Timeout = 20000 ) ]
1616 public async Task Ipc_On_receives_message_from_renderer ( )
1717 {
18+ object received = null ;
19+
1820 var tcs = new TaskCompletionSource < string > ( ) ;
19- await Electron . IpcMain . On ( "ipc-on-test" , obj => tcs . TrySetResult ( obj ? . ToString ( ) ?? string . Empty ) ) ;
21+ await Electron . IpcMain . On ( "ipc-on-test" , obj =>
22+ {
23+ received = obj ;
24+ tcs . TrySetResult ( obj as string ) ;
25+ } ) ;
26+
2027 await this . fx . MainWindow . WebContents . ExecuteJavaScriptAsync < string > ( "require('electron').ipcRenderer.send('ipc-on-test','payload123')" ) ;
28+
2129 var result = await tcs . Task . WaitAsync ( TimeSpan . FromSeconds ( 5 ) ) ;
30+
31+ received . Should ( ) . BeOfType < string > ( ) ;
32+ received . Should ( ) . Be ( "payload123" ) ;
2233 result . Should ( ) . Be ( "payload123" ) ;
2334 }
2435
@@ -46,12 +57,18 @@ public async Task Ipc_RemoveAllListeners_stops_receiving()
4657 [ Fact ( Timeout = 20000 ) ]
4758 public async Task Ipc_OnSync_returns_value ( )
4859 {
60+ object received = null ;
61+
4962 Electron . IpcMain . OnSync ( "ipc-sync-test" , ( obj ) =>
5063 {
51- obj . Should ( ) . NotBeNull ( ) ;
64+ received = obj ;
5265 return "pong" ;
5366 } ) ;
5467 var ret = await this . fx . MainWindow . WebContents . ExecuteJavaScriptAsync < string > ( "require('electron').ipcRenderer.sendSync('ipc-sync-test','ping')" ) ;
68+
69+ received . Should ( ) . BeOfType < string > ( ) ;
70+ received . Should ( ) . Be ( "ping" ) ;
71+
5572 ret . Should ( ) . Be ( "pong" ) ;
5673 }
5774
You can’t perform that action at this time.
0 commit comments