Inheritance: Tempest.TempestClient, IGablarskiClientContext
Beispiel #1
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;
        }
        public void ApproveRegistration()
        {
            userProvider.UpdateSupported = true;
            userProvider.RegistrationMode = UserRegistrationMode.Approved;
            context = new MockClientContext (this.client) { ServerInfo = new ServerInfo (new ServerSettings(), userProvider) };
            this.handler = new ClientUserHandler (context, this.userManager);

            this.handler.ApproveRegistration ("username");

            var msg = this.server.DequeueAndAssertMessage<RegistrationApprovalMessage>();
            Assert.AreEqual ("username", msg.Username);
        }
Beispiel #3
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;
        }
Beispiel #4
0
        public void ApproveRegistration()
        {
            userProvider.UpdateSupported  = true;
            userProvider.RegistrationMode = UserRegistrationMode.Approved;
            context = new MockClientContext(this.client)
            {
                ServerInfo = new ServerInfo(new ServerSettings(), userProvider)
            };
            this.handler = new ClientUserHandler(context, this.userManager);

            this.handler.ApproveRegistration("username");

            var msg = this.server.DequeueAndAssertMessage <RegistrationApprovalMessage>();

            Assert.AreEqual("username", msg.Username);
        }
Beispiel #5
0
        public void ApproveRegistrationUnsupported()
        {
            userProvider.UpdateSupported  = false;
            userProvider.RegistrationMode = UserRegistrationMode.None;
            context = new MockClientContext(this.client)
            {
                ServerInfo = new ServerInfo(new ServerSettings(), userProvider)
            };
            this.handler = new ClientUserHandler(context, this.userManager);

            CreateUsers(this.client, this.handler);

            var user = this.handler.First();

            Assert.Throws <NotSupportedException>(() => this.handler.ApproveRegistration(user));
        }
Beispiel #6
0
        public void PreApproveRegistration()
        {
            userProvider.UpdateSupported  = true;
            userProvider.RegistrationMode = UserRegistrationMode.PreApproved;
            context = new MockClientContext(this.client)
            {
                ServerInfo = new ServerInfo(new ServerSettings(), userProvider)
            };
            this.handler = new ClientUserHandler(context, this.userManager);

            CreateUsers(this.client, this.handler);

            var user   = this.handler.First();
            int userId = user.UserId;

            this.handler.ApproveRegistration(user);

            var msg = this.server.DequeueAndAssertMessage <RegistrationApprovalMessage>();

            Assert.AreEqual(userId, msg.UserId);
        }
Beispiel #7
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);
        }
Beispiel #8
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;
        }
        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);
        }
        public void ApproveRegistrationUnsupported()
        {
            userProvider.UpdateSupported = false;
            userProvider.RegistrationMode = UserRegistrationMode.None;
            context = new MockClientContext (this.client) { ServerInfo = new ServerInfo (new ServerSettings(), userProvider) };
            this.handler = new ClientUserHandler (context, this.userManager);

            CreateUsers (this.client, this.handler);

            var user = this.handler.First();

            Assert.Throws<NotSupportedException>(() => this.handler.ApproveRegistration (user));
        }
        public void PreApproveRegistration()
        {
            userProvider.UpdateSupported = true;
            userProvider.RegistrationMode = UserRegistrationMode.PreApproved;
            context = new MockClientContext (this.client) { ServerInfo = new ServerInfo (new ServerSettings(), userProvider) };
            this.handler = new ClientUserHandler (context, this.userManager);

            CreateUsers (this.client, this.handler);

            var user = this.handler.First();
            int userId = user.UserId;

            this.handler.ApproveRegistration (user);

            var msg = this.server.DequeueAndAssertMessage<RegistrationApprovalMessage>();
            Assert.AreEqual (userId, msg.UserId);
        }
 public void ManagerTearDown()
 {
     this.userProvider = null;
     this.server = null;
     this.handler = null;
     this.userManager = null;
     this.provider = null;
     this.context = null;
 }
        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;
        }