Example #1
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var newLocaleIdValue = 1033 + RndService.Int(5);

            if (prop.PropertyType == typeof(int))
            {
                newValue = newLocaleIdValue;
            }
            else if (prop.PropertyType == typeof(int?))
            {
                newValue = RndService.Bool() ? (int?)null : newLocaleIdValue;
            }
            else if (prop.PropertyType == typeof(uint))
            {
                newValue = (uint)newLocaleIdValue;
            }
            else if (prop.PropertyType == typeof(uint?))
            {
                newValue = (uint?)(RndService.Bool() ? (uint?)null : (uint?)newLocaleIdValue);
            }

            return(newValue);
        }
Example #2
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInPublishingPageLayoutNames.ArticleLeft);
            values.Add(BuiltInPublishingPageLayoutNames.ArticleLinks);
            values.Add(BuiltInPublishingPageLayoutNames.ArticleRight);
            values.Add(BuiltInPublishingPageLayoutNames.BlankWebPartPage);
            values.Add(BuiltInPublishingPageLayoutNames.CatalogArticle);
            values.Add(BuiltInPublishingPageLayoutNames.CatalogWelcome);
            values.Add(BuiltInPublishingPageLayoutNames.EnterpriseWiki);

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            if (prop.PropertyType == typeof(Collection <string>))
            {
                newValue = RndService.RandomCollectionFromArray(values);
            }

            return(newValue);
        }
Example #3
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var typedAttr = attr as ExpectUpdateAsIntRange;

            var minValue = typedAttr.MinValue;
            var maxValue = typedAttr.MaxValue;

            var tmpValue = minValue + RndService.Int(maxValue - minValue);

            if (prop.PropertyType == typeof(double?) ||
                prop.PropertyType == typeof(double))
            {
                newValue = Convert.ToDouble(tmpValue);
            }
            else if (prop.PropertyType == typeof(UInt16?) ||
                     prop.PropertyType == typeof(UInt16))
            {
                newValue = Convert.ToUInt16(tmpValue);
            }
            else
            {
                // TODO, as per case
                newValue = tmpValue;
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInTargetControlType.ContentWebParts);
            values.Add(BuiltInTargetControlType.Custom);
            values.Add(BuiltInTargetControlType.Refinement);
            values.Add(BuiltInTargetControlType.SearchBox);
            values.Add(BuiltInTargetControlType.SearchHoverPanel);
            values.Add(BuiltInTargetControlType.SearchResults);

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            if (prop.PropertyType == typeof(List <string>))
            {
                newValue = RndService.RandomArrayFromArray(values).ToList();
            }

            return(newValue);
        }
Example #5
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInBasePermissions.AddAndCustomizePages);
            values.Add(BuiltInBasePermissions.AnonymousSearchAccessWebLists);
            values.Add(BuiltInBasePermissions.ApproveItems);
            values.Add(BuiltInBasePermissions.CancelCheckout);
            values.Add(BuiltInBasePermissions.CreateSSCSite);
            values.Add(BuiltInBasePermissions.EditMyUserInfo);

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            if (prop.PropertyType == typeof(Collection <string>))
            {
                newValue = RndService.RandomCollectionFromArray(values);
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add("4");
            values.Add("15");

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            if (prop.PropertyType == typeof(Collection <string>))
            {
                newValue = RndService.RandomCollectionFromArray(values);;
            }

            if (prop.PropertyType == typeof(List <string>))
            {
                newValue = RndService.RandomListFromArray(values);
            }

            return(newValue);
        }
Example #7
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            newValue = string.Format("<View BaseViewID='{0}'/>", RndService.Int(100) + 1);

            return(newValue);
        }
Example #8
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            newValue = string.Format("=ID*{0}", RndService.Int(100));

            return(newValue);
        }
Example #9
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            newValue = string.Empty;

            return(newValue);
        }
        private static object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            var targetServices = ExpectUpdateServices.FirstOrDefault(s => s.TargetType == attr.GetType());

            if (targetServices == null)
            {
                throw new SPMeta2NotImplementedException(string.Format("Can't find ExpectUpdateValueServiceBase impl for type: [{0}]", attr.GetType()));
            }

            return(targetServices.GetNewPropValue(attr, obj, prop));
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInChoiceFormatType.Dropdown);
            values.Add(BuiltInChoiceFormatType.RadioButtons);

            return(newValue);
        }
Example #12
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            newValue =
                string.Format(
                    "<Where><Eq><FieldRef Name=\"Title\" /><Value Type=\"Text\">{0}</Value></Eq></Where>",
                    RndService.String());

            return(newValue);
        }
Example #13
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInInternalFieldNames.ID);
            values.Add(BuiltInInternalFieldNames.Title);

            newValue = RndService.RandomFromArray(values);

            return(newValue);
        }
Example #14
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInDeveloperDashboardLevel.Off);
            values.Add(BuiltInDeveloperDashboardLevel.On);
            values.Add(BuiltInDeveloperDashboardLevel.OnDemand);

            newValue = RndService.RandomFromArray(values);

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var typedAttr     = attr as ExpectUpdateAsFileName;
            var fileExtension = typedAttr.Extension;

            if (!fileExtension.StartsWith("."))
            {
                fileExtension = "." + fileExtension;
            }

            newValue = string.Format("{0}{1}", RndService.String(), fileExtension);

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var list = new List <string>(new[]
            {
                BuiltInViewScope.Default,
                BuiltInViewScope.FilesOnly,
                BuiltInViewScope.Recursive,
                BuiltInViewScope.RecursiveAll
            });

            newValue = RndService.RandomFromArray(list);

            return(newValue);
        }
        private static object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            var expectUpdateServices = new List <ExpectUpdateValueServiceBase>();

            expectUpdateServices.AddRange(ReflectionUtils.GetTypesFromAssembly <ExpectUpdateValueServiceBase>(typeof(ExpectUpdateValueServiceBase).Assembly)
                                          .Select(t => Activator.CreateInstance(t) as ExpectUpdateValueServiceBase));

            var targetServices = expectUpdateServices.FirstOrDefault(s => s.TargetType == attr.GetType());

            if (targetServices == null)
            {
                throw new SPMeta2NotImplementedException(string.Format("Can't find ExpectUpdateValueServiceBase impl for type: [{0}]", attr.GetType()));
            }

            return(targetServices.GetNewPropValue(attr, obj, prop));
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInPartChromeState.Minimized);
            values.Add(BuiltInPartChromeState.Normal);

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var curentValue = prop.GetValue(obj) as string;

            if (curentValue == BuiltInDateTimeFieldFormatType.DateOnly)
            {
                newValue = BuiltInDateTimeFieldFormatType.DateTime;
            }
            else
            {
                newValue = BuiltInDateTimeFieldFormatType.DateOnly;
            }

            return(newValue);
        }
Example #20
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var curentValue = prop.GetValue(obj) as string;

            if (curentValue == BuiltInFieldUserSelectionMode.PeopleAndGroups)
            {
                newValue = BuiltInFieldUserSelectionMode.PeopleOnly;
            }
            else
            {
                newValue = BuiltInFieldUserSelectionMode.PeopleAndGroups;
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            if (prop.PropertyType == typeof(int?) ||
                prop.PropertyType == typeof(int?))
            {
                newValue = Convert.ToInt32(RndService.Byte().ToString());
            }
            else
            {
                // TODO, as per case
                newValue = RndService.Byte();
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var curentValue = prop.GetValue(obj) as string;

            if (curentValue == BuiltInFieldTypes.Number)
            {
                newValue = BuiltInFieldTypes.Text;
            }
            else
            {
                newValue = BuiltInFieldTypes.Number;
            }

            return(newValue);
        }
Example #23
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var curentValue = prop.GetValue(obj) as string;

            if (curentValue == BuiltInUrlFieldFormatType.Hyperlink)
            {
                newValue = BuiltInUrlFieldFormatType.Image;
            }
            else
            {
                newValue = BuiltInUrlFieldFormatType.Hyperlink;
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>
            {
                "Override",
                "Standalone"
            };

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            var curentValue = prop.GetValue(obj) as string;

            var values = new List <string>();

            values.Add(BuiltInRichTextMode.Compatible);
            values.Add(BuiltInRichTextMode.FullHtml);
            values.Add(BuiltInRichTextMode.HtmlAsXml);
            //values.Add(BuiltInRichTextMode.ThemeHtml);

            if (!string.IsNullOrEmpty(curentValue))
            {
                values.Remove(curentValue);
            }

            return(RndService.RandomFromArray(values));
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var value  = prop.GetValue(obj) as string;
            var values = new List <string>(new[]
            {
                //BuiltInToolbarType.Freeform,
                BuiltInToolbarType.None,
                BuiltInToolbarType.Standard,
            });

            values.Remove(value);

            newValue = RndService.RandomFromArray(values);

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInNumberFormatTypes.Automatic);

            values.Add(BuiltInNumberFormatTypes.FiveDecimals);
            values.Add(BuiltInNumberFormatTypes.FourDecimals);
            values.Add(BuiltInNumberFormatTypes.ThreeDecimals);
            values.Add(BuiltInNumberFormatTypes.TwoDecimals);
            values.Add(BuiltInNumberFormatTypes.OneDecimal);
            values.Add(BuiltInNumberFormatTypes.NoDecimal);

            newValue = RndService.RandomFromArray(values);

            return(newValue);
        }
Example #28
0
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInCalendarType.Gregorian);
            values.Add(BuiltInCalendarType.Korea);
            values.Add(BuiltInCalendarType.Hebrew);
            values.Add(BuiltInCalendarType.GregorianArabic);
            values.Add(BuiltInCalendarType.SakaEra);

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <string>();

            values.Add(BuiltInPartChromeType.BorderOnly);
            values.Add(BuiltInPartChromeType.Default);
            values.Add(BuiltInPartChromeType.None);
            values.Add(BuiltInPartChromeType.TitleAndBorder);
            values.Add(BuiltInPartChromeType.TitleOnly);

            if (prop.PropertyType == typeof(string))
            {
                newValue = RndService.RandomFromArray(values);
            }

            return(newValue);
        }
        public override object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop)
        {
            object newValue = null;

            var values = new List <int>();

            values.Add(BuiltInWebpartPageTemplateId.spstd1);
            values.Add(BuiltInWebpartPageTemplateId.spstd2);
            values.Add(BuiltInWebpartPageTemplateId.spstd3);
            values.Add(BuiltInWebpartPageTemplateId.spstd4);
            values.Add(BuiltInWebpartPageTemplateId.spstd5);
            values.Add(BuiltInWebpartPageTemplateId.spstd6);
            values.Add(BuiltInWebpartPageTemplateId.spstd7);

            if (prop.PropertyType == typeof(int))
            {
                newValue = RndService.RandomFromArray(values);
            }

            return(newValue);
        }
 public abstract object GetNewPropValue(ExpectUpdate attr, object obj, PropertyInfo prop);