private CustomProperties SetProperty(CustomProperty property)
        {
            try
            {
                property.Validate();
            }
            catch (ValidationException e)
            {
                AppCenterLog.Error(AppCenterLog.LogTag, e.Message);
                return(this);
            }
            if (Properties.Count >= MaxCustomPropertiesCount)
            {
                AppCenterLog.Error(AppCenterLog.LogTag, "Custom properties cannot contain more than " + MaxCustomPropertiesCount + " items.");
                return(this);
            }
            CustomProperty existingPropertyToRemove = null;

            foreach (var existingProperty in Properties)
            {
                if (existingProperty.Name == property.Name)
                {
                    existingPropertyToRemove = existingProperty;
                    break;
                }
            }
            if (existingPropertyToRemove != null)
            {
                AppCenterLog.Warn(AppCenterLog.LogTag, "Custom property \"" + property.Name + "\" is already set or cleared and will be overwritten.");
                Properties.Remove(existingPropertyToRemove);
            }
            Properties.Add(property);
            return(this);
        }
        public void MissingValuesPropertyTest()
        {
            CustomProperty prop = new CustomProperty();

            prop.ConfigType = "enum";
            Assert.ThrowsException <InvalidDataException>(() => prop.Validate());
        }
        public void NonEnumValuesPropertyTest()
        {
            CustomProperty prop = new CustomProperty();

            prop.ConfigType = "int";
            prop.Values     = new Dictionary <int, string>
            {
                [1] = "ViewSlide"
            };
            Assert.ThrowsException <InvalidDataException>(() => prop.Validate());
        }