コード例 #1
0
        public void ExtractRequest_WithMessage_DeserializesPackage()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);
            var message        = messageFactory.CreateRequestMessage(obj, requestId);

            message.Push(address); // NetMQ prepends an address frame

            // Act
            var(request, retAddress, retRequestId, name) = messageFactory.ExtractRequest(message);

            // Assert
            mockSerializer.Verify(m => m.Deserialize <Package>(It.IsIn <byte[]>(data)), Times.Once);
        }
コード例 #2
0
        public void ExtractRequest_WithMessage_UnpacksRequestObject()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);
            var message        = messageFactory.CreateRequestMessage(obj, requestId);

            message.Push(address); // NetMQ prepends an address frame

            // Act
            var(request, retAddress, retRequestId, name) = messageFactory.ExtractRequest(message);

            // Assert
            mockPackageFactory.Verify(m => m.Unpack(It.IsIn <Package>(package)), Times.Once);
        }
コード例 #3
0
        public void ExtractRequest_WithMessage_ReturnsSameAddress()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);
            var message        = messageFactory.CreateRequestMessage(obj, requestId);

            message.Push(address); // NetMQ prepends an address frame

            // Act
            var(request, retAddress, retRequestId, name) = messageFactory.ExtractRequest(message);

            // Assert
            Assert.That(retAddress, Is.EqualTo(address));
        }