Пример #1
0
        public void CreateResponseMessage_WithResponse_FifthFrameIsSerializedData()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);

            // Act
            var message = messageFactory.CreateResponseMessage(obj, address, requestId, dotNetSerializer.Descriptor.InvariantName);

            // Assert
            Assert.That(message[4].ToByteArray(), Is.EqualTo(data));
        }
Пример #2
0
        public void CreateResponseMessage_WithResponse_ForthFrameEmpty()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);

            // Act
            var message = messageFactory.CreateResponseMessage(obj, address, requestId, dotNetSerializer.Descriptor.InvariantName);

            // Assert
            Assert.That(message[3], Is.EqualTo(NetMQFrame.Empty));
        }
Пример #3
0
        public void CreateResponse_WithResponse_HasFiveFrames()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);

            // Act
            var message = messageFactory.CreateResponseMessage(obj, address, requestId, dotNetSerializer.Descriptor.InvariantName);

            // Assert
            Assert.That(message.FrameCount, Is.EqualTo(5));
        }
Пример #4
0
        public void CreateResponseMessage_WithResponse_ThirdFrameIsRequestId()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);

            // Act
            var message = messageFactory.CreateResponseMessage(obj, address, requestId, dotNetSerializer.Descriptor.InvariantName);

            // Assert
            Assert.That(message[2].ConvertToInt32(), Is.EqualTo(requestId));
        }
Пример #5
0
        public void CreateResponse_WithResponse_SerializesPackage()
        {
            // Arrange
            var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory);

            // Act
            var message = messageFactory.CreateResponseMessage(obj, address, requestId, dotNetSerializer.Descriptor.InvariantName);

            // Assert
            mockSerializer.Verify(m => m.Serialize(It.IsIn <Package>(package)), Times.Once);
        }