Esempio n. 1
0
        public static BenchmarkObject2 <TLocalizedType> GetRandomObject(int numberOfChildren)
        {
            var obj = new BenchmarkObject2 <TLocalizedType>();


            obj.Id = RandomString(10);

            obj.Children = new List <BenchmarkObject2 <TLocalizedType> >();
            for (int i = 0; i < numberOfChildren; i++)
            {
                obj.Children.Add(GetRandomObject(numberOfChildren - 1));
            }

            obj.DisplayName = new TLocalizedType {
                { "en-US", RandomString(20) }, { "en-CA", RandomString(20) }, { "fr-CA", RandomString(20) }
            };
            obj.DefinitionName = RandomString(256);
            obj.Description    = new TLocalizedType {
                { "en-US", RandomString(20) }, { "en-CA", RandomString(50) }, { "fr-CA", RandomString(20) }
            };
            obj.Created        = DateTime.UtcNow;
            obj.CreatedBy      = RandomString(10);
            obj.LastModified   = DateTime.UtcNow;
            obj.LastModifiedBy = RandomString(10);
            obj.Active         = true;
            obj.CatalogId      = RandomString(10);
            obj.PrimaryId      = RandomString(10);
            obj.Ints           = Enumerable.Range(0, 200).ToList();

            return(obj);
        }
Esempio n. 2
0
        protected static void InitializeObject(BenchmarkObject <TBagType, TLocalizedType> obj)
        {
            obj.Id          = Guid.NewGuid();
            obj.Text1       = RandomString(20);
            obj.Text2       = null;
            obj.Text3       = RandomString(10);
            obj.Description = RandomString(256);
            obj.Price1      = Decimal.MaxValue;
            obj.Price2      = null;
            obj.Price3      = 654M;
            obj.Price4      = Decimal.MinValue;
            obj.Date1       = DateTime.UtcNow;
            obj.Date2       = null;
            obj.Date3       = DateTime.UtcNow;

            obj.Bag = new TBagType();
            obj.Bag.Add("abcdefg", 128323.23M);
            obj.Bag.Add("abcdefgh", new TLocalizedType {
                { "en-US", RandomString(15) }, { "en-CA", RandomString(15) }, { "fr-CA", RandomString(15) }
            });
            obj.Bag.Add("abcdefghi", "alksjdfklasjdf;lakjsd");
            obj.Bag.Add("abcdef", DateTime.UtcNow);
            obj.Bag.Add("abcde", 19278);
            obj.Bag.Add("abcd", 2984L);

            obj.Localized = new TLocalizedType {
                { "en-US", RandomString(15) }, { "en-CA", RandomString(15) }, { "fr-CA", RandomString(15) }
            };

            obj.ParentObjects = new List <BenchmarkObject2 <TLocalizedType> >();
            for (int i = 0; i < 4; i++)
            {
                obj.ParentObjects.Add(BenchmarkObject2 <TLocalizedType> .GetRandomObject(i));
            }

            var list = new List <BenchmarkObject2 <TLocalizedType> >();

            for (int i = 0; i < 1; i++)
            {
                list.Add(BenchmarkObject2 <TLocalizedType> .GetRandomObject(i));
            }
            obj.ChildrenObjects = list;
        }