System.Threading.Tasks.TaskCompletionSource.SetResult(WhiteboardLiveUpdateDto)

Here are the examples of the csharp api System.Threading.Tasks.TaskCompletionSource.SetResult(WhiteboardLiveUpdateDto) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : WhiteboardTests.cs
with Apache License 2.0
from Anapher

[Fact]
        public async Task WhiteboardLiveAction_Allowed_PublishToAll()
        {
            // arrange
            var (conn, conference) = await ConnectToOpenedConference();
            var whiteboardId = await CreateWhiteboard(conn);

            var olaf = CreateUser();
            var olafConnection = await ConnectUserToConference(olaf, conference);

            var notification = new TaskCompletionSource<WhiteboardLiveUpdateDto>();
            olafConnection.Hub.On(CoreHubMessages.OnWhiteboardLiveUpdate,
                (WhiteboardLiveUpdateDto dto) => notification.SetResult(dto));

            // act
            var liveAction = new DrawingLineCanvasLiveAction("black", 4, 0, 0, 5, 5);
            var result = await conn.Hub.InvokeAsync<SuccessOrError<Unit>>(nameof(CoreHub.WhiteboardLiveAction),
                new WhiteboardLiveActionDto(whiteboardId, liveAction));

            // replacedert
            replacedertSuccess(result);

            var receivedUpdate = await notification.Task.WithDefaultTimeout();
            replacedert.Equal(conn.User.Sub, receivedUpdate.ParticipantId);
            replacedert.Equal(whiteboardId, receivedUpdate.WhiteboardId);
            replacedert.Equal(liveAction, receivedUpdate.Action);
        }