//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldContinueMovingFilesIfUpgradeCancelledWhileMoving() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldContinueMovingFilesIfUpgradeCancelledWhileMoving() { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache); string versionToMigrateTo = upgradableDatabase.CurrentVersion(); string versionToMigrateFrom = upgradableDatabase.CheckUpgradable(_databaseLayout).storeVersion(); { // GIVEN StoreUpgrader upgrader = NewUpgrader(upgradableDatabase, _allowMigrateConfig, pageCache); string failureMessage = "Just failing"; upgrader.AddParticipant(ParticipantThatWillFailWhenMoving(failureMessage)); // WHEN try { upgrader.MigrateIfNeeded(_databaseLayout); fail("should have thrown"); } catch (UnableToUpgradeException e) { // THEN assertTrue(e.InnerException is IOException); assertEquals(failureMessage, e.InnerException.Message); } } { // AND WHEN StoreUpgrader upgrader = NewUpgrader(upgradableDatabase, pageCache); StoreMigrationParticipant observingParticipant = Mockito.mock(typeof(StoreMigrationParticipant)); upgrader.AddParticipant(observingParticipant); upgrader.MigrateIfNeeded(_databaseLayout); // THEN verify(observingParticipant, Mockito.never()).migrate(any(typeof(DatabaseLayout)), any(typeof(DatabaseLayout)), any(typeof(ProgressReporter)), eq(versionToMigrateFrom), eq(versionToMigrateTo)); verify(observingParticipant, Mockito.times(1)).moveMigratedFiles(any(typeof(DatabaseLayout)), any(typeof(DatabaseLayout)), eq(versionToMigrateFrom), eq(versionToMigrateTo)); verify(observingParticipant, Mockito.times(1)).cleanup(any(typeof(DatabaseLayout))); } }