public void CreateTopicMessage_WithTopicEvent_SecondFrameIsSerializedData() { // Arrange var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory); // Act var message = messageFactory.CreateTopicMessage(obj); // Assert Assert.That(message[1].ToByteArray(), Is.EqualTo(data)); }
public void CreateTopicMessage_WithTopicEvent_FirstFrameIsFullName() { // Arrange var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory); // Act var message = messageFactory.CreateTopicMessage(obj); // Assert Assert.That(message[0].ConvertToString(), Is.EqualTo(obj.GetType().FullName)); }
public void CreateTopicMessage_WithTopicEvent_MessageHasTwoFrames() { // Arrange var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory); // Act var message = messageFactory.CreateTopicMessage(obj); // Assert Assert.That(message.FrameCount, Is.EqualTo(2)); }
public void CreateTopicMessage_WithTopicEvent_SerializesPackage() { // Arrange var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory); // Act var message = messageFactory.CreateTopicMessage(obj); // Assert mockSerializer.Verify(m => m.Serialize(It.IsIn <Package>(package)), Times.Once); }
public void CreateTopicMessage_WithTopicEvent_PacksInPackage() { // Arrange var messageFactory = new NetMQMessageFactory(serializerCache, packageFactory); // Act var message = messageFactory.CreateTopicMessage(obj); // Assert mockPackageFactory.Verify(m => m.Pack(It.IsIn <object>(obj)), Times.Once); }
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); }
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); }
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)); }