Пример #1
0
        public void ThreadInvoke_Transaction_Begin_RollBack()
        {
            string path;

            using (Utility.WithEmptyDirectory(out path))
                using (var fixture = CreateRealmsInstance(path))
                    using (var t = new RealmThread(fixture.Config))
                    {
                        t.BeginTransaction();
                        t.Invoke(r =>
                        {
                            var obj = r.CreateObject <KeyValueRecord>();
                            obj.Key = "key";
                        });
                        fixture.Refresh();
                        Assert.Null(fixture.ObjectForPrimaryKey <KeyValueRecord>("key"));        // Should not be available yet
                        t.RollbackTransaction();
                        fixture.Refresh();
                        Assert.Null(fixture.ObjectForPrimaryKey <KeyValueRecord>("key"));        // Should not be available
                    }
        }