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

            // Act
            var topicEvent = messageFactory.ExtractTopic(message);

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

            // Act
            var topicEvent = messageFactory.ExtractTopic(message);

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

            // Act
            var topicEvent = messageFactory.ExtractTopic(message);

            // Assert
            Assert.That(topicEvent, Is.EqualTo(obj));
        }