Exemplo n.º 1
0
        public void TestCrud()
        {
            Account        acct = new Account();
            AccountPicture pic  = new AccountPicture();

            try
            {
                acct.Created  = acct.LastLogin = acct.Modified = DateTime.UtcNow;
                acct.Name     = "Test User";
                acct.Password = "******";
                acct.Birthday = new DateTime(1976, 9, 7);

                pic.Account = acct;
                byte[] myBytes = { 0x01, 0x02, 0x03 };
                pic.Bitmap      = myBytes;
                pic.Name        = "Name";
                pic.Description = "Description";
                pic.Created     = pic.Modified = DateTime.UtcNow;

                if (acct.AccountPictures == null)
                {
                    acct.AccountPictures = new List <AccountPicture>();
                }
                acct.AccountPictures.Add(pic);

                Session.Save(acct);
                Session.Save(pic);
                Session.Flush();

                Assert.IsTrue(pic.Id > 0);
                Assert.IsTrue(acct.Id > 0);
            }
            finally
            {
                Session.Delete(acct);
            }
            Session.Flush();
        }
Exemplo n.º 2
0
        public void TestCrud()
        {
            Account acct = new Account();
            AccountPicture pic = new AccountPicture();

            try
            {
                acct.Created = acct.LastLogin = acct.Modified = DateTime.UtcNow;
                acct.Name = "Test User";
                acct.Password = "******";
                acct.Birthday = new DateTime(1976, 9, 7);

                pic.Account = acct;
                byte[] myBytes = { 0x01, 0x02, 0x03 };
                pic.Bitmap = myBytes;
                pic.Name = "Name";
                pic.Description = "Description";
                pic.Created = pic.Modified = DateTime.UtcNow;

                if (acct.AccountPictures == null) acct.AccountPictures = new List<AccountPicture>();
                acct.AccountPictures.Add(pic);

                Session.Save(acct);
                Session.Save(pic);
                Session.Flush();

                Assert.IsTrue(pic.Id > 0);
                Assert.IsTrue(acct.Id > 0);

            }
            finally
            {
                Session.Delete(acct);
            }
            Session.Flush();
        }
Exemplo n.º 3
0
 public static ACL GetACL(ISession session, AccountPicture instance, Type type) { return new ManagedAccountPicture(session, instance).GetACL(type); }
Exemplo n.º 4
0
 public static string GetObjectName(AccountPicture instance, int id) { return string.Format("Profile Pictures: {0}", instance.Name); }
Exemplo n.º 5
0
 public static int GetOwnerId(AccountPicture instance, int id) { return instance.Account.Id; }
Exemplo n.º 6
0
 public static ACL GetACL(ISession session, AccountPicture instance, Type type)
 {
     return(new ManagedAccountPicture(session, instance).GetACL(type));
 }
Exemplo n.º 7
0
 public static string GetObjectName(AccountPicture instance, int id)
 {
     return(string.Format("Profile Pictures: {0}", instance.Name));
 }
Exemplo n.º 8
0
 public static int GetOwnerId(AccountPicture instance, int id)
 {
     return(instance.Account.Id);
 }