public void CreateAccountFriend() { ManagedAccount a = new ManagedAccount(Session); ManagedAccount b = new ManagedAccount(Session); try { a.Create("Test User 1", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); b.Create("Test User 2", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); b.VerifyAllEmails(); b.AddDefaultPicture(); a.CreateAccountFriendRequest( AdminSecurityContext, b.Id, "Please be my friend!"); } finally { a.Delete(a.GetSecurityContext()); b.Delete(b.GetSecurityContext()); } }
public void CreateAccountStoryPicture() { ManagedAccount a = new ManagedAccount(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); TransitAccountStory s = new TransitAccountStory(); s.Name = GetNewString(); s.Summary = GetNewString(); ManagedAccountStory ms = new ManagedAccountStory(Session); int story_id = ms.CreateOrUpdate(s, a.GetSecurityContext()); TransitAccountStoryPicture p = new TransitAccountStoryPicture(); p.Name = GetNewString(); p.AccountStoryId = story_id; ManagedAccountStoryPicture mp = new ManagedAccountStoryPicture(Session); mp.CreateOrUpdate(p, a.GetSecurityContext()); } finally { a.Delete(AdminSecurityContext); Session.Flush(); } }
public void CreateDiscussionThread() { ManagedAccount a = new ManagedAccount(Session); ManagedDiscussion d = new ManagedDiscussion(Session); ManagedDiscussionPost p = new ManagedDiscussionPost(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); TransitDiscussion t_d = new TransitDiscussion(); t_d.Description = GetNewString(); t_d.Name = GetNewString(); t_d.Personal = false; d.CreateOrUpdate(t_d, a.GetSecurityContext()); TransitDiscussionPost t_p = new TransitDiscussionPost(); t_p.Subject = GetNewString(); t_p.Body = GetNewString(); t_p.DiscussionId = d.Id; p.CreateOrUpdate(t_p, a.GetSecurityContext()); Session.Flush(); } finally { p.Delete(a.GetSecurityContext()); d.Delete(a.GetSecurityContext()); a.Delete(a.GetSecurityContext()); } }
public void CreateDiscussion() { ManagedAccount a = new ManagedAccount(Session); ManagedDiscussion d = new ManagedDiscussion(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); TransitDiscussion t = new TransitDiscussion(); t.Name = GetNewString(); t.Description = GetNewString(); t.AccountId = a.Id; t.Personal = false; t.Created = t.Modified = DateTime.UtcNow; d.CreateOrUpdate(t, a.GetSecurityContext()); Session.Flush(); } finally { d.Delete(a.GetSecurityContext()); a.Delete(a.GetSecurityContext()); } }
public void TestNoVerifiedEmail() { ManagedAccount account = new ManagedAccount(Session); try { string email = GetNewEmailAddress(); TransitAccount t_instance = new TransitAccount(); t_instance.Password = GetNewString(); t_instance.Name = GetNewString(); t_instance.Birthday = DateTime.UtcNow; int account_id = account.Create(email, t_instance, GetSecurityContext()); account.AddDefaultPicture(); TransitDiscussionPost t_post = GetTransitInstance(); t_post.AccountId = account.Id; ManagedDiscussionPost m_post = new ManagedDiscussionPost(Session); m_post.CreateOrUpdate(t_post, account.GetSecurityContext()); } finally { account.Delete(GetSecurityContext()); } }
public void CreateDiscussionThreadInvalidChild() { ManagedAccount a = new ManagedAccount(Session); ManagedDiscussion d1 = new ManagedDiscussion(Session); ManagedDiscussion d2 = new ManagedDiscussion(Session); ManagedDiscussionPost p = new ManagedDiscussionPost(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); TransitDiscussion t_d = new TransitDiscussion(); t_d.Description = GetNewString(); t_d.Name = GetNewString(); t_d.Personal = false; d1.CreateOrUpdate(t_d, a.GetSecurityContext()); t_d.Name = GetNewString(); d2.CreateOrUpdate(t_d, a.GetSecurityContext()); TransitDiscussionPost t_p = new TransitDiscussionPost(); t_p.Subject = GetNewString(); t_p.Body = GetNewString(); t_p.DiscussionId = d1.Id; int id1 = p.CreateOrUpdate(t_p, a.GetSecurityContext()); Assert.AreNotEqual(0, id1); t_p.DiscussionId = d2.Id; int id2 = p.CreateOrUpdate(t_p, a.GetSecurityContext()); Assert.AreNotEqual(0, id2); // can't create child of other discussion t_p.DiscussionId = d1.Id; t_p.DiscussionPostParentId = id2; int id3 = p.CreateOrUpdate(t_p, a.GetSecurityContext()); Session.Flush(); } finally { d1.Delete(AdminSecurityContext); d2.Delete(AdminSecurityContext); a.Delete(AdminSecurityContext); } }
public void CreatePlace() { ManagedPlaceType type = new ManagedPlaceType(Session); ManagedCountry c = new ManagedCountry(Session); ManagedState t = new ManagedState(Session); ManagedCity s = new ManagedCity(Session); ManagedAccount a = new ManagedAccount(Session); try { a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext); a.VerifyAllEmails(); a.AddDefaultPicture(); TransitCountry tc = new TransitCountry(); tc.Name = GetNewString(); TransitState tt = new TransitState(); tt.Name = GetNewString(); tt.Country = tc.Name; TransitCity ts = new TransitCity(); ts.Name = GetNewString(); ts.Country = tc.Name; ts.State = tt.Name; c.CreateOrUpdate(tc, AdminSecurityContext); t.CreateOrUpdate(tt, AdminSecurityContext); s.CreateOrUpdate(ts, AdminSecurityContext); TransitPlaceType t_type = new TransitPlaceType(); t_type.Name = GetNewString(); type.CreateOrUpdate(t_type, AdminSecurityContext); TransitPlace t_place = new TransitPlace(); t_place.Name = GetNewString(); t_place.Type = t_type.Name; t_place.City = ts.Name; t_place.Country = tc.Name; t_place.State = tt.Name; t_place.AccountId = a.Id; ManagedPlace m_place = new ManagedPlace(Session); m_place.CreateOrUpdate(t_place, a.GetSecurityContext()); } finally { try { a.Delete(AdminSecurityContext); type.Delete(AdminSecurityContext); s.Delete(AdminSecurityContext); t.Delete(AdminSecurityContext); c.Delete(AdminSecurityContext); } catch { } } }