Inheritance: IConnectionProvider
Exemplo n.º 1
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);
		}
Exemplo n.º 2
0
        public MockClientConnection(MockConnectionProvider provider)
        {
            if (provider == null)
                throw new ArgumentNullException ("provider");

            this.provider = provider;
        }
Exemplo n.º 3
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);
		}
Exemplo n.º 4
0
        public void SetUp()
        {
            this.queue = new ReliableQueue();

            var provider = new MockConnectionProvider(MockProtocol.Instance);

            this.connection = provider.GetClientConnection();
        }
Exemplo n.º 5
0
        public void Setup()
        {
            provider = new MockConnectionProvider(protocol);
            provider.Start(MessageTypes.Reliable);

            connection = new MockClientConnection(provider);
            client     = new TempestClient(connection, MessageTypes.All);
        }
Exemplo n.º 6
0
        public void AddConnectionProvider()
        {
            var p = new MockConnectionProvider (protocol);
            Assert.IsFalse (p.IsRunning);

            var server = new MockServer (provider, MessageTypes.Reliable);
            server.AddConnectionProvider (p);
            Assert.IsFalse (p.IsRunning);
        }
Exemplo n.º 7
0
        public MockClientConnection(MockConnectionProvider provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            this.provider = provider;
        }
Exemplo n.º 8
0
        public void AddAfterStarting()
        {
            var p = new MockConnectionProvider (protocol);
            Assert.IsFalse (p.IsRunning);

            var server = new TempestServer (provider, MessageTypes.Reliable);
            server.Start();

            server.AddConnectionProvider (p);
            Assert.IsTrue (p.IsRunning);
        }
Exemplo n.º 9
0
        public void AddConnectionProvider()
        {
            var p = new MockConnectionProvider(protocol);

            Assert.IsFalse(p.IsRunning);

            var server = new TempestServer(provider, MessageTypes.Reliable);

            server.AddConnectionProvider(p);
            Assert.IsFalse(p.IsRunning);
        }
Exemplo n.º 10
0
        public void RemoveNotAddedConnectionProvider()
        {
            var p = new MockConnectionProvider(protocol);

            p.Start(MessageTypes.Reliable);
            Assert.IsTrue(p.IsRunning);

            var server = new TempestServer(provider, MessageTypes.Reliable);

            server.RemoveConnectionProvider(p);
            Assert.IsTrue(p.IsRunning);
        }
Exemplo n.º 11
0
        public void ServerConnectionConnected()
        {
            var provider = new MockConnectionProvider (MockProtocol.Instance);
            provider.Start (MessageTypes.Reliable);

            var test = new AsyncTest<ConnectionMadeEventArgs> (e => Assert.AreEqual (true, e.Connection.IsConnected));
            provider.ConnectionMade += test.PassHandler;

            var client = provider.GetClientConnection (MockProtocol.Instance);
            client.ConnectAsync (new Target (Target.AnyIP, 0), MessageTypes.Reliable);

            test.Assert (5000);
        }
Exemplo n.º 12
0
		public void Setup()
		{
			var provider = new MockConnectionProvider (SocialProtocol.Instance);
			provider.ConnectionMade += (sender, args) => server = new ConnectionBuffer (args.Connection);
			provider.Start (MessageTypes.Reliable);

			var c = new MockClientConnection (provider);
			client = new ConnectionBuffer (c);

			clientContext = new SerializationContext (c, new Dictionary<byte, Protocol> { { 2, SocialProtocol.Instance } });

			var context = new TempestClient (c, MessageTypes.Reliable);
			context.ConnectAsync (new Target (Target.LoopbackIP, 1)).Wait();

			list = new WatchList (context);
		}
Exemplo n.º 13
0
        public void ServerConnectionConnected()
        {
            var provider = new MockConnectionProvider(MockProtocol.Instance);

            provider.Start(MessageTypes.Reliable);

            var test = new AsyncTest <ConnectionMadeEventArgs> (e => Assert.AreEqual(true, e.Connection.IsConnected));

            provider.ConnectionMade += test.PassHandler;

            var client = provider.GetClientConnection(MockProtocol.Instance);

            client.ConnectAsync(new Target(Target.AnyIP, 0), MessageTypes.Reliable);

            test.Assert(5000);
        }
Exemplo n.º 14
0
		public void Setup()
		{
			this.provider = new MockConnectionProvider (SocialProtocol.Instance);
		}
Exemplo n.º 15
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;
        }
Exemplo n.º 16
0
 public void Setup()
 {
     provider = new MockConnectionProvider (protocol);
 }
Exemplo n.º 17
0
        public void RemoveNotAddedConnectionProvider()
        {
            var p = new MockConnectionProvider (protocol);
            p.Start (MessageTypes.Reliable);
            Assert.IsTrue (p.IsRunning);

            var server = new MockServer (provider, MessageTypes.Reliable);
            server.RemoveConnectionProvider (p);
            Assert.IsTrue (p.IsRunning);
        }
Exemplo n.º 18
0
 public MockClientConnection(MockConnectionProvider provider, IEnumerable<Protocol> protocols)
     : this(provider)
 {
     this.protocols = protocols;
 }
Exemplo n.º 19
0
        public void ManagerSetup()
        {
            this.provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            this.provider.Start (MessageTypes.All);

            var connections = this.provider.GetConnections (GablarskiProtocol.Instance);

            this.server = new ConnectionBuffer (connections.Item2);
            this.client = connections.Item1;

            userProvider = new MockUserProvider();
            context = new MockClientContext (client) { ServerInfo = new ServerInfo (new ServerSettings(), userProvider) };

            var channels = new ClientChannelManager (context);
            ClientChannelManagerTests.PopulateChannels (channels, this.server);

            this.userManager = new ClientUserManager();
            this.handler = new ClientUserHandler (context, userManager);
            context.Users = this.handler;
            context.Channels = channels;
        }
Exemplo n.º 20
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 } });
        }
Exemplo n.º 21
0
 public void ManagerTearDown()
 {
     this.userProvider = null;
     this.server = null;
     this.handler = null;
     this.userManager = null;
     this.provider = null;
     this.context = null;
 }
Exemplo n.º 22
0
        public void SetUp()
        {
            this.queue = new ReliableQueue();

            var provider = new MockConnectionProvider (MockProtocol.Instance);
            this.connection = provider.GetClientConnection();
        }
Exemplo n.º 23
0
 public MockClientConnection(MockConnectionProvider provider, IEnumerable <Protocol> protocols)
     : this(provider)
 {
     this.protocols = protocols;
 }
Exemplo n.º 24
0
 public void ServerTestCleanup()
 {
     this.server.Stop();
     this.server = null;
     this.provider = null;
     this.users = null;
     this.channels = null;
     this.permissions = null;
     this.settings = null;
 }
Exemplo n.º 25
0
        public void Setup()
        {
            provider = new MockConnectionProvider (protocol);
            provider.Start (MessageTypes.Reliable);

            connection = new MockClientConnection (provider);
            client = new TempestClient (connection, MessageTypes.All);
        }
Exemplo n.º 26
0
 public void ServerTestInitialize()
 {
     this.settings = new ServerSettings {Name = "Test Server", Description = "Test Server"};
     this.permissions = new GuestPermissionProvider ();
     this.channels = new LobbyChannelProvider();
     this.users = new GuestUserProvider();
     this.server = new GablarskiServer (this.settings, this.users, this.permissions, this.channels);
     this.server.AddConnectionProvider (this.provider = new MockConnectionProvider (GablarskiProtocol.Instance), ExecutionMode.GlobalOrder);
     this.server.Start ();
 }
Exemplo n.º 27
0
 public void Setup()
 {
     provider = new MockConnectionProvider(protocol);
 }
Exemplo n.º 28
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);
        }
Exemplo n.º 29
0
        public void ManagerSetup()
        {
            this.provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            this.provider.Start (MessageTypes.All);

            var connections = this.provider.GetConnections (GablarskiProtocol.Instance);

            this.server = new ConnectionBuffer (connections.Item2);
            this.client = connections.Item1;

            context = new MockClientContext (this.client);
            var channels = new ClientChannelManager (context);
            ClientChannelManagerTests.PopulateChannels (channels, server);

            context.Users = new ClientUserHandler (context, new ClientUserManager());
            context.Channels = channels;
            context.CurrentUser = new CurrentUser (context, 1, "Foo", channels.First().ChannelId);

            this.manager = new ClientSourceManager (context);
        }
Exemplo n.º 30
0
        public void ManagerSetup()
        {
            this.provider = new MockConnectionProvider (GablarskiProtocol.Instance);
            this.provider.Start (MessageTypes.All);

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

            this.server = new ConnectionBuffer (cs.Item2);
            this.manager = new ClientChannelManager (new MockClientContext (cs.Item1));
        }
Exemplo n.º 31
0
        public void Setup()
        {
            this.provider = new MockAudioCaptureProvider();
            this.source = AudioSourceTests.GetTestSource();

            var c = new MockConnectionProvider (GablarskiProtocol.Instance).GetClientConnection();

            var client = new MockClientContext (c);
            this.context = client;
            this.sender = new ClientSourceHandler (client, new ClientSourceManager (client));
            this.receiver = (IAudioReceiver)this.sender;
        }
Exemplo n.º 32
0
 public void ManagerTearDown()
 {
     this.manager = null;
     this.provider = null;
 }