Example #1
0
        public async Task ParticipantJoinedInConference_RemoveParticipantAndReturnOldConferenceId()
        {
            const string participantKey        = "2AFA88F3-50E3-4356-9529-F47A730B25B0";
            const string participantId         = "14FAA2C6-8FAC-46D1-B34C-6916F5D213D7";
            const string conferenceKeyTemplate = "conference:7fa3aba5bfdb4a648294fe9fb5df40dc:*";
            const string currentConferenceId   = "50DABA18-7F83-4D0D-8FDD-B2ADE18C5FBC";
            const string currentConferenceKey  = "conference:7fa3aba5bfdb4a648294fe9fb5df40dc:" + currentConferenceId;
            const string currentConnectionId   = "7996bdfaf063485492974d74e7e3d657";

            // arrange
            await _database.SetAsync(participantKey, currentConferenceId);

            await _database.HashSetAsync(currentConferenceKey, participantId, currentConnectionId);

            // act
            var result = await Execute(participantId, participantKey, conferenceKeyTemplate);

            // assert
            var arr = (string[])result;

            Assert.Equal(arr[0], currentConferenceId);
            Assert.Equal(arr[1], currentConnectionId);

            var participantKeyExists = await _database.KeyDeleteAsync(participantKey);

            Assert.False(participantKeyExists);

            var participantMappingExists = await _database.HashExistsAsync(currentConferenceKey, participantId);

            Assert.False(participantMappingExists);
        }