예제 #1
0
        private void AssertParseMixpanelFormatSuccess(object timeToParse, string expectedTime)
        {
            ValueParseResult parseResult = TimeParser.ParseMixpanelFormat(timeToParse);

            Assert.That(parseResult.Success, Is.True);
            Assert.That(parseResult.Value, Is.EqualTo(expectedTime));
        }
예제 #2
0
        public static MessageBuildResult Build(
            string token,
            IEnumerable <ObjectProperty> superProperties,
            decimal amount,
            DateTime time,
            object distinctId,
            MixpanelConfig config)
        {
            MessageBuildResult messageBuildResult = PeopleMessageBuilderBase.CreateMessage(
                token,
                superProperties,
                null,
                distinctId,
                config,
                "$append",
                rawValue => throw new InvalidOperationException());

            if (!messageBuildResult.Success)
            {
                return(messageBuildResult);
            }

            messageBuildResult.Message["$append"] = new Dictionary <string, object>(1)
            {
                {
                    "$transactions", new Dictionary <string, object>(2)
                    {
                        { "$time", TimeParser.ParseMixpanelFormat(time).Value },
                        { "$amount", amount }
                    }
                }
            };

            return(messageBuildResult);
        }
예제 #3
0
        private void AssertParseMixpanelFormatFail(object timeToParse)
        {
            ValueParseResult parseResult = TimeParser.ParseMixpanelFormat(timeToParse);

            Assert.That(parseResult.Success, Is.False);
            Assert.That(parseResult.Value, Is.Null);
            Assert.That(parseResult.ErrorDetails, Is.Not.Empty);
        }