예제 #1
0
        public void TestModelCreationFailureDoesntReturn()
        {
            RunTestWithRealmAsync(async(realmFactory, storage) =>
            {
                using var importer = new BeatmapImporter(realmFactory, storage);
                using var store    = new RealmRulesetStore(realmFactory, storage);

                var progressNotification = new ImportProgressNotification();

                var zipStream = new MemoryStream();

                using (var zip = ZipArchive.Create())
                    zip.SaveTo(zipStream, new ZipWriterOptions(CompressionType.Deflate));

                var imported = await importer.Import(
                    progressNotification,
                    new ImportTask(zipStream, string.Empty)
                    );

                checkBeatmapSetCount(realmFactory.Context, 0);
                checkBeatmapCount(realmFactory.Context, 0);

                Assert.IsEmpty(imported);
                Assert.AreEqual(ProgressNotificationState.Cancelled, progressNotification.State);
            });
        }
예제 #2
0
        public async Task TestModelCreationFailureDoesntReturn()
        {
            using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(ImportBeatmapTest)))
            {
                try
                {
                    var osu      = LoadOsuIntoHost(host);
                    var importer = osu.Dependencies.Get <BeatmapManager>();

                    var progressNotification = new ImportProgressNotification();

                    var zipStream = new MemoryStream();

                    using (var zip = ZipArchive.Create())
                        zip.SaveTo(zipStream, new ZipWriterOptions(CompressionType.Deflate));

                    var imported = await importer.Import(
                        progressNotification,
                        new ImportTask(zipStream, string.Empty)
                        );

                    checkBeatmapSetCount(osu, 0);
                    checkBeatmapCount(osu, 0);

                    Assert.IsEmpty(imported);
                    Assert.AreEqual(ProgressNotificationState.Cancelled, progressNotification.State);
                }
                finally
                {
                    host.Exit();
                }
            }
        }