Exemplo n.º 1
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.º 2
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.º 3
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 }
            });
        }