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);
		}
Esempio n. 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);
		}