//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void backupNeedsToBePath() internal virtual void BackupNeedsToBePath() { ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService)); Path homeDir = _testDir.directory("home").toPath(); CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService); File backupPath = new File(homeDir.toFile(), "dir/does/not/exist"); CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => checkConsistencyCommand.execute(new string[] { "--backup=" + backupPath })); assertEquals("Specified backup should be a directory: " + backupPath, commandFailed.Message); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void failsWhenInconsistenciesAreFound() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void FailsWhenInconsistenciesAreFound() { ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService)); Path homeDir = _testDir.directory("home").toPath(); File databasesFolder = GetDatabasesFolder(homeDir); CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService); DatabaseLayout databaseLayout = DatabaseLayout.of(databasesFolder, "mydb"); when(consistencyCheckService.runFullConsistencyCheck(eq(databaseLayout), any(typeof(Config)), any(typeof(ProgressMonitorFactory)), any(typeof(LogProvider)), any(typeof(FileSystemAbstraction)), eq(true), any(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.failure(new File("/the/report/path"))); CommandFailed commandFailed = assertThrows(typeof(CommandFailed), () => checkConsistencyCommand.execute(new string[] { "--database=mydb", "--verbose" })); assertThat(commandFailed.Message, containsString((new File("/the/report/path")).ToString())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void databaseAndBackupAreMutuallyExclusive() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void DatabaseAndBackupAreMutuallyExclusive() { ConsistencyCheckService consistencyCheckService = mock(typeof(ConsistencyCheckService)); Path homeDir = _testDir.directory("home").toPath(); CheckConsistencyCommand checkConsistencyCommand = new CheckConsistencyCommand(homeDir, _testDir.directory("conf").toPath(), consistencyCheckService); when(consistencyCheckService.runFullConsistencyCheck(any(), any(), any(), any(), any(), anyBoolean(), any(typeof(ConsistencyFlags)))).thenReturn(ConsistencyCheckService.Result.success(null)); IncorrectUsage incorrectUsage = assertThrows(typeof(IncorrectUsage), () => checkConsistencyCommand.execute(new string[] { "--database=foo", "--backup=bar" })); assertEquals("Only one of '--database' and '--backup' can be specified.", incorrectUsage.Message); }