Esempio n. 1
0
 public static ITableRow NewRandomRow(this ITableContent content, Authentication authentication)
 {
     if (content.Parent != null)
     {
         var parentRow = content.Parent.Random();
         if (parentRow == null)
         {
             return(null);
         }
         return(content.AddNew(authentication, parentRow.RelationID));
     }
     return(content.AddNew(authentication, null));
 }
Esempio n. 2
0
        private ITableRow AddNewRow(Authentication authentication, ITableContent content)
        {
            var parent = content.Parent;

            if (parent != null)
            {
                if (parent.Any() == false)
                {
                    return(null);
                }
                var relationID = parent.Random().RelationID;
                return(content.AddNew(authentication, relationID));
            }
            return(content.AddNew(authentication, null));
        }
Esempio n. 3
0
        public static void CreateRow(this ITableContent content, Authentication authentication)
        {
            var    table      = content.Table;
            var    parent     = content.Parent;
            string relationID = null;

            if (parent != null && parent.Any() == true)
            {
                relationID = parent.Random().RelationID;
            }

            var row = content.AddNew(authentication, relationID);

            var types = table.GetService(typeof(ITypeCollection)) as ITypeCollection;

            foreach (var item in table.TableInfo.Columns)
            {
                if (item.AutoIncrement == false)
                {
                    //row.SetField(authentication, item.Name, TypeContextExtensions.GetRandomValue(types, item));
                }
            }

            if (RandomUtility.Within(25) == true)
            {
                row.SetTags(authentication, tags.Random());
            }

            if (RandomUtility.Within(25) == true)
            {
                row.SetIsEnabled(authentication, RandomUtility.NextBoolean());
            }

            content.EndNew(authentication, row);
        }
Esempio n. 4
0
        public static ITableRow AddRandomRow(this ITableContent content, Authentication authentication)
        {
            var row = content.AddNew(authentication, null);

            row.InitializeRandom(authentication);
            content.EndNew(authentication, row);
            return(row);
        }
Esempio n. 5
0
 public static void ClassInit(TestContext context)
 {
     app = new CremaBootstrapper();
     app.Initialize(context, nameof(ITableContent_Deleted_DispatcherTest));
     cremaHost = app.GetService(typeof(ICremaHost)) as ICremaHost;
     cremaHost.Dispatcher.Invoke(() =>
     {
         authentication = cremaHost.Start();
         dataBase       = cremaHost.DataBases.Random();
         dataBase.Load(authentication);
         dataBase.Enter(authentication);
         dataBase.Initialize(authentication);
         content = dataBase.TableContext.Tables.Random(item => item.Parent == null).Content;
         content.BeginEdit(authentication);
         content.EnterEdit(authentication);
         row = content.AddNew(authentication, null);
         dataBase.Leave(authentication);
         dataBase.Unload(authentication);
     });
 }
Esempio n. 6
0
 public void AddNew()
 {
     content.AddNew(authentication, null);
 }