private void Awake() { if (EmptyDatabase || RefillDatabase) { SqliteHelper.EmptyDatabase(); } if (CreateDefaultUser) { CreateUser("*****@*****.**", "1a"); } if (CreateSecondUser) { CreateUser("*****@*****.**", "1a"); } if (RefillDatabase) { int oldId = Db.ActiveUser.Id; // Yeah this Id stuff here is a bit hacky, I know. if (!Db.ActiveUser.IsMyIdValid) { Db.ActiveUser.SetId(DbBaseEntity.FirstValidId); } List <ContactModel> contacts = ContactModel.CreateRandom(FillRecordCount); contacts.ForEach(c => Db.ContactRepo.Create(c)); // This doesn't perform well but this is only executed for a few debugging sessions, it's fine. Db.ActiveUser.SetId(oldId); } }
public List <ContactModel> ReadAll() { if (!DbBaseEntity.IsIdValid(Db.ActiveUser.Id)) { return(new List <ContactModel>()); } return(ContactModel.CreateRandom(100)); }
public IEnumerator Test_ContactSimple() { yield return(null); yield return(null); ContactController.Instance.SetAllContactsFromDb(false); if (ContactController.Instance.AllContacts.Count == 0) { List <ContactModel> contacts = ContactModel.CreateRandom(10); contacts.ForEach(c => Db.ContactRepo.Create(c)); } ContactController.Instance.SetAllContactsFromDb(false); Assert.True(ContactController.Instance.AllContacts.Count > 0); yield return(null); }
public IEnumerator Test_ContactSimple2() { Assert.True(ContactModel.CreateRandom(10).Count == 10); yield return(null); }