public void ShouldReadPromiseId()
        {
            var writer = new NetworkOperationWriter(_map, _serializer, _transport);

            var promise = new OperationPromise <TestResponse>(0, new TestOperationWithResponse());

            writer.WriteOperationWithResponse(promise);

            var reader    = new NetworkOperationReader(_map, _serializer);
            var promiseId = reader.ReadPromiseId(_transport.SentOperations.Single().Item2);

            promiseId.ShouldBe(promise.Id);
        }
        public void ShouldWriteOperationWithResponse()
        {
            var writer = new NetworkOperationWriter(_map, new SerializationService(new BinarySerializer()), _transport);

            var promise = new OperationPromise <TestResponse>(0, new TestOperationWithResponse());

            writer.WriteOperationWithResponse(promise);

            var sentOperation = _transport.SentOperations.SingleOrDefault();

            sentOperation.ShouldNotBeNull();

            sentOperation.Item1.ShouldBe(OperationCode.HandleOperationWithResponse);

            sentOperation.Item2.ShouldContainKeyAndValue((byte)OperationParameterCode.OperationId, _map.GetMappedOperation(typeof(TestOperationWithResponse)).Id);
            sentOperation.Item2.ShouldContainKeyAndValue((byte)OperationParameterCode.OperationPromiseId, promise.Id);

            sentOperation.Item2.ShouldContainKey((byte)OperationParameterCode.OperationData);
        }