public void TestThrowActorMethodInvocationException()
        {
            // Create Remote Actor Method test Exception
            var message      = "Remote Actor encountered an exception";
            var innerMessage = "Bad time zone";
            var exception    = new InvalidOperationException(message, new InvalidTimeZoneException(innerMessage));

            // Create Serialized Exception
            var serializedException = ActorInvokeException.FromException(exception);

            // De Serialize Exception
            var isDeserialzied = ActorInvokeException.ToException(
                new MemoryStream(serializedException),
                out var remoteMethodException);

            isDeserialzied.Should().BeTrue();
            var ex = this.ThrowRemoteException(message, remoteMethodException);

            ex.Should().BeOfType <ActorMethodInvocationException>();
            ex.InnerException.Should().BeOfType <ActorInvokeException>();
            ((ActorInvokeException)ex.InnerException).ActualExceptionType.Should().Be("System.InvalidOperationException");
            ex.InnerException.InnerException.Should().BeNull();
            ex.Message.Should().Be(message);
            ex.InnerException.Message.Should().Be(message);
        }
        private static Tuple <string, byte[]> CreateExceptionResponseMessage(Exception ex)
        {
            var responseHeader = new ActorResponseMessageHeader();

            responseHeader.AddHeader("HasRemoteException", Array.Empty <byte>());
            var headerSerializer    = new ActorMessageHeaderSerializer();
            var responseHeaderBytes = headerSerializer.SerializeResponseHeader(responseHeader);
            var serializedHeader    = Encoding.UTF8.GetString(responseHeaderBytes, 0, responseHeaderBytes.Length);

            var responseMsgBody = ActorInvokeException.FromException(ex);

            return(new Tuple <string, byte[]>(serializedHeader, responseMsgBody));
        }