コード例 #1
0
        public async Task RemoveParticipant_ParticipantExists_RemoveAndReturnTrue()
        {
            const string participantId = "6dc6c7f9ca0f487683dd90a6ce0a54af";
            const string conferenceId  = "91b241c21b7740e688f3ac3a088c90bb";
            const string connectionId  = "6f0120c43b9249458df86610c1999855";

            var participantKey = $"{participantId}:ParticipantToConference";
            var conferenceKey  = $"{conferenceId}:ConferenceParticipants";

            // arrange
            await _database.StringSetAsync(participantKey, conferenceId);

            await _database.HashSetAsync(conferenceKey, participantId, connectionId);

            // act
            var result = await _repository.RemoveParticipant(participantId, connectionId);

            // assert
            Assert.True(result);

            string?currentConferenceId = await _database.StringGetAsync(participantKey);

            Assert.Null(currentConferenceId);

            string?hashSetEntry = await _database.HashGetAsync(conferenceKey, participantId);

            Assert.Null(hashSetEntry);
        }
コード例 #2
0
 public async Task Handle(ParticipantLeftNotification notification, CancellationToken cancellationToken)
 {
     await _joinedParticipantsRepository.RemoveParticipant(notification.Participant.Id,
                                                           notification.ConnectionId);
 }