예제 #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));
        }