internal static T SerializeDeserializeTest <T>(T message) where T : ServiceMessage { var messageBytes = message.GetBytes(); var dm = ServiceMessageFactory.GetServiceMessage(messageBytes, 0); dm.Should().BeOfType <T>(); dm.Should().BeEquivalentTo(message); return((T)dm); }