Beispiel #1
0
        public void GlobalSetup()
        {
            switch (HubProtocol)
            {
            case Protocol.MsgPack:
                _hubProtocolReaderWriter = new HubProtocolReaderWriter(new MessagePackHubProtocol(), new PassThroughEncoder());
                break;

            case Protocol.Json:
                _hubProtocolReaderWriter = new HubProtocolReaderWriter(new JsonHubProtocol(), new PassThroughEncoder());
                break;
            }

            switch (Input)
            {
            case Message.NoArguments:
                _hubMessage = new InvocationMessage("123", true, "Target", null);
                break;

            case Message.FewArguments:
                _hubMessage = new InvocationMessage("123", true, "Target", null, 1, "Foo", 2.0f);
                break;

            case Message.ManyArguments:
                _hubMessage = new InvocationMessage("123", true, "Target", null, 1, "string", 2.0f, true, (byte)9, new byte[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L);
                break;

            case Message.LargeArguments:
                _hubMessage = new InvocationMessage("123", true, "Target", null, new string('F', 10240), new byte[10240]);
                break;
            }

            _binaryInput = GetBytes(_hubMessage);
            _binder      = new TestBinder(_hubMessage);
        }
Beispiel #2
0
        public void GlobalSetup()
        {
            switch (HubProtocol)
            {
            case Protocol.MsgPack:
                _hubProtocol = new MessagePackHubProtocol();
                break;

            case Protocol.Json:
                _hubProtocol = new JsonHubProtocol();
                break;
            }

            switch (Input)
            {
            case Message.NoArguments:
                _hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null);
                break;

            case Message.FewArguments:
                _hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "Foo", 2.0f);
                break;

            case Message.ManyArguments:
                _hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, 1, "string", 2.0f, true, (byte)9, new byte[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L);
                break;

            case Message.LargeArguments:
                _hubMessage = new InvocationMessage(target: "Target", argumentBindingException: null, new string('F', 10240), new byte[10240]);
                break;
            }

            _binaryInput = _hubProtocol.WriteToArray(_hubMessage);
            _binder      = new TestBinder(_hubMessage);
        }
        public void GlobalSetup()
        {
            switch (HubProtocol)
            {
            case Protocol.MsgPack:
                _hubProtocol = new MessagePackHubProtocol();
                break;

            case Protocol.Json:
                _hubProtocol = new NewtonsoftJsonHubProtocol();
                break;
            }

            switch (Input)
            {
            case Message.NoArguments:
                _hubMessage = new InvocationMessage("Target", Array.Empty <object>());
                break;

            case Message.FewArguments:
                _hubMessage = new InvocationMessage("Target", new object[] { 1, "Foo", 2.0f });
                break;

            case Message.ManyArguments:
                _hubMessage = new InvocationMessage("Target", new object[] { 1, "string", 2.0f, true, (byte)9, new byte[] { 5, 4, 3, 2, 1 }, 'c', 123456789101112L });
                break;

            case Message.LargeArguments:
                _hubMessage = new InvocationMessage("Target", new object[] { new string('F', 10240), new byte[10240] });
                break;
            }

            _binaryInput = _hubProtocol.GetMessageBytes(_hubMessage);
            _binder      = new TestBinder(_hubMessage);
        }