예제 #1
0
 public void TearDown()
 {
     _realm.Close();
     Realm.DeleteRealm(_realm.Config);
 }
예제 #2
0
        protected override void CustomTearDown()
        {
            base.CustomTearDown();

            Realm.DeleteRealm(_configuration);
        }
예제 #3
0
 public void Setup()
 {
     Realm.DeleteRealm(RealmConfiguration.DefaultConfiguration);
     _realm = Realm.GetInstance();
 }
예제 #4
0
        public void TestClientResync()
        {
            SyncTestHelpers.RunRosTestAsync(async() =>
            {
                var config = await GetClientResyncConfig();

                // Let's delete anything local.
                Realm.DeleteRealm(config);
                Exception ex   = null;
                Session.Error += (s, e) =>
                {
                    if (e.Exception.Message != "End of input")
                    {
                        Debugger.Break();
                        ex = e.Exception;
                    }
                };

                using (var realm = await Realm.GetInstanceAsync(config))
                {
                    realm.Write(() =>
                    {
                        realm.Add(new IntPrimaryKeyWithValueObject
                        {
                            Id          = 1,
                            StringValue = "1"
                        });
                    });

                    await WaitForUploadAsync(realm);
                }

                // Stop ROS and backup the file. Then restart
                Debugger.Break();

                using (var realm = await GetRealmAsync(config))
                {
                    realm.Write(() =>
                    {
                        realm.Add(new IntPrimaryKeyWithValueObject
                        {
                            Id          = 2,
                            StringValue = "2"
                        });
                    });

                    await WaitForUploadAsync(realm);

                    // Stop ROS
                    Debugger.Break();

                    realm.Write(() =>
                    {
                        realm.Add(new IntPrimaryKeyWithValueObject
                        {
                            Id          = 3,
                            StringValue = "3"
                        });
                    });
                }

                // Replace the file from backup. Restart ROS and run TestClientResync2
                Debugger.Break();

                Assert.That(ex, Is.Null);
            }, (int)TimeSpan.FromMinutes(10).TotalMilliseconds);
        }