Exemple #1
0
 private void CheckTitleCase(PropertyNameFormatter formatter)
 {
     Assert.That(formatter.Format("SomeCoolProperty"), Is.EqualTo("Some Cool Property"));
     Assert.That(formatter.Format("someCoolProperty"), Is.EqualTo("Some Cool Property"));
     Assert.That(formatter.Format("prop"), Is.EqualTo("Prop"));
     Assert.That(formatter.Format("PropP"), Is.EqualTo("Prop P"));
     Assert.That(formatter.Format("Some Cool Property"), Is.EqualTo("Some Cool Property"));
 }
Exemple #2
0
        public void Format_DefaultConfig_PropertyNameNotChanged()
        {
            CheckDefault(_defaultFormatter);

            MixpanelConfig.Global.MixpanelPropertyNameFormat = MixpanelPropertyNameFormat.SentenceCase;
            var formatter = new PropertyNameFormatter(new MixpanelConfig());

            CheckDefault(formatter);
        }
Exemple #3
0
        public void Format_TitleCaseConfig_PropertyNameChanged()
        {
            MixpanelConfig.Global.MixpanelPropertyNameFormat = MixpanelPropertyNameFormat.TitleCase;
            CheckTitleCase(_defaultFormatter);

            MixpanelConfig.Global.MixpanelPropertyNameFormat = MixpanelPropertyNameFormat.None;
            var formatter = new PropertyNameFormatter(
                new MixpanelConfig {
                MixpanelPropertyNameFormat = MixpanelPropertyNameFormat.TitleCase
            });

            CheckTitleCase(formatter);
        }
Exemple #4
0
        private void ProcessObjectProperty(ObjectProperty objectProperty)
        {
            string specialProperty = mapRawNameToSpecialPropertyFn(objectProperty.PropertyName);

            if (specialProperty != null)
            {
                SpecialProperties[specialProperty] = objectProperty;
            }
            else
            {
                string formattedPropertyName = PropertyNameFormatter.Format(objectProperty, config);
                UserProperties[formattedPropertyName] = objectProperty;
            }
        }
        public MessageData(
            IDictionary <string, string> specialPropsBindings,
            IDictionary <string, string> distinctIdPropsBindings,
            MessagePropetiesRules messagePropetiesRules,
            SuperPropertiesRules superPropertiesRules,
            MixpanelConfig config = null)
        {
            _specialPropsBindings    = specialPropsBindings ?? new Dictionary <string, string>();
            _distinctIdPropsBindings = distinctIdPropsBindings ?? new Dictionary <string, string>();
            _messagePropetiesRules   = messagePropetiesRules;
            _superPropertiesRules    = superPropertiesRules;
            _valueParser             = new ValueParser();
            _nameFormatter           = new PropertyNameFormatter(config);
            _propertiesDigger        = new PropertiesDigger();

            SpecialProps = new Dictionary <string, object>();
            Props        = new Dictionary <string, object>();
        }
        public MessageData(
            IDictionary<string, string> specialPropsBindings,
            IDictionary<string, string> distinctIdPropsBindings,
            MessagePropetiesRules messagePropetiesRules,
            SuperPropertiesRules superPropertiesRules,
            MixpanelConfig config = null)
        {
            _specialPropsBindings = specialPropsBindings ?? new Dictionary<string, string>();
            _distinctIdPropsBindings = distinctIdPropsBindings ?? new Dictionary<string, string>();
            _messagePropetiesRules = messagePropetiesRules;
            _superPropertiesRules = superPropertiesRules;
            _valueParser = new ValueParser();
            _nameFormatter = new PropertyNameFormatter(config);
            _propertiesDigger = new PropertiesDigger();

            SpecialProps = new Dictionary<string, object>();
            Props = new Dictionary<string, object>();
        }
Exemple #7
0
 private void CheckDefault(PropertyNameFormatter formatter)
 {
     Assert.That(formatter.Format("SomeCoolProperty"), Is.EqualTo("SomeCoolProperty"));
     Assert.That(formatter.Format("someCoolProperty"), Is.EqualTo("someCoolProperty"));
 }
Exemple #8
0
 public void SetUp()
 {
     MixpanelConfig.Global.Reset();
     _defaultFormatter = new PropertyNameFormatter();
 }
 protected MessageBuilderBase(MixpanelConfig config = null)
 {
     Config = config;
     ValueParser = new ValueParser();
     PropertyNameFormatter = new PropertyNameFormatter(config);
 }