Beispiel #1
0
        private MixpanelMessageTest TestMessage(Func <MessageBuildResult> messageBuildResultFn)
        {
            var testMessage = new MixpanelMessageTest();

            try
            {
                MessageBuildResult messageBuildResult = messageBuildResultFn();
                if (!messageBuildResult.Success)
                {
                    throw new Exception(messageBuildResult.Error);
                }

                testMessage.Data   = messageBuildResult.Message;
                testMessage.Json   = ToJson(testMessage.Data);
                testMessage.Base64 = ToBase64(testMessage.Json);
            }
            catch (Exception e)
            {
                testMessage.Exception = e;
                return(testMessage);
            }

            return(testMessage);
        }
        private MixpanelMessageTest TestMessage(Func<IDictionary<string, object>> getMessageDataFn)
        {
            var testMessage = new MixpanelMessageTest();

            try
            {
                testMessage.Data = getMessageDataFn();
                testMessage.Json = ToJson(testMessage.Data);
                testMessage.Base64 = ToBase64(testMessage.Json);
            }
            catch (Exception e)
            {
                testMessage.Exception = e;
                return testMessage;
            }

            return testMessage;
        }
        private MixpanelMessageTest TestMessage(Func<IDictionary<string, object>> getMessageDataFn)
        {
            var res = new MixpanelMessageTest();

            try
            {
                res.Data = getMessageDataFn();
            }
            catch (Exception e)
            {
                res.Exception = e;
                return res;
            }

            try
            {
                res.Json = ToJson(res.Data);
            }
            catch (Exception e)
            {
                res.Exception = e;
                return res;
            }

            try
            {
                res.Base64 = ToBase64(res.Json);
            }
            catch (Exception e)
            {
                res.Exception = e;
                return res;
            }

            return res;
        }