GetConnections() 공개 메소드

public GetConnections ( IEnumerable protocols ) : MockServerConnection>.Tuple
protocols IEnumerable
리턴 MockServerConnection>.Tuple
예제 #1
0
        public void LoginResult()
        {
            LoginResultState state = LoginResultState.Success;
            var msg = new LoginResultMessage (new LoginResult (UserId, state));

            Assert.IsTrue (msg.Result.Succeeded);
            Assert.AreEqual (state, msg.Result.ResultState);
            Assert.AreEqual (UserId, msg.Result.UserId);

            var provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            provider.Start (MessageTypes.All);

            var cs = provider.GetConnections (GablarskiProtocol.Instance);

            this.clientContext = new SerializationContext (cs.Item1, new Dictionary<byte, Protocol> { { 42, GablarskiProtocol.Instance } });
            this.serverContext = new SerializationContext (cs.Item2, new Dictionary<byte, Protocol> { { 42, GablarskiProtocol.Instance } });
        }
예제 #2
0
		public void Setup()
		{
			permissions = new MockPermissionsProvider();
			users = new MockUserProvider();

			provider = new MockConnectionProvider (GablarskiProtocol.Instance);

			context = new MockServerContext (provider)
			{
				Settings = new ServerSettings(),
				UserProvider = users,
				PermissionsProvider = permissions,
				ChannelsProvider = new LobbyChannelProvider(),
			};

			context.Sources = new ServerSourceHandler (context, new ServerSourceManager (context));
			context.Channels = new ServerChannelHandler (context);
			context.UserManager = new ServerUserManager();
			context.Users = handler = new ServerUserHandler (context, context.UserManager);

			context.Start();

			var cs = provider.GetConnections (GablarskiProtocol.Instance);
			server = new ServerConnectionBuffer (cs.Item2);
			client = new ConnectionBuffer (cs.Item1);

			var observers = provider.GetConnections (GablarskiProtocol.Instance);
			sobserver = observers.Item2;
			observer = new ConnectionBuffer (observers.Item1);
		}
예제 #3
0
        public void Setup()
        {
            user = new UserInfo ("Nickname", "Phonetic", "Username", 1, 2, true);
            manager = new ServerUserManager();

            provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            provider.Start (MessageTypes.All);

            var cs = provider.GetConnections (GablarskiProtocol.Instance);
            server = cs.Item2;
            client = cs.Item1;
        }
예제 #4
0
        public void Setup()
        {
            permissions = new MockPermissionsProvider();

            LobbyChannelProvider channels = new LobbyChannelProvider();
            channels.SaveChannel (new ChannelInfo
            {
                Name = "Channel 2"
            });

            this.provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            this.provider.Start (MessageTypes.All);

            userManager = new ServerUserManager();
            MockServerContext c;
            context = c = new MockServerContext (provider)
            {
                Settings = new ServerSettings
                {
                    Name = "Server",
                    DefaultAudioBitrate = defaultBitrate,
                    MaximumAudioBitrate = maxBitrate,
                    MinimumAudioBitrate = minBitrate
                },

                UserManager = userManager,
                PermissionsProvider = permissions,
                ChannelsProvider = channels
            };
            c.Users = new ServerUserHandler (context, userManager);

            manager = new ServerSourceManager (context);
            handler = new ServerSourceHandler (context, manager);

            user = UserInfoTests.GetTestUser (1, 1, false);

            var cs = provider.GetConnections (GablarskiProtocol.Instance);

            client = new ConnectionBuffer (cs.Item1);
            server = cs.Item2;

            userManager.Connect (server);
            userManager.Join (server, user);
        }
예제 #5
0
		public void Setup()
		{
			manager = new ServerUserManager();
			permissions = new MockPermissionsProvider();
			channels = new LobbyChannelProvider();

			MockServerContext mcontext;
			context = mcontext = new MockServerContext
			{
				ChannelsProvider = channels,
				PermissionsProvider = permissions,
				UserManager = new ServerUserManager (),
				Settings = new ServerSettings { Name = "Test Server" }
			};

			mcontext.Users = new ServerUserHandler (context, manager);
			mcontext.Channels = handler = new ServerChannelHandler (context);

			user = UserInfoTests.GetTestUser (1, 1, false);

			provider = new MockConnectionProvider (GablarskiProtocol.Instance);
			mcontext.AddConnectionProvider (provider);
			mcontext.Start();

			var connections = provider.GetConnections (GablarskiProtocol.Instance);
			client = new ConnectionBuffer (connections.Item1);
			server = connections.Item2;

			manager.Connect (server);
			manager.Join (server, user);
		}