Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void renameTemporaryBackupToExpected(java.nio.file.Path temporaryFullBackupLocation, java.nio.file.Path userSpecifiedBackupLocation) throws java.io.IOException
        private void RenameTemporaryBackupToExpected(Path temporaryFullBackupLocation, Path userSpecifiedBackupLocation)
        {
            Path newBackupLocationForPreExistingBackup = _backupCopyService.findNewBackupLocationForBrokenExisting(userSpecifiedBackupLocation);

            _backupCopyService.moveBackupLocation(userSpecifiedBackupLocation, newBackupLocationForPreExistingBackup);
            _backupCopyService.moveBackupLocation(temporaryFullBackupLocation, userSpecifiedBackupLocation);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void logicForMovingBackupsIsDelegatedToFileMovePropagator() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LogicForMovingBackupsIsDelegatedToFileMovePropagator()
        {
            // given
            Path parentDirectory = TestDirectory.directory("parent").toPath();
            Path oldLocation     = parentDirectory.resolve("oldLocation");

            Files.createDirectories(oldLocation);
            Path newLocation = parentDirectory.resolve("newLocation");

            // and
            FileMoveAction fileOneMoveAction = mock(typeof(FileMoveAction));
            FileMoveAction fileTwoMoveAction = mock(typeof(FileMoveAction));

            when(_fileMoveProvider.traverseForMoving(any())).thenReturn(Stream.of(fileOneMoveAction, fileTwoMoveAction));

            // when
            Subject.moveBackupLocation(oldLocation, newLocation);

            // then file move propagator was requested with correct source and baseDirectory
            verify(_fileMoveProvider).traverseForMoving(oldLocation.toFile());

            // and files were moved to correct target directory
            verify(fileOneMoveAction).move(newLocation.toFile());
            verify(fileTwoMoveAction).move(newLocation.toFile());
        }