예제 #1
0
        internal void OnSetCommentMessage(MessageEventArgs <SetCommentMessage> e)
        {
            var msg = e.Message;

            IUserInfo user = Manager.GetUser(e.Connection);

            if (user == null || user.Comment == msg.Comment)
            {
                return;
            }

            user = Manager.SetComment(user, msg.Comment);

            foreach (IConnection connection in Manager.GetConnections())
            {
                connection.SendAsync(new UserUpdatedMessage(user));
            }
        }
예제 #2
0
        public AudioSource GetSourceFromRequest(MockServerConnection serverConnection, ConnectionBuffer clientConnection)
        {
            permissions.EnablePermissions(userManager.GetUser(serverConnection).UserId, PermissionName.RequestSource);

            var audioArgs = new AudioCodecArgs(AudioFormat.Mono16bitLPCM, 64000, AudioSourceTests.FrameSize, 10);

            handler.RequestSourceMessage(new MessageEventArgs <RequestSourceMessage> (serverConnection,
                                                                                      new RequestSourceMessage("Name", audioArgs)));

            var result = clientConnection.DequeueAndAssertMessage <SourceResultMessage>();

            Assert.AreEqual(SourceResult.Succeeded, result.SourceResult);
            Assert.AreEqual("Name", result.SourceName);
            Assert.AreEqual("Name", result.Source.Name);

            AudioCodecArgsTests.AssertAreEqual(audioArgs, result.Source.CodecSettings);

            clientConnection.AssertNoMessage();

            return(result.Source);
        }
예제 #3
0
        public void Join()
        {
            manager.Connect(server);
            manager.Join(server, user);

            Assert.IsTrue(manager.GetIsJoined(server));
            Assert.IsTrue(manager.GetIsJoined(user));

            IUserInfo joinedUser = manager.GetUser(server);

            Assert.AreEqual(user.UserId, joinedUser.UserId);
            Assert.AreEqual(user.Username, joinedUser.Username);
            Assert.AreEqual(user.Nickname, joinedUser.Nickname);
            Assert.AreEqual(user.Phonetic, joinedUser.Phonetic);
            Assert.AreEqual(user.Status, joinedUser.Status);
            Assert.AreEqual(user.IsMuted, joinedUser.IsMuted);
        }