Esempio n. 1
0
        public void TestAccessAfterStorageMigrate()
        {
            RunTestWithRealm((realm, storage) =>
            {
                var beatmap = new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata());

                Live <BeatmapInfo>?liveBeatmap = null;

                realm.Run(r =>
                {
                    r.Write(_ => r.Add(beatmap));

                    liveBeatmap = beatmap.ToLive(realm);
                });

                using (var migratedStorage = new TemporaryNativeStorage("realm-test-migration-target"))
                {
                    migratedStorage.DeleteDirectory(string.Empty);

                    using (realm.BlockAllOperations())
                    {
                        storage.Migrate(migratedStorage);
                    }

                    Assert.IsFalse(liveBeatmap?.PerformRead(l => l.Hidden));
                }
            });
        }
Esempio n. 2
0
        public void TestAccessAfterStorageMigrate()
        {
            RunTestWithRealm((realmFactory, storage) =>
            {
                var beatmap = new RealmBeatmap(CreateRuleset(), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());

                ILive <RealmBeatmap> liveBeatmap;

                using (var context = realmFactory.CreateContext())
                {
                    context.Write(r => r.Add(beatmap));

                    liveBeatmap = beatmap.ToLive(realmFactory);
                }

                using (var migratedStorage = new TemporaryNativeStorage("realm-test-migration-target"))
                {
                    migratedStorage.DeleteDirectory(string.Empty);

                    storage.Migrate(migratedStorage);

                    Assert.IsFalse(liveBeatmap.PerformRead(l => l.Hidden));
                }
            });
        }
Esempio n. 3
0
        public override void SetUp()
        {
            storage = new TemporaryNativeStorage("realm-benchmark");
            storage.DeleteDirectory(string.Empty);

            realm = new RealmAccess(storage, "client");

            realm.Run(r =>
            {
                realm.Write(c => c.Add(TestResources.CreateTestBeatmapSetInfo(rulesets: new[] { new OsuRuleset().RulesetInfo })));
            });

            updateThread = new UpdateThread(() => { }, null);
            updateThread.Start();
        }
Esempio n. 4
0
 static RealmTest()
 {
     storage = new TemporaryNativeStorage("realm-test");
     storage.DeleteDirectory(string.Empty);
 }