Ejemplo n.º 1
0
        public void RequestChannelListMessageNotJoined()
        {
            permissions.EnablePermissions(-1, PermissionName.RequestChannelList);

            var cs = provider.GetConnections(GablarskiProtocol.Instance);
            var c  = new ConnectionBuffer(cs.Item1);
            var s  = new ConnectionBuffer(cs.Item2);

            manager.Connect(cs.Item2);

            handler.RequestChanneListMessage(new MessageEventArgs <RequestChannelListMessage> (s,
                                                                                               new RequestChannelListMessage()));

            var msg = c.DequeueAndAssertMessage <ChannelListMessage>();

            Assert.AreEqual(GenericResult.Success, msg.Result);
            ChannelInfoTests.AssertChanelsAreEqual(channels.GetChannels().Single(), msg.Channels.Single());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public void RequestOnlineUserList()
        {
            permissions.EnablePermissions(-1, PermissionName.RequestChannelList);

            var u1 = JoinAsGuest(server, client, "Nickname");

            var cs = provider.GetConnections(GablarskiProtocol.Instance);
            var s  = new ConnectionBuffer(cs.Item2);
            var c  = new ConnectionBuffer(cs.Item1);

            var u2 = JoinAsGuest(s, c, "Nickname2");

            client.DequeueAndAssertMessage <UserJoinedMessage>();

            handler.OnRequestUserListMessage(new MessageEventArgs <RequestUserListMessage> (server,
                                                                                            new RequestUserListMessage(UserListMode.Current)));

            var list = client.DequeueAndAssertMessage <UserInfoListMessage>().Users.ToList();

            Assert.AreEqual(2, list.Count);
            Assert.IsTrue(list.Any(u => u.Nickname == "Nickname"), "User was not in returned list.");
            Assert.IsTrue(list.Any(u => u.Nickname == "Nickname2"), "User was not in returned list.");
        }