Пример #1
0
        public async ValueTask <SceneUpdate> IsUpdateRequired(string conferenceId, string roomId,
                                                              object synchronizedObject, object?previousValue)
        {
            if (synchronizedObject is SynchronizedRooms rooms)
            {
                if (SceneUtilities.ParticipantsOfRoomChanged(roomId, rooms, previousValue as SynchronizedRooms))
                {
                    return(SceneUpdate.AvailableScenesChanged);
                }
            }

            return(SceneUpdate.NotRequired);
        }
Пример #2
0
        public void ParticipantsOfRoomChanged_PreviousValueNull_ReturnTrue()
        {
            // arrange
            var current = new SynchronizedRooms(ImmutableList <Room> .Empty, "default",
                                                ImmutableDictionary <string, string> .Empty);
            SynchronizedRooms?previous = null;

            // act
            var result = SceneUtilities.ParticipantsOfRoomChanged("room1", current, previous);

            // assert
            Assert.True(result);
        }
Пример #3
0
        public void ParticipantsOfRoomChanged_SomeChangesInOtherRooms_ReturnFalse()
        {
            // arrange
            var current = new SynchronizedRooms(ImmutableList <Room> .Empty, "default",
                                                ImmutableDictionary <string, string> .Empty);
            var previous = new SynchronizedRooms(ImmutableList <Room> .Empty, "default",
                                                 new Dictionary <string, string> {
                { "p1", "room2" }
            });

            // act
            var result = SceneUtilities.ParticipantsOfRoomChanged("room1", current, previous);

            // assert
            Assert.False(result);
        }
Пример #4
0
        protected override async ValueTask <bool> InternalIsUpdateRequired(string conferenceId, string roomId,
                                                                           object synchronizedObject, object?previousValue)
        {
            if (synchronizedObject is SynchronizedRooms rooms)
            {
                if (SceneUtilities.ParticipantsOfRoomChanged(roomId, rooms, previousValue as SynchronizedRooms))
                {
                    return(true);
                }
            }
            else if (synchronizedObject is SynchronizedMediaState)
            {
                return(true);
            }

            return(false);
        }