public async Task GenericEventWithoutEventArgsBaseTypeRaisedOnClient() { var tcs = new TaskCompletionSource <CustomNonDerivingEventArgs>(); EventHandler <CustomNonDerivingEventArgs> handler = (sender, args) => tcs.SetResult(args); this.clientRpc.AppleGrown += handler; var expectedArgs = new CustomNonDerivingEventArgs { Color = "Red" }; this.server.OnAppleGrown(expectedArgs); var actualArgs = await tcs.Task.WithCancellation(this.TimeoutToken); Assert.Equal(expectedArgs.Color, actualArgs.Color); // Now unregister and confirm we don't get notified. this.clientRpc.AppleGrown -= handler; tcs = new TaskCompletionSource <CustomNonDerivingEventArgs>(); this.server.OnAppleGrown(expectedArgs); await Assert.ThrowsAsync <TimeoutException>(() => tcs.Task.WithTimeout(ExpectedTimeout)); Assert.False(tcs.Task.IsCompleted); }
internal void OnAppleGrown(CustomNonDerivingEventArgs args) => this.AppleGrown?.Invoke(this, args);