protected Task RunAsyncTest() { var personsRealm = new PersonsRealmService(); return(personsRealm.WriteAsync(realmService => { for (var i = 0; i < 1000; i++) { realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jane" }); realmService.Add(new Person { Name = "Jessica" }); } })); }
public void WriteAsyncTimeTest() { // Got 8.79 secs, 9.19 secs, and 10.227 secs for 50000 small items added using autoincrementer. // Higher now for some reason. Getting 13 secs. var personsRealm = new PersonsRealmService(); personsRealm.Write(() => personsRealm.RemoveAll()); RunAsyncServiceTests().Wait(); Assert.Pass(); }
public void WriteAsyncTests() { var personsRealm = new PersonsRealmService(); personsRealm.Write(() => personsRealm.RemoveAll()); RunAsyncServiceTests().Wait(); personsRealm.RefreshRealmInstance(); var sorted = personsRealm.GetAll().OrderBy(x => x.Id).ToList(); Assert.That(sorted.Count, Is.EqualTo(50000)); var firstId = sorted.First().Id; var lastId = sorted.Last().Id; var total = lastId - firstId + 1; Assert.That(total, Is.EqualTo(50000)); personsRealm.Write(() => personsRealm.RemoveAll()); }
protected void RunServiceTests() { var realmService = RealmService.GetInstance <Models.Person>(); realmService.Write(() => { realmService.Add(new Person { Name = "Greg" }); realmService.Add(new Person { Name = "Jim" }); realmService.Add(new Person { Name = "Bob" }); }); // OR var personsRealm = new PersonsRealmService(); personsRealm.Write(() => { personsRealm.Add(new Person { Name = "Jan" }); personsRealm.Add(new Person { Name = "June" }); personsRealm.Add(new Person { Name = "Jinny" }); }); var persons = personsRealm.GetAll().ToList(); personsRealm.Write(() => { personsRealm.RemoveAll(); }); }
protected async void RunAsyncServiceTests() { await Task.WhenAll( RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest(), RunAsyncTest()); var personsRealm = new PersonsRealmService(); var persons = personsRealm.GetAll().ToList(); personsRealm.Write(() => { personsRealm.RemoveAll(); }); }
protected Task RunAsyncTest() { var personsRealm = new PersonsRealmService(); return(personsRealm.WriteAsync(realmService => { realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); realmService.Add(new Person { Name = "Jan" }); realmService.Add(new Person { Name = "June" }); realmService.Add(new Person { Name = "Jinny" }); })); }